feat(tests): updated flaky tests (#4244)

Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko 2023-12-22 10:01:44 +03:00 committed by GitHub
parent fd5766ba5c
commit 829474e7fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 4 deletions

View File

@ -19,7 +19,7 @@ test.describe('Collaborative test for issue', () => {
test('Issues can be assigned to another users', async ({ page, browser }) => {
const newIssue: NewIssue = {
title: 'Issues can be assigned to another users',
title: `Issues can be assigned to another users-${generateId()}`,
description: 'Issues can be assigned to another users',
status: 'Backlog',
priority: 'Urgent',

View File

@ -27,6 +27,7 @@ export class CommonPage {
}
async fillToSelectPopup (page: Page, input: string): Promise<void> {
await expect(page.locator('div.selectPopup input')).toBeVisible()
await page.locator('div.selectPopup input').fill(input)
await page.locator('div.selectPopup button').click()
}
@ -72,4 +73,8 @@ export class CommonPage {
await page.locator('div.selectPopup input').fill(point)
await page.locator('div.selectPopup span[class^="lines"]', { hasText: point }).click()
}
async closeNotification (page: Page): Promise<void> {
await page.locator('div.notify-container button[type="button"].small').nth(0).click()
}
}

View File

@ -74,10 +74,13 @@ export class IssuesPage extends CommonTrackerPage {
)
}
async createNewIssue (data: NewIssue): Promise<void> {
async createNewIssue (data: NewIssue, closeNotification: boolean = true): Promise<void> {
await this.buttonCreateNewIssue.click()
await this.fillNewIssueForm(data)
await this.buttonCreateIssue.click()
if (closeNotification) {
await this.closeNotification(this.page)
}
}
async fillNewIssueForm (data: NewIssue): Promise<void> {
@ -184,7 +187,7 @@ export class IssuesPage extends CommonTrackerPage {
}
}
async getIssueId (issueLabel: string, position: number = 1): Promise<string> {
async getIssueId (issueLabel: string, position: number = 0): Promise<string> {
const id = await this.page.locator(`span[title="${issueLabel}"].overflow-label`).nth(position).textContent()
return id?.trim() ?? ''
}

View File

@ -42,7 +42,7 @@ test.describe('Tracker duplicate issue tests', () => {
const firstIssueId = await issuesPage.getIssueId(firstIssue.title)
await issuesPage.createNewIssue(secondIssue)
const secondIssueId = await issuesPage.getIssueId(secondIssue.title, 2)
const secondIssueId = await issuesPage.getIssueId(secondIssue.title, 1)
expect(firstIssueId).not.toEqual(secondIssueId)
await issuesPage.checkIssuesCount(firstIssue.title, 2)