Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/sanity/tests/model/tracker/issues-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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> {
Expand Down
7 changes: 7 additions & 0 deletions tests/sanity/tests/tracker/issues-duplicate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 8 additions & 0 deletions tests/sanity/tests/utils.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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}` })
}
Loading