feat(tests): TESTS-48 done Create duplicate issues test (#4225)

Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko 2023-12-21 10:51:25 +03:00 committed by GitHub
parent c705fd385c
commit e7f7751643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 87 additions and 0 deletions

View File

@ -184,6 +184,19 @@ export class IssuesPage extends CommonTrackerPage {
}
}
async getIssueId (issueLabel: string, position: number = 1): Promise<string> {
const id = await this.page.locator(`span[title="${issueLabel}"].overflow-label`).nth(position).textContent()
return id?.trim() ?? ''
}
async openIssueById (issueId: string): Promise<void> {
await this.page.locator(`div.listGrid div.flex-no-shrink a[href$="${issueId}"]`).click()
}
async checkIssuesCount (issueName: string, count: number): Promise<void> {
await expect(this.page.locator('div.listGrid a', { hasText: issueName })).toHaveCount(count)
}
async selectTemplate (templateName: string): Promise<void> {
await this.buttonPopupCreateNewIssueTemplate.click()
await this.selectMenuItem(this.page, templateName)

View File

@ -0,0 +1,74 @@
import { expect, test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils'
import { LeftSideMenuPage } from '../model/left-side-menu-page'
import { IssuesPage } from '../model/tracker/issues-page'
import { NewIssue } from '../model/tracker/types'
import { allure } from 'allure-playwright'
import { IssuesDetailsPage } from '../model/tracker/issues-details-page'
import { TrackerNavigationMenuPage } from '../model/tracker/tracker-navigation-menu-page'
test.use({
storageState: PlatformSetting
})
test.describe('Tracker duplicate issue tests', () => {
test.beforeEach(async ({ page }) => {
await allure.parentSuite('Tracker tests')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
})
test('Create duplicate issues with the same title', async ({ page }) => {
const generatedId = generateId()
const firstIssue: NewIssue = {
title: `Duplicate issue-${generatedId}`,
description: 'First Duplicate issue'
}
const secondIssue: NewIssue = {
title: `Duplicate issue-${generatedId}`,
description: 'Second Duplicate issue'
}
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.buttonTracker.click()
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
await trackerNavigationMenuPage.openIssuesForProject('Default')
const issuesPage = new IssuesPage(page)
await issuesPage.modelSelectorAll.click()
await issuesPage.createNewIssue(firstIssue)
await issuesPage.searchIssueByName(firstIssue.title)
const firstIssueId = await issuesPage.getIssueId(firstIssue.title)
await issuesPage.createNewIssue(secondIssue)
const secondIssueId = await issuesPage.getIssueId(secondIssue.title, 2)
expect(firstIssueId).not.toEqual(secondIssueId)
await issuesPage.checkIssuesCount(firstIssue.title, 2)
await test.step('Update the first issue title', async () => {
const newIssueTitle = `Update Duplicate issue-${generateId()}`
await issuesPage.openIssueById(firstIssueId)
const issuesDetailsPage = new IssuesDetailsPage(page)
await issuesDetailsPage.inputTitle.fill(newIssueTitle)
await issuesDetailsPage.checkIssue({
...firstIssue,
title: newIssueTitle
})
})
await test.step('Check that the second issue title still the same', async () => {
await trackerNavigationMenuPage.openIssuesForProject('Default')
await issuesPage.searchIssueByName(secondIssue.title)
await issuesPage.openIssueById(secondIssueId)
const issuesDetailsPage = new IssuesDetailsPage(page)
await issuesDetailsPage.checkIssue({
...secondIssue
})
})
})
})