feat(tests): updated Create duplicate issues test (#4542)

Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko
2024-02-05 20:09:49 -03:00
committed by GitHub
parent 02758613d7
commit b7ed7ef4f1
3 changed files with 17 additions and 1 deletions
@@ -2,7 +2,7 @@ import { expect, type Locator, type Page } from '@playwright/test'
import { NewIssue } from './types'
import path from 'path'
import { CommonTrackerPage } from './common-tracker-page'
import { iterateLocator } from '../../utils'
import { attachScreenshot, iterateLocator } from '../../utils'
export class IssuesPage extends CommonTrackerPage {
readonly page: Page
@@ -85,6 +85,7 @@ export class IssuesPage extends CommonTrackerPage {
if (closeNotification) {
await this.closeNotification(this.page)
}
await attachScreenshot(`createdNewIssue-${data.title}.png`, this.page)
}
async fillNewIssueForm (data: NewIssue): Promise<void> {
@@ -38,10 +38,17 @@ test.describe('Tracker duplicate issue tests', () => {
const issuesPage = new IssuesPage(page)
await issuesPage.modelSelectorAll.click()
await issuesPage.createNewIssue(firstIssue)
// TODO need to delete if issue created successfully
await trackerNavigationMenuPage.openTemplateForProject('Default')
await trackerNavigationMenuPage.openIssuesForProject('Default')
await issuesPage.searchIssueByName(firstIssue.title)
const firstIssueId = await issuesPage.getIssueId(firstIssue.title)
await issuesPage.createNewIssue(secondIssue)
// TODO need to delete if issue created successfully
await trackerNavigationMenuPage.openTemplateForProject('Default')
await trackerNavigationMenuPage.openIssuesForProject('Default')
await issuesPage.searchIssueByName(secondIssue.title)
const secondIssueId = await issuesPage.getIssueId(secondIssue.title, 1)
+8
View File
@@ -1,4 +1,5 @@
import { Browser, Locator, Page, expect } from '@playwright/test'
import { allure } from 'allure-playwright'
export const PlatformURI = process.env.PLATFORM_URI as string
export const PlatformTransactor = process.env.PLATFORM_TRANSACTOR as string
@@ -74,3 +75,10 @@ export async function * iterateLocator (locator: Locator): AsyncGenerator<Locato
yield locator.nth(index)
}
}
export async function attachScreenshot (name: string, page: Page): Promise<void> {
await allure.attachment(name, await page.screenshot(), {
contentType: 'image/png'
})
await page.screenshot({ path: `screenshots/${name}` })
}