TESTS-89: feat(tests): working on First user change assignee, second user should see assigned issue test (#4046)

Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko 2023-11-27 09:43:11 +03:00 committed by GitHub
parent 6f37f276e2
commit a3bf9c8f73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 73 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -5,6 +5,7 @@ import { NewIssue } from '../model/tracker/types'
import { IssuesPage } from '../model/tracker/issues-page'
import { LeftSideMenuPage } from '../model/left-side-menu-page'
import { IssuesDetailsPage } from '../model/tracker/issues-details-page'
import { NotificationPage } from '../model/notification-page'
test.use({
storageState: PlatformSetting
@ -35,8 +36,6 @@ test.describe('Collaborative test for issue', () => {
// open second page
const userSecondPage = await getSecondPage(browser)
await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished()
const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage)
await leftSideMenuPageSecond.buttonTracker.click()
const issuesPageSecond = new IssuesPage(userSecondPage)
await issuesPageSecond.linkSidebarAll.click()
@ -75,8 +74,6 @@ test.describe('Collaborative test for issue', () => {
// open second page
const userSecondPage = await getSecondPage(browser)
await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished()
const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage)
await leftSideMenuPageSecond.buttonTracker.click()
const issuesPageSecond = new IssuesPage(userSecondPage)
await issuesPageSecond.linkSidebarAll.click()
@ -108,4 +105,51 @@ test.describe('Collaborative test for issue', () => {
status: 'In Progress'
})
})
test('First user change assignee, second user should see assigned issue', async ({ page, browser }) => {
const newAssignee: string = 'Dirak Kainin'
const issue: NewIssue = {
title: 'First user change assignee, second user should see assigned issue',
description: 'Issue for collaborative test'
}
// open second page
const userSecondPage = await getSecondPage(browser)
await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished()
await test.step(`user1. change assignee to ${newAssignee}`, async () => {
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished()
const issuesPage = new IssuesPage(page)
await issuesPage.linkSidebarAll.click()
await issuesPage.modelSelectorBacklog.click()
await issuesPage.searchIssueByName(issue.title)
await issuesPage.openIssueByName(issue.title)
const issuesDetailsPage = new IssuesDetailsPage(page)
await issuesDetailsPage.editIssue({ assignee: newAssignee })
})
await test.step('user2. check notification', async () => {
const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage)
await leftSideMenuPageSecond.checkExistNewNotification(userSecondPage)
await leftSideMenuPageSecond.buttonNotification.click()
const notificationPageSecond = new NotificationPage(userSecondPage)
await notificationPageSecond.checkNotification(issue.title, newAssignee)
await leftSideMenuPageSecond.buttonTracker.click()
})
await test.step('user2. check issue assignee', async () => {
const issuesPageSecond = new IssuesPage(userSecondPage)
await issuesPageSecond.linkSidebarMyIssue.click()
await issuesPageSecond.modelSelectorBacklog.click()
await issuesPageSecond.searchIssueByName(issue.title)
await issuesPageSecond.openIssueByName(issue.title)
const issuesDetailsPageSecond = new IssuesDetailsPage(userSecondPage)
await issuesDetailsPageSecond.checkIssue({ ...issue })
})
})
})

View File

@ -53,4 +53,8 @@ export class CommonPage {
}
await page.locator('div.selectPopup div.list-item').click()
}
async checkExistNewNotification (page: Page): Promise<void> {
await expect(page.locator('button[id$="Inbox"] > div.noty')).toBeVisible()
}
}

View File

@ -1,15 +1,19 @@
import { type Locator, type Page } from '@playwright/test'
import { CommonPage } from './common-page'
export class LeftSideMenuPage {
export class LeftSideMenuPage extends CommonPage {
readonly page: Page
readonly buttonChunter: Locator
readonly buttonContacts: Locator
readonly buttonTracker: Locator
readonly buttonNotification: Locator
constructor (page: Page) {
super()
this.page = page
this.buttonChunter = page.locator('button[id$="ApplicationLabelChunter"]')
this.buttonContacts = page.locator('button[id$="Contacts"]')
this.buttonTracker = page.locator('button[id$="TrackerApplication"]')
this.buttonNotification = page.locator('button[id$="Inbox"]')
}
}

View File

@ -0,0 +1,14 @@
import { expect, type Page } from '@playwright/test'
export class NotificationPage {
readonly page: Page
constructor (page: Page) {
this.page = page
}
async checkNotification (name: string, assignee: string): Promise<void> {
const notification = this.page.locator('div[class*="inbox-activity"] span', { hasText: name })
await expect(notification.locator('xpath=../../..').locator('a span.ap-label')).toHaveText(assignee)
}
}

View File

@ -24,6 +24,7 @@ export class IssuesPage extends CommonTrackerPage {
readonly buttonCreateIssue: Locator
readonly inputSearch: Locator
readonly linkSidebarAll: Locator
readonly linkSidebarMyIssue: Locator
constructor (page: Page) {
super(page)
@ -59,6 +60,7 @@ export class IssuesPage extends CommonTrackerPage {
this.buttonCreateIssue = page.locator('button > span', { hasText: 'Create issue' })
this.inputSearch = page.locator('input[placeholder="Search"]')
this.linkSidebarAll = page.locator('a[href$="all-issues"]')
this.linkSidebarMyIssue = page.locator('a[href$="my-issues"]')
}
async createNewIssue (data: NewIssue): Promise<void> {