feat(tests): TESTS-47 done Mark as blocked by test (#4737)

Signed-off-by: Alex Velichko <alex@hardcoreeng.com>
This commit is contained in:
Alex Velichko 2024-02-22 06:45:31 +03:00 committed by GitHub
parent 44a6147368
commit d6909b4605
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 96 additions and 0 deletions

View File

@ -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<void> {
@ -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<void> {
@ -160,4 +174,17 @@ export class IssuesDetailsPage extends CommonTrackerPage {
async checkComparingTextAdded (text: string): Promise<void> {
await expect(this.page.locator('span.text-editor-highlighted-node-add', { hasText: text }).first()).toBeVisible()
}
async fillSearchForIssueModal (issueTitle: string): Promise<void> {
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<void> {
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)
}
}

View File

@ -16,6 +16,8 @@ export interface Issue {
filePath?: string
parentIssue?: string
relatedIssue?: string
blockedBy?: string
blocks?: string
}
export interface NewProject {

View File

@ -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
})
})
})
})