Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 18 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added tests/sanity-ws/000005/space-1700601525062-0.snp.gz
Binary file not shown.
Binary file not shown.
Binary file added tests/sanity-ws/000005/task-1700601525062-0.snp.gz
Binary file not shown.
Binary file not shown.
Binary file added tests/sanity-ws/000005/tx-1700601525062-0.snp.gz
Binary file not shown.
Binary file not shown.
Binary file modified tests/sanity-ws/backup.json.gz
Binary file not shown.
52 changes: 48 additions & 4 deletions tests/sanity/tests/collaborative/issues.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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 })
})
})
})
4 changes: 4 additions & 0 deletions tests/sanity/tests/model/common-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
6 changes: 5 additions & 1 deletion tests/sanity/tests/model/left-side-menu-page.ts
Original file line number Diff line number Diff line change
@@ -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"]')
}
}
14 changes: 14 additions & 0 deletions tests/sanity/tests/model/notification-page.ts
Original file line number Diff line number Diff line change
@@ -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)
}
}
2 changes: 2 additions & 0 deletions tests/sanity/tests/model/tracker/issues-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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> {
Expand Down