mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-26 13:47:26 +03:00
feat(tests): TESTS-48 done Create duplicate issues test (#4225)
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
parent
c705fd385c
commit
e7f7751643
@ -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)
|
||||
|
74
tests/sanity/tests/tracker/issues-duplicate.spec.ts
Normal file
74
tests/sanity/tests/tracker/issues-duplicate.spec.ts
Normal 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
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user