diff --git a/tests/sanity/tests/model/tracker/issues-details-page.ts b/tests/sanity/tests/model/tracker/issues-details-page.ts index d91e16e852..777beb1b85 100644 --- a/tests/sanity/tests/model/tracker/issues-details-page.ts +++ b/tests/sanity/tests/model/tracker/issues-details-page.ts @@ -21,6 +21,10 @@ export class IssuesDetailsPage extends CommonTrackerPage { readonly buttonAddSubIssue: Locator readonly textRelated: Locator readonly buttonCollaborators: Locator + readonly buttonIssueOnSearchForIssueModal: Locator + readonly inputSearchOnSearchForIssueModal: Locator + readonly textBlockedBy: Locator + readonly textBlocks: Locator constructor (page: Page) { super(page) @@ -42,6 +46,10 @@ export class IssuesDetailsPage extends CommonTrackerPage { this.buttonAddSubIssue = page.locator('#add-sub-issue') this.textRelated = page.locator('//span[text()="Related"]/following-sibling::div[1]/div//span') this.buttonCollaborators = page.locator('//span[text()="Collaborators"]/following-sibling::div[1]/button') + this.buttonIssueOnSearchForIssueModal = page.locator('div.popup div.tabs > div.tab:last-child') + this.inputSearchOnSearchForIssueModal = page.locator('div.popup input[type="text"]') + this.textBlockedBy = page.locator('//span[text()="Blocked by"]/following-sibling::div[1]/div/div/button/span') + this.textBlocks = page.locator('//span[text()="Blocks"]/following-sibling::div[1]/div/div/button/span') } async editIssue (data: Issue): Promise { @@ -110,6 +118,12 @@ export class IssuesDetailsPage extends CommonTrackerPage { if (data.relatedIssue != null) { await expect(this.textRelated).toContainText(data.relatedIssue) } + if (data.blockedBy != null) { + await expect(this.textBlockedBy).toContainText(data.blockedBy) + } + if (data.blocks != null) { + await expect(this.textBlocks).toContainText(data.blocks) + } } async moreActionOnIssue (action: string): Promise { @@ -160,4 +174,17 @@ export class IssuesDetailsPage extends CommonTrackerPage { async checkComparingTextAdded (text: string): Promise { await expect(this.page.locator('span.text-editor-highlighted-node-add', { hasText: text }).first()).toBeVisible() } + + async fillSearchForIssueModal (issueTitle: string): Promise { + await this.buttonIssueOnSearchForIssueModal.click() + await this.inputSearchOnSearchForIssueModal.fill(issueTitle) + await this.page.locator('div.popup div.list-item', { hasText: issueTitle }).click() + } + + async moreActionOnIssueWithSecondLevel (actionFirst: string, actionSecond: string): Promise { + await this.buttonMoreActions.click() + await this.page.locator('button.antiPopup-submenu', { hasText: actionFirst }).hover() + await this.page.locator('button.antiPopup-submenu', { hasText: actionFirst }).click() + await this.selectFromDropdown(this.page, actionSecond) + } } diff --git a/tests/sanity/tests/model/tracker/types.ts b/tests/sanity/tests/model/tracker/types.ts index cdb3dc655d..76236735c3 100644 --- a/tests/sanity/tests/model/tracker/types.ts +++ b/tests/sanity/tests/model/tracker/types.ts @@ -16,6 +16,8 @@ export interface Issue { filePath?: string parentIssue?: string relatedIssue?: string + blockedBy?: string + blocks?: string } export interface NewProject { diff --git a/tests/sanity/tests/tracker/relations.spec.ts b/tests/sanity/tests/tracker/relations.spec.ts new file mode 100644 index 0000000000..4f95dec191 --- /dev/null +++ b/tests/sanity/tests/tracker/relations.spec.ts @@ -0,0 +1,67 @@ +import { test } from '@playwright/test' +import { IssuesPage } from '../model/tracker/issues-page' +import { generateId, PlatformSetting, PlatformURI } from '../utils' +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' + +test.use({ + storageState: PlatformSetting +}) +test.describe('Relations', () => { + test.beforeEach(async ({ page }) => { + await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() + }) + + test('Mark as blocked by', async ({ page }) => { + const firstIssue: NewIssue = { + title: `First. Mark as blocked by-${generateId()}`, + description: 'First. Mark as blocked by' + } + 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 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) + await test.step('Set blocked by and check issue description', async () => { + await issuesDetailsPage.waitDetailsOpened(firstIssue.title) + await issuesDetailsPage.moreActionOnIssueWithSecondLevel('Relations', 'Mark as blocked by...') + await issuesDetailsPage.fillSearchForIssueModal(secondIssue.title) + + await issuesDetailsPage.checkIssue({ + ...firstIssue, + blockedBy: 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, + blocks: firstIssueId + }) + }) + }) +})