diff --git a/tests/sanity/tests/tracker/common-steps.ts b/tests/sanity/tests/tracker/common-steps.ts new file mode 100644 index 0000000000..88b6b31e75 --- /dev/null +++ b/tests/sanity/tests/tracker/common-steps.ts @@ -0,0 +1,14 @@ +import { Page, test } from '@playwright/test' +import { IssuesPage } from '../model/tracker/issues-page' +import { NewIssue } from '../model/tracker/types' + +export async function prepareNewIssueStep (page: Page, issue: NewIssue): Promise { + return await test.step('Prepare document', async () => { + const issuesPage = new IssuesPage(page) + await issuesPage.modelSelectorAll.click() + + await issuesPage.createNewIssue(issue) + await issuesPage.searchIssueByName(issue.title) + return await issuesPage.getIssueId(issue.title) + }) +} diff --git a/tests/sanity/tests/tracker/relations.spec.ts b/tests/sanity/tests/tracker/relations.spec.ts index 4f95dec191..a4c641ae42 100644 --- a/tests/sanity/tests/tracker/relations.spec.ts +++ b/tests/sanity/tests/tracker/relations.spec.ts @@ -5,6 +5,7 @@ import { NewIssue } from '../model/tracker/types' import { LeftSideMenuPage } from '../model/left-side-menu-page' import { IssuesDetailsPage } from '../model/tracker/issues-details-page' import { TrackerNavigationMenuPage } from '../model/tracker/tracker-navigation-menu-page' +import { prepareNewIssueStep } from './common-steps' test.use({ storageState: PlatformSetting @@ -26,16 +27,10 @@ test.describe('Relations', () => { const leftSideMenuPage = new LeftSideMenuPage(page) await leftSideMenuPage.buttonTracker.click() + const secondIssueId = await prepareNewIssueStep(page, secondIssue) + const firstIssueId = await prepareNewIssueStep(page, firstIssue) + const issuesPage = new IssuesPage(page) - await issuesPage.modelSelectorAll.click() - - await issuesPage.createNewIssue(secondIssue) - await issuesPage.searchIssueByName(secondIssue.title) - const secondIssueId = await issuesPage.getIssueId(secondIssue.title) - - await issuesPage.createNewIssue(firstIssue) - await issuesPage.searchIssueByName(firstIssue.title) - const firstIssueId = await issuesPage.getIssueId(firstIssue.title) await issuesPage.openIssueByName(firstIssue.title) const issuesDetailsPage = new IssuesDetailsPage(page) @@ -48,6 +43,7 @@ test.describe('Relations', () => { ...firstIssue, blockedBy: secondIssueId }) + await issuesDetailsPage.checkActivityContentExist(`New blocked by: ${secondIssueId}`) }) await test.step('Check the second issue description', async () => { @@ -64,4 +60,98 @@ test.describe('Relations', () => { }) }) }) + + test('Mark as blocking', async ({ page }) => { + const firstIssue: NewIssue = { + title: `First. Mark as blocking-${generateId()}`, + description: 'First. Mark as blocking' + } + const secondIssue: NewIssue = { + title: `Second. Mark as blocked by-${generateId()}`, + description: 'Second. Mark as blocked by' + } + const leftSideMenuPage = new LeftSideMenuPage(page) + await leftSideMenuPage.buttonTracker.click() + + const secondIssueId = await prepareNewIssueStep(page, secondIssue) + const firstIssueId = await prepareNewIssueStep(page, firstIssue) + + const issuesPage = new IssuesPage(page) + await issuesPage.openIssueByName(firstIssue.title) + + const issuesDetailsPage = new IssuesDetailsPage(page) + await test.step('Mark as blocking... and check issue description', async () => { + await issuesDetailsPage.waitDetailsOpened(firstIssue.title) + await issuesDetailsPage.moreActionOnIssueWithSecondLevel('Relations', 'Mark as blocking...') + await issuesDetailsPage.fillSearchForIssueModal(secondIssue.title) + + // TODO remove reload after fixed https://front.hc.engineering/workbench/platform/tracker/UBERF-5652 + await page.reload() + await issuesDetailsPage.waitDetailsOpened(firstIssue.title) + await issuesDetailsPage.checkIssue({ + ...firstIssue, + blocks: secondIssueId + }) + }) + + await test.step('Check the second issue description', async () => { + const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) + await trackerNavigationMenuPage.openIssuesForProject('Default') + + await issuesPage.searchIssueByName(secondIssue.title) + await issuesPage.openIssueByName(secondIssue.title) + + await issuesDetailsPage.waitDetailsOpened(secondIssue.title) + await issuesDetailsPage.checkIssue({ + ...secondIssue, + blockedBy: firstIssueId + }) + }) + }) + + test('Reference another issue', async ({ page }) => { + const firstIssue: NewIssue = { + title: `First. Reference another issue-${generateId()}`, + description: 'First. Reference another issue' + } + const secondIssue: NewIssue = { + title: `Second. Reference another issue-${generateId()}`, + description: 'Second. Reference another issue' + } + const leftSideMenuPage = new LeftSideMenuPage(page) + await leftSideMenuPage.buttonTracker.click() + + const secondIssueId = await prepareNewIssueStep(page, secondIssue) + const firstIssueId = await prepareNewIssueStep(page, firstIssue) + + const issuesPage = new IssuesPage(page) + await issuesPage.openIssueByName(firstIssue.title) + + const issuesDetailsPage = new IssuesDetailsPage(page) + await test.step('Reference another issue... and check issue description', async () => { + await issuesDetailsPage.waitDetailsOpened(firstIssue.title) + await issuesDetailsPage.moreActionOnIssueWithSecondLevel('Relations', 'Reference another issue...') + await issuesDetailsPage.fillSearchForIssueModal(secondIssue.title) + + await issuesDetailsPage.waitDetailsOpened(firstIssue.title) + await issuesDetailsPage.checkIssue({ + ...firstIssue, + relatedIssue: secondIssueId + }) + }) + + await test.step('Check the second issue description', async () => { + const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) + await trackerNavigationMenuPage.openIssuesForProject('Default') + + await issuesPage.searchIssueByName(secondIssue.title) + await issuesPage.openIssueByName(secondIssue.title) + + await issuesDetailsPage.waitDetailsOpened(secondIssue.title) + await issuesDetailsPage.checkIssue({ + ...secondIssue, + relatedIssue: firstIssueId + }) + }) + }) })