From 0cd007e08ae714fcdab316b592c34821ccd5f23a Mon Sep 17 00:00:00 2001 From: Alex Velichko Date: Mon, 18 Dec 2023 10:33:58 +0300 Subject: [PATCH] TESTS-46: feat(tests): done New related issue test (#4192) Signed-off-by: Alex Velichko --- .../model/tracker/issues-details-page.ts | 7 +- tests/sanity/tests/model/tracker/types.ts | 1 + .../tests/tracker/related-issues.spec.ts | 66 +++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 tests/sanity/tests/tracker/related-issues.spec.ts diff --git a/tests/sanity/tests/model/tracker/issues-details-page.ts b/tests/sanity/tests/model/tracker/issues-details-page.ts index 6d2d905ee4..56a7a155ff 100644 --- a/tests/sanity/tests/model/tracker/issues-details-page.ts +++ b/tests/sanity/tests/model/tracker/issues-details-page.ts @@ -20,6 +20,7 @@ export class IssuesDetailsPage extends CommonTrackerPage { readonly buttonMoreActions: Locator readonly textParentTitle: Locator readonly buttonAddSubIssue: Locator + readonly textRelated: Locator constructor (page: Page) { super(page) @@ -33,13 +34,14 @@ export class IssuesDetailsPage extends CommonTrackerPage { this.buttonAddLabel = page.locator('button.tag-button') this.buttonComponent = page.locator('//span[text()="Component"]/following-sibling::div[1]/div/button') this.buttonMilestone = page.locator('//span[text()="Milestone"]/following-sibling::div[1]/div/button') - this.textEstimation = page.locator('(//span[text()="Estimation"]/../div/button)[4]') + this.textEstimation = page.locator('//span[text()="Estimation"]/following-sibling::div[1]/button/span') this.buttonEstimation = page.locator('(//span[text()="Estimation"]/../div/button)[3]') this.buttonCreatedBy = page.locator('(//span[text()="Assignee"]/../div/button)[1]') this.buttonCloseIssue = page.locator('div.popupPanel-title > button') this.buttonMoreActions = page.locator('div.popupPanel-title div.flex-row-center > button:first-child') this.textParentTitle = page.locator('span.issue-title') this.buttonAddSubIssue = page.locator('#add-sub-issue') + this.textRelated = page.locator('//span[text()="Related"]/following-sibling::div[1]/div//span') } async editIssue (data: Issue): Promise { @@ -105,6 +107,9 @@ export class IssuesDetailsPage extends CommonTrackerPage { if (data.parentIssue != null) { await expect(this.textParentTitle).toHaveText(data.parentIssue) } + if (data.relatedIssue != null) { + await expect(this.textRelated).toContainText(data.relatedIssue) + } } async moreActionOnIssue (action: string): Promise { diff --git a/tests/sanity/tests/model/tracker/types.ts b/tests/sanity/tests/model/tracker/types.ts index fd6c7fbf3b..e61bc427eb 100644 --- a/tests/sanity/tests/model/tracker/types.ts +++ b/tests/sanity/tests/model/tracker/types.ts @@ -15,6 +15,7 @@ export interface Issue { duedate?: string filePath?: string parentIssue?: string + relatedIssue?: string } export interface NewProject { diff --git a/tests/sanity/tests/tracker/related-issues.spec.ts b/tests/sanity/tests/tracker/related-issues.spec.ts new file mode 100644 index 0000000000..b868e44b72 --- /dev/null +++ b/tests/sanity/tests/tracker/related-issues.spec.ts @@ -0,0 +1,66 @@ +import { 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 { IssuesDetailsPage } from '../model/tracker/issues-details-page' +import { NewIssue } from '../model/tracker/types' +import { allure } from 'allure-playwright' +import { TrackerNavigationMenuPage } from '../model/tracker/tracker-navigation-menu-page' + +test.use({ + storageState: PlatformSetting +}) + +test.describe('Tracker related issue tests', () => { + test.beforeEach(async ({ page }) => { + await allure.parentSuite('Tracker tests') + await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() + }) + + test('New related issue', async ({ page }) => { + const newIssue: NewIssue = { + title: `New Issue with related issue-${generateId()}`, + description: 'Description New Issue with related issue' + } + const relatedIssue: NewIssue = { + title: `New Related issue-${generateId()}`, + description: 'Description New Related issue', + status: 'Done', + priority: 'High', + createLabel: true, + labels: `RELATED-ISSUE-${generateId()}`, + component: 'No component', + estimation: '12', + milestone: 'Milestone', + duedate: 'today' + } + + const leftSideMenuPage = new LeftSideMenuPage(page) + await leftSideMenuPage.buttonTracker.click() + + const issuesPage = new IssuesPage(page) + await issuesPage.modelSelectorAll.click() + await issuesPage.createNewIssue(newIssue) + await issuesPage.searchIssueByName(newIssue.title) + await issuesPage.openIssueByName(newIssue.title) + + const issuesDetailsPage = new IssuesDetailsPage(page) + await issuesDetailsPage.moreActionOnIssue('New related issue') + + await issuesPage.fillNewIssueForm(relatedIssue) + await issuesPage.buttonCreateIssue.click() + + const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) + await trackerNavigationMenuPage.openIssuesForProject('Default') + await issuesPage.searchIssueByName(relatedIssue.title) + await issuesPage.openIssueByName(relatedIssue.title) + + await issuesDetailsPage.waitDetailsOpened(relatedIssue.title) + await issuesDetailsPage.checkIssue({ + ...newIssue, + ...relatedIssue, + estimation: '1d 4h', + relatedIssue: 'TSK' + }) + }) +})