TESTS-71: feat(tests): updated allure parent suite (#4010)

Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko 2023-11-20 18:12:57 +03:00 committed by GitHub
parent dc94123e2a
commit db27efca58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 441 additions and 394 deletions

View File

@ -61,3 +61,10 @@ rushx dev-codegen # for local setup
## Test authoring.
Please update all navigation with using PlatformURI for CI and dev environment compatible testing.
## Generate Allure
```bash
allure generate allure-results -o allure-report --clean
allure open allure-report
```

View File

@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test'
import { PlatformSetting, PlatformURI } from './utils'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
@ -7,9 +8,10 @@ test.use({
test.describe('actions tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Actions tests')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/sanity-ws`))?.finished()
})
test('action-new-candidate', async ({ page }) => {
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')

View File

@ -3,6 +3,7 @@ import { generateId, PlatformSetting, PlatformURI } from './utils'
import { LeftSideMenuPage } from './model/left-side-menu-page'
import { ChunterPage } from './model/chunter-page'
import { ChannelPage } from './model/channel-page'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
@ -10,6 +11,7 @@ test.use({
test.describe('channel tests', () => {
test.beforeEach(async ({ page }) => {
await allure.parentSuite('Channel tests')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
})

View File

@ -1,5 +1,6 @@
import { test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from './utils'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
@ -7,9 +8,10 @@ test.use({
test.describe('duplicate-org-test', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Duplicate Org test')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
})
test('check-contact-exists', async ({ page }) => {
await page.click('[id="app-lead\\:string\\:LeadApplication"]')

View File

@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test'
import { fillSearch, generateId, PlatformSetting, PlatformURI } from './utils'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
@ -7,9 +8,10 @@ test.use({
test.describe('contact tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Contact test')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
})
test('create-contact', async ({ page }) => {
// Create a new context with the saved storage state.
await page.locator('[id="app-contact\\:string\\:Contacts"]').click()

View File

@ -1,5 +1,6 @@
import { expect, Page, test } from '@playwright/test'
import { Page, test } from '@playwright/test'
import { PlatformSetting, PlatformURI } from './utils'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
@ -16,61 +17,61 @@ export async function createDepartment (page: Page, departmentName: string): Pro
test.describe('hr tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('HR test')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
})
test.skip('test-pto-after-department-change', async ({ page }) => {
await page.locator('[id="app-hr\\:string\\:HRApplication"]').click()
await page.click('text="Structure"')
const department1 = 'dep1'
const department2 = 'dep2'
await createDepartment(page, department1)
await createDepartment(page, department2)
// Click .ml-8 > div > div > .flex-between >> nth=0
await page.locator('.flex-col > div > .flex-between >> nth=0').click()
// Click [id="hr\:string\:AddEmployee"]
await page.locator('[id="hr\\:string\\:AddEmployee"]').click()
// Click button:has-text("Appleseed John")
await page.locator('button:has-text("Appleseed John")').click()
// Click text=Schedule
await page.locator('text=Schedule').click()
// Click td:nth-child(15) > .h-full
await page.locator('td:nth-child(15) > .h-full').click()
// Click button:has-text("Vacation")
await page.locator('button:has-text("Vacation")').click()
// Click button:has-text("PTO") >> nth=0
await page.locator('button:has-text("Remote")').first().click()
// Click button:has-text("Create")
await page.locator('button:has-text("Create")').click()
await page.waitForSelector('form.antiCard', { state: 'detached' })
// Click text=Structure
await page.locator('text=Structure').click()
// Click div:nth-child(3) > div > .flex-between
await page.locator('div:nth-child(2) > .flex-between').click()
// Click [id="hr\:string\:AddEmployee"]
await page.locator('[id="hr\\:string\\:AddEmployee"]').click()
// Click button:has-text("Appleseed John")
await page.locator('button:has-text("Appleseed John")').click()
// Click button:has-text("Ok")
await page.locator('button:has-text("Ok")').click()
await page.waitForSelector('form.antiCard', { state: 'detached' })
// Click text=Schedule
await page.locator('text=Schedule').click()
await expect(page.locator('td:nth-child(15) > .h-full .request')).toHaveCSS('opacity', '0.5')
})
// test.skip('test-pto-after-department-change', async ({ page }) => {
// await page.locator('[id="app-hr\\:string\\:HRApplication"]').click()
// await page.click('text="Structure"')
// const department1 = 'dep1'
// const department2 = 'dep2'
// await createDepartment(page, department1)
// await createDepartment(page, department2)
//
// // Click .ml-8 > div > div > .flex-between >> nth=0
// await page.locator('.flex-col > div > .flex-between >> nth=0').click()
//
// // Click [id="hr\:string\:AddEmployee"]
// await page.locator('[id="hr\\:string\\:AddEmployee"]').click()
//
// // Click button:has-text("Appleseed John")
// await page.locator('button:has-text("Appleseed John")').click()
//
// // Click text=Schedule
// await page.locator('text=Schedule').click()
//
// // Click td:nth-child(15) > .h-full
// await page.locator('td:nth-child(15) > .h-full').click()
//
// // Click button:has-text("Vacation")
// await page.locator('button:has-text("Vacation")').click()
//
// // Click button:has-text("PTO") >> nth=0
// await page.locator('button:has-text("Remote")').first().click()
//
// // Click button:has-text("Create")
// await page.locator('button:has-text("Create")').click()
// await page.waitForSelector('form.antiCard', { state: 'detached' })
//
// // Click text=Structure
// await page.locator('text=Structure').click()
//
// // Click div:nth-child(3) > div > .flex-between
// await page.locator('div:nth-child(2) > .flex-between').click()
//
// // Click [id="hr\:string\:AddEmployee"]
// await page.locator('[id="hr\\:string\\:AddEmployee"]').click()
//
// // Click button:has-text("Appleseed John")
// await page.locator('button:has-text("Appleseed John")').click()
//
// // Click button:has-text("Ok")
// await page.locator('button:has-text("Ok")').click()
// await page.waitForSelector('form.antiCard', { state: 'detached' })
//
// // Click text=Schedule
// await page.locator('text=Schedule').click()
// await expect(await page.locator('td:nth-child(15) > .h-full .request')).toHaveCSS('opacity', '0.5')
// })
})

View File

@ -2,9 +2,12 @@ import { test } from '@playwright/test'
import { PlatformUser } from './utils'
import { LoginPage } from './model/login-page'
import { SelectWorkspacePage } from './model/select-workspace-page'
import { allure } from 'allure-playwright'
test.describe('login test', () => {
test('check login', async ({ page }) => {
await allure.parentSuite('Login test')
page.on('pageerror', (exception) => {
console.log('Uncaught exception:')
console.log(exception.message)

View File

@ -1,5 +1,6 @@
import { test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from './utils'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
@ -7,7 +8,7 @@ test.use({
test.describe('recruit tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Recruit test')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
})

View File

@ -18,6 +18,14 @@ const config: PlaywrightTestConfig = {
expect: {
timeout: 15000
},
reporter: 'allure-playwright'
reporter: [
[
'allure-playwright',
{
detail: true,
suiteTitle: true
}
]
]
}
export default config

View File

@ -3,6 +3,7 @@ import { generateId, PlatformSetting, PlatformURI } from '../utils'
import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page'
import { ApplicationsPage } from '../model/recruiting/applications-page'
import { ApplicationsDetailsPage } from '../model/recruiting/applications-details-page'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
@ -10,7 +11,7 @@ test.use({
test.describe('Application tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Application tests')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
})

View File

@ -1,5 +1,6 @@
import { test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils'
import { PlatformSetting, PlatformURI } from '../utils'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
@ -7,32 +8,32 @@ test.use({
test.describe('interview tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Interview tests')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
})
test.skip('create-interview', async ({ page }) => {
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
const interviewId = 'My interview ' + generateId(4)
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.click('text=Reviews')
await page.click('button:has-text("Review")')
await page.click('[placeholder="Title"]')
await page.fill('[placeholder="Title"]', `Meet Peterson ${interviewId}`)
await page.click('[placeholder="Location"]')
await page.fill('[placeholder="Location"]', 'NSK')
await page.click('form button:has-text("Talent")')
await page.click('button:has-text("P. Andrey")')
await page.click('text=Create')
await page.waitForSelector('form.antiCard', { state: 'detached' })
await page.click('td:has-text("RVE-")')
})
// test.skip('create-interview', async ({ page }) => {
// await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
//
// const interviewId = 'My interview ' + generateId(4)
//
// await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
//
// await page.click('text=Reviews')
//
// await page.click('button:has-text("Review")')
//
// await page.click('[placeholder="Title"]')
//
// await page.fill('[placeholder="Title"]', `Meet Peterson ${interviewId}`)
//
// await page.click('[placeholder="Location"]')
//
// await page.fill('[placeholder="Location"]', 'NSK')
// await page.click('form button:has-text("Talent")')
// await page.click('button:has-text("P. Andrey")')
// await page.click('text=Create')
// await page.waitForSelector('form.antiCard', { state: 'detached' })
// await page.click('td:has-text("RVE-")')
// })
})

View File

@ -1,5 +1,6 @@
import { test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
@ -7,9 +8,10 @@ test.use({
test.describe('review tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Review tests')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
})
test('create-review', async ({ page, context }) => {
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
await page.click('text=Reviews')

View File

@ -1,5 +1,6 @@
import { test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils'
import { PlatformSetting, PlatformURI } from '../utils'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
@ -7,24 +8,24 @@ test.use({
test.describe('skill tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Skill tests')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
})
test.skip('create skill', async ({ page }) => {
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
await page.click('text=Skills')
await page.click('button:has-text("Skill")')
await page.click('[placeholder="Please\\ type\\ skill\\ title"]')
const skillId = 'custom-skill-' + generateId()
await page.fill('[placeholder="Please\\ type\\ skill\\ title"]', skillId)
await page.click('button:has-text("Other")')
await page.click('button:has-text("Design")')
await page.click('button:has-text("Create")')
await page.click(`text=${skillId}`)
await page.click('[placeholder="Please\\ type\\ description\\ here"]')
await page.fill('[placeholder="Please\\ type\\ description\\ here"]', 'description-' + skillId)
await page.click('button:has-text("Save")')
await page.click(`span:has-text("description-${skillId}")`)
})
// test.skip('create skill', async ({ page }) => {
// await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
// await page.click('text=Skills')
// await page.click('button:has-text("Skill")')
// await page.click('[placeholder="Please\\ type\\ skill\\ title"]')
// const skillId = 'custom-skill-' + generateId()
// await page.fill('[placeholder="Please\\ type\\ skill\\ title"]', skillId)
// await page.click('button:has-text("Other")')
// await page.click('button:has-text("Design")')
// await page.click('button:has-text("Create")')
// await page.click(`text=${skillId}`)
// await page.click('[placeholder="Please\\ type\\ description\\ here"]')
// await page.fill('[placeholder="Please\\ type\\ description\\ here"]', 'description-' + skillId)
// await page.click('button:has-text("Save")')
// await page.click(`span:has-text("description-${skillId}")`)
// })
})

View File

@ -3,6 +3,7 @@ import { generateId, PlatformSetting, PlatformURI } from '../utils'
import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page'
import { TalentsPage } from '../model/recruiting/talents-page'
import { TalentDetailsPage } from '../model/recruiting/talent-details-page'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
@ -10,7 +11,7 @@ test.use({
test.describe('candidate/talents tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Talents tests')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
})

View File

@ -3,14 +3,15 @@ import { generateId, PlatformSetting, PlatformURI } from '../utils'
import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page'
import { VacanciesPage } from '../model/recruiting/vacancies-page'
import { VacancyDetailsPage } from '../model/recruiting/vacancy-details-page'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
})
test.describe('recruit tests', () => {
test.describe('Vacancy tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Vacancy tests')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
})

View File

@ -1,14 +1,16 @@
import { expect, test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from './utils'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
})
test.describe('contact tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Contact test')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
})
test('update-profile', async ({ page, context }) => {
// Go to http://localhost:8083/workbench/sanity-ws
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
@ -36,6 +38,7 @@ test.describe('contact tests', () => {
// Click text=Apply
await page.click('.editor-container button:nth-child(3)')
})
test('create-template', async ({ page }) => {
// Go to http://localhost:8083/workbench/sanity-ws
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()

View File

@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from './utils'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
@ -7,9 +8,10 @@ test.use({
test.describe('recruit tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Recruit test')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
})
test('create-skill-candidate-with-skill', async ({ page }) => {
// Go to http://localhost:8083/workbench/sanity-ws
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()

View File

@ -4,13 +4,15 @@ import { LeftSideMenuPage } from '../model/left-side-menu-page'
import { IssuesPage } from '../model/tracker/issues-page'
import { IssuesDetailsPage } from '../model/tracker/issues-details-page'
import { Issue, NewIssue } from '../model/tracker/types'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
})
test.describe('tracker issue tests', () => {
test.describe('Tracker issue tests', () => {
test.beforeEach(async ({ page }) => {
await allure.parentSuite('Tracker tests')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
})

View File

@ -14,7 +14,9 @@ import {
ViewletSelectors
} from './tracker.utils'
import { fillSearch, generateId, PlatformSetting } from '../utils'
import { allure } from 'allure-playwright'
import { IssuesPage } from '../model/tracker/issues-page'
test.use({
storageState: PlatformSetting
})
@ -93,6 +95,7 @@ test.describe('tracker layout tests', () => {
let issuesPropsP: Promise<IssueProps[]>
let issuesProps: IssueProps[] = []
test.beforeEach(async ({ page }) => {
await allure.parentSuite('Tracker tests')
test.setTimeout(60000)
await navigate(page)
if (issuesPropsP === undefined) {

View File

@ -1,11 +1,13 @@
import { test } from '@playwright/test'
import { IssuesPage } from '../model/tracker/issues-page'
import { PlatformSetting, PlatformURI } from '../utils'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
})
test('check-status-loading', async ({ page }) => {
await allure.parentSuite('Tracker tests')
await (
await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/tracker%3Aproject%3ADefaultProject/issues`)
)?.finished()

View File

@ -1,6 +1,7 @@
import { expect, test } from '@playwright/test'
import { navigate } from './tracker.utils'
import { generateId, PlatformSetting, PlatformURI, fillSearch } from '../utils'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
@ -8,9 +9,10 @@ test.use({
test.describe('component tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Tracker tests')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
})
test('create-component-issue', async ({ page }) => {
await page.click('[id="app-tracker\\:string\\:TrackerApplication"]')

View File

@ -12,37 +12,13 @@ import {
toTime
} from './tracker.utils'
import { PlatformSetting, fillSearch, generateId } from '../utils'
import { allure } from 'allure-playwright'
import { IssuesPage } from '../model/tracker/issues-page'
test.use({
storageState: PlatformSetting
})
// test('create-issue-and-sub-issue', async ({ page }) => {
// const props = {
// name: getIssueName(),
// description: 'description',
// labels: ['label', 'another-label'],
// status: DEFAULT_STATUSES[0],
// priority: 'Urgent',
// assignee: DEFAULT_USER
// }
// await navigate(page)
// for (const label of props.labels) {
// await createLabel(page, label)
// }
// await createIssue(page, props)
// await page.click('text="Issues"')
// await fillSearch(page, props.name)
// await openIssue(page, props.name)
// await checkIssue(page, props)
// props.name = `sub${props.name}`
// await createSubissue(page, props)
// await openIssue(page, props.name)
// await checkIssue(page, props)
// })
const getIssueName = (postfix: string = generateId(5)): string => `issue-${postfix}`
const panelStatusMap = new Map([
@ -51,93 +27,134 @@ const panelStatusMap = new Map([
['Issues/Backlog', ['Backlog']]
])
test('issues-status-display', async ({ page }) => {
const locator = page.locator('.list-container')
await navigate(page)
for (const status of DEFAULT_STATUSES) {
await createIssue(page, { name: getIssueName(status), status })
}
for (const [panel, statuses] of panelStatusMap) {
const pPage = panel.split('/')
await performPanelTest(statuses, pPage[0], pPage[1])
}
test.describe('Tracker tests', () => {
test.beforeEach(async ({ page }) => {
await allure.parentSuite('Tracker tests')
})
async function performPanelTest (statuses: string[], panel: string, mode: string): Promise<void> {
const excluded = DEFAULT_STATUSES.filter((status) => !statuses.includes(status))
await page.locator(`.antiNav-element__dropbox > a > .antiNav-element:has-text("${panel}")`).click()
await page.locator(`.ac-header .overflow-label:has-text("${mode}")`).click()
await page.click(ViewletSelectors.Table)
await expect(locator).toContainText(statuses)
if (excluded.length > 0) {
await expect(locator).not.toContainText(excluded)
test('issues-status-display', async ({ page }) => {
const locator = page.locator('.list-container')
await navigate(page)
for (const status of DEFAULT_STATUSES) {
await createIssue(page, { name: getIssueName(status), status })
}
for (const [panel, statuses] of panelStatusMap) {
const pPage = panel.split('/')
await performPanelTest(statuses, pPage[0], pPage[1])
}
await page.click(ViewletSelectors.Board)
if (excluded.length > 0) {
await expect(locator).not.toContainText(excluded)
}
for (const status of statuses) {
await expect(
page.locator('.panel-container', {
has: page.locator(`.header:has-text("${status}")`)
})
).toContainText(getIssueName(status), { timeout: 15000 })
}
}
})
async function performPanelTest (statuses: string[], panel: string, mode: string): Promise<void> {
const excluded = DEFAULT_STATUSES.filter((status) => !statuses.includes(status))
await page.locator(`.antiNav-element__dropbox > a > .antiNav-element:has-text("${panel}")`).click()
await page.locator(`.ac-header .overflow-label:has-text("${mode}")`).click()
await page.click(ViewletSelectors.Table)
await expect(locator).toContainText(statuses)
if (excluded.length > 0) {
await expect(locator).not.toContainText(excluded)
}
await page.click(ViewletSelectors.Board)
test('save-view-options', async ({ page }) => {
const panels = ['Issues', 'Active', 'Backlog']
await navigate(page)
for (const viewletSelector of [ViewletSelectors.Board, ViewletSelectors.Table]) {
for (const panel of panels) {
await page.click(`text="${panel}"`)
await page.click(viewletSelector)
await page.click('button:has-text("View")')
await page.click('.antiCard >> button >> nth=0')
await page.click('.menu-item:has-text("Assignee")')
await page.keyboard.press('Escape')
if (excluded.length > 0) {
await expect(locator).not.toContainText(excluded)
}
for (const status of statuses) {
await expect(
page.locator('.panel-container', {
has: page.locator(`.header:has-text("${status}")`)
})
).toContainText(getIssueName(status), { timeout: 15000 })
}
}
for (const panel of panels) {
await page.click(`text="${panel}"`)
await expect(page.locator(viewletSelector)).toHaveClass(/selected/)
await page.click('button:has-text("View")')
await expect(page.locator('.antiCard >> button >> nth=0')).toContainText('Assignee')
await page.keyboard.press('Escape')
})
test('save-view-options', async ({ page }) => {
const panels = ['Issues', 'Active', 'Backlog']
await navigate(page)
for (const viewletSelector of [ViewletSelectors.Board, ViewletSelectors.Table]) {
for (const panel of panels) {
await page.click(`text="${panel}"`)
await page.click(viewletSelector)
await page.click('button:has-text("View")')
await page.click('.antiCard >> button >> nth=0')
await page.click('.menu-item:has-text("Assignee")')
await page.keyboard.press('Escape')
}
for (const panel of panels) {
await page.click(`text="${panel}"`)
await expect(page.locator(viewletSelector)).toHaveClass(/selected/)
await page.click('button:has-text("View")')
await expect(page.locator('.antiCard >> button >> nth=0')).toContainText('Assignee')
await page.keyboard.press('Escape')
}
}
}
})
})
test('my-issues', async ({ page }) => {
const name = getIssueName()
await navigate(page)
await createIssue(page, { name })
await page.click('text="My issues"')
await page.click('[data-id="tab-assigned"]')
await expect(page.locator('.antiPanel-component')).not.toContainText(name)
await page.click('[data-id="tab-created"]')
await expect(page.locator('.antiPanel-component')).toContainText(name)
await page.click('[data-id="tab-subscribed"]')
await expect(page.locator('.antiPanel-component')).toContainText(name)
await openIssue(page, name)
// click "Don't track"
await page.click('button:has-text("Appleseed John") >> nth=1')
await page.click('.selectPopup >> button:has-text("Appleseed John")')
await page.waitForTimeout(100)
await page.keyboard.press('Escape')
await page.keyboard.press('Escape')
await expect(page.locator('.antiPanel-component')).not.toContainText(name)
})
test('report-time-from-issue-card', async ({ page }) => {
await navigate(page)
const assignee = 'Chen Rosamund'
const status = 'In Progress'
const values = [2, 4, 6, 8]
for (let i = 0; i < 5; i++) {
const random = Math.floor(Math.random() * values.length)
const time = values[random]
test('my-issues', async ({ page }) => {
const name = getIssueName()
await navigate(page)
await createIssue(page, { name })
await page.click('text="My issues"')
await page.click('[data-id="tab-assigned"]')
await expect(page.locator('.antiPanel-component')).not.toContainText(name)
await page.click('[data-id="tab-created"]')
await expect(page.locator('.antiPanel-component')).toContainText(name)
await page.click('[data-id="tab-subscribed"]')
await expect(page.locator('.antiPanel-component')).toContainText(name)
await openIssue(page, name)
// click "Don't track"
await page.click('button:has-text("Appleseed John") >> nth=1')
await page.click('.selectPopup >> button:has-text("Appleseed John")')
await page.waitForTimeout(100)
await page.keyboard.press('Escape')
await page.keyboard.press('Escape')
await expect(page.locator('.antiPanel-component')).not.toContainText(name)
})
test('report-time-from-issue-card', async ({ page }) => {
await navigate(page)
const assignee = 'Chen Rosamund'
const status = 'In Progress'
const values = [2, 4, 6, 8]
for (let i = 0; i < 5; i++) {
const random = Math.floor(Math.random() * values.length)
const time = values[random]
const name = getIssueName()
try {
await page.evaluate(() => {
localStorage.setItem('#platform.notification.timeout', '5000')
})
await createIssue(page, { name, assignee, status })
await page.waitForSelector(`text="${name}"`)
await page.waitForSelector('text="View issue"')
await page.click('text="View issue"')
} finally {
await page.evaluate(() => {
localStorage.setItem('#platform.notification.timeout', '0')
})
}
await page.click('#ReportedTimeEditor')
await page.waitForSelector('text="Time spent reports"')
await page.click('#ReportsPopupAddButton')
await page.waitForSelector('text="Add time report"')
await expect(page.locator('button:has-text("Create")')).toBeDisabled()
await page.fill('[placeholder="Spent time"]', `${time}`)
await expect(page.locator('button:has-text("Create")')).toBeEnabled()
await page.click('button:has-text("Create")')
await page.click('#card-close')
await expect(page.locator('#ReportedTimeEditor')).toContainText(await toTime(time))
}
})
test('report-multiple-time-from-issue-card', async ({ page }) => {
await navigate(page)
const assignee = 'Chen Rosamund'
const status = 'In Progress'
const time = 0.25
const name = getIssueName()
try {
await page.evaluate(() => {
localStorage.setItem('#platform.notification.timeout', '5000')
@ -153,190 +170,169 @@ test('report-time-from-issue-card', async ({ page }) => {
}
await page.click('#ReportedTimeEditor')
await page.waitForSelector('text="Time spent reports"')
await page.click('#ReportsPopupAddButton')
await page.waitForSelector('text="Add time report"')
await expect(page.locator('button:has-text("Create")')).toBeDisabled()
await page.fill('[placeholder="Spent time"]', `${time}`)
await expect(page.locator('button:has-text("Create")')).toBeEnabled()
await page.click('button:has-text("Create")')
await page.click('#card-close')
await expect(page.locator('#ReportedTimeEditor')).toContainText(await toTime(time))
}
})
for (let i = 0; i < 5; i++) {
await expect(page.locator('.antiCard-content >> .footer')).toContainText(`Total: ${i}`)
await page.waitForSelector('text="Time spent reports"')
await page.click('#ReportsPopupAddButton')
await page.waitForSelector('text="Add time report"')
await expect(page.locator('button:has-text("Create")')).toBeDisabled()
await page.fill('[placeholder="Spent time"]', `${time}`)
await expect(page.locator('button:has-text("Create")')).toBeEnabled()
await page.click('button:has-text("Create")')
await expect(page.locator('.antiCard-content >> .footer')).toContainText(`Total: ${i + 1}`)
}
})
test('report-multiple-time-from-issue-card', async ({ page }) => {
await navigate(page)
const assignee = 'Chen Rosamund'
const status = 'In Progress'
const time = 0.25
test('report-time-from-main-view', async ({ page }) => {
await navigate(page)
const name = getIssueName()
await page.click('text="Issues"')
await page.click('button:has-text("View")')
await page.click('.ordering >> nth=0')
await page.click('text="Modified date"')
await page.keyboard.press('Escape')
try {
await page.evaluate(() => {
localStorage.setItem('#platform.notification.timeout', '5000')
const values = [2, 4, 6, 8]
const assignee = 'Chen Rosamund'
const status = 'In Progress'
const name = getIssueName()
try {
await page.evaluate(() => {
localStorage.setItem('#platform.notification.timeout', '5000')
})
await createIssue(page, { name, assignee, status })
await page.waitForSelector(`text="${name}"`)
await page.waitForSelector('text="View issue"')
await page.click('text="View issue"')
} finally {
await page.evaluate(() => {
localStorage.setItem('#platform.notification.timeout', '0')
})
}
// await page.click('.close-button > .antiButton')
// We need to fait for indexer to complete indexing.
await fillSearch(page, name)
await page.waitForSelector(`text="${name}"`, { timeout: 15000 })
let count = 0
for (let j = 0; j < 5; j++) {
const random = Math.floor(Math.random() * values.length)
const time = values[random]
count += time
await page.click('text="Issues"')
const issuesPage = new IssuesPage(page)
await issuesPage.modelSelectorAll.click()
await page.click('button:has-text("View")')
await page.click('.ordering >> nth=0')
await page.locator('button.menu-item', { hasText: 'Modified date' }).click()
await page.keyboard.press('Escape')
await page.locator('.estimation-container').first().click()
await page.waitForSelector('text="Estimation"')
await page.click('button:has-text("Add time report")')
await page.waitForSelector('[id="tracker\\:string\\:TimeSpendReportAdd"] >> text=Add time report')
await expect(page.locator('button:has-text("Create")')).toBeDisabled()
await page.fill('[placeholder="Spent time"]', `${time}`)
await expect(page.locator('button:has-text("Create")')).toBeEnabled()
await page.click('button:has-text("Create")')
await page.click('#card-close')
await expect(page.locator('.estimation-container >> span').first()).toContainText(await toTime(count))
}
})
test('create-issue-draft', async ({ page }) => {
await navigate(page)
const issueName = 'Draft issue'
// Click text=Issues >> nth=1
await page.locator('text=Issues').nth(2).click()
await expect(page).toHaveURL(/.*\/workbench\/sanity-ws\/tracker\/tracker%3Aproject%3ADefaultProject\/issues/)
await expect(page.locator('#new-issue')).toHaveText('New issue')
// Click button:has-text("New issue")
await page.locator('#new-issue').click()
// Click [placeholder="Issue title"]
await page.locator('#issue-name').click()
// Fill [placeholder="Issue title"]
await page.locator('#issue-name >> input').fill(issueName)
await expect(page.locator('#new-issue')).toHaveText('Resume draft')
await page.locator('#issue-description').click()
await page.locator('#issue-description >> [contenteditable]').fill(issueName)
// Click button:has-text("Backlog")
await page.locator('#status-editor').click()
// Click button:has-text("Todo")
await page.locator('button:has-text("Todo")').click()
// Click button:has-text("No priority")
await page.locator('#priority-editor').click()
// Click button:has-text("Urgent")
await page.locator('button:has-text("Urgent")').click()
// Click button:has-text("Assignee")
await page.locator('#assignee-editor').click()
// Click button:has-text("Appleseed John")
await page.locator('button:has-text("Appleseed John")').click()
// Click button:has-text("0d")
await page.locator('#estimation-editor').click()
// Click [placeholder="Type text\.\.\."]
await page.locator('[placeholder="Type text\\.\\.\\."]').click()
// Fill [placeholder="Type text\.\.\."]
await page.locator('[placeholder="Type text\\.\\.\\."]').fill('1')
await page.locator('.ml-2 > .antiButton').click()
// Click button:has-text("No due date")
await page.locator('button:has-text("Due date")').click()
// Click text=24 >> nth=0
await page.locator('.date-popup-container >> text=24').first().click()
await page.keyboard.press('Escape')
await page.keyboard.press('Escape')
await page.locator('#new-issue').click()
await checkIssueDraft(page, {
name: issueName,
description: issueName,
status: 'Todo',
priority: 'Urgent',
assignee: 'Appleseed John',
estimation: '1d',
dueDate: '24'
})
await createIssue(page, { name, assignee, status })
await page.waitForSelector(`text="${name}"`)
await page.waitForSelector('text="View issue"')
await page.click('text="View issue"')
} finally {
await page.evaluate(() => {
localStorage.setItem('#platform.notification.timeout', '0')
})
}
})
await page.click('#ReportedTimeEditor')
test('sub-issue-draft', async ({ page }) => {
await navigate(page)
for (let i = 0; i < 5; i++) {
await expect(page.locator('.antiCard-content >> .footer')).toContainText(`Total: ${i}`)
await page.waitForSelector('text="Time spent reports"')
await page.click('#ReportsPopupAddButton')
await page.waitForSelector('text="Add time report"')
await expect(page.locator('button:has-text("Create")')).toBeDisabled()
await page.fill('[placeholder="Spent time"]', `${time}`)
await expect(page.locator('button:has-text("Create")')).toBeEnabled()
await page.click('button:has-text("Create")')
await expect(page.locator('.antiCard-content >> .footer')).toContainText(`Total: ${i + 1}`)
}
})
const props = {
name: getIssueName(),
description: 'description',
status: DEFAULT_STATUSES[1],
priority: 'Urgent',
assignee: DEFAULT_USER
}
await navigate(page)
await createIssue(page, props)
await page.click('text="Issues"')
test('report-time-from-main-view', async ({ page }) => {
await navigate(page)
await fillSearch(page, props.name)
await page.click('text="Issues"')
const issuesPage = new IssuesPage(page)
await issuesPage.modelSelectorAll.click()
await page.click('button:has-text("View")')
await page.click('.ordering >> nth=0')
await page.click('text="Modified date"')
await page.keyboard.press('Escape')
await openIssue(page, props.name)
await checkIssue(page, props)
props.name = `sub${props.name}`
await page.click('button:has-text("Add sub-issue")')
await fillIssueForm(page, props)
await page.keyboard.press('Escape')
await page.keyboard.press('Escape')
const values = [2, 4, 6, 8]
const assignee = 'Chen Rosamund'
const status = 'In Progress'
const name = getIssueName()
await createIssue(page, { name, assignee, status })
// await page.click('.close-button > .antiButton')
// We need to fait for indexer to complete indexing.
await fillSearch(page, name)
await page.waitForSelector(`text="${name}"`, { timeout: 15000 })
let count = 0
for (let j = 0; j < 5; j++) {
const random = Math.floor(Math.random() * values.length)
const time = values[random]
count += time
await page.locator('.estimation-container').first().click()
await page.waitForSelector('text="Estimation"')
await page.click('button:has-text("Add time report")')
await page.waitForSelector('[id="tracker\\:string\\:TimeSpendReportAdd"] >> text=Add time report')
await expect(page.locator('button:has-text("Create")')).toBeDisabled()
await page.fill('[placeholder="Spent time"]', `${time}`)
await expect(page.locator('button:has-text("Create")')).toBeEnabled()
await page.click('button:has-text("Create")')
await page.click('#card-close')
await expect(page.locator('.estimation-container >> span').first()).toContainText(await toTime(count))
}
})
test('create-issue-draft', async ({ page }) => {
await navigate(page)
const issueName = 'Draft issue'
// Click text=Issues >> nth=1
await page.locator('text=Issues').nth(2).click()
await expect(page).toHaveURL(/.*\/workbench\/sanity-ws\/tracker\/tracker%3Aproject%3ADefaultProject\/issues/)
await expect(page.locator('#new-issue')).toHaveText('New issue')
// Click button:has-text("New issue")
await page.locator('#new-issue').click()
// Click [placeholder="Issue title"]
await page.locator('#issue-name').click()
// Fill [placeholder="Issue title"]
await page.locator('#issue-name >> input').fill(issueName)
await expect(page.locator('#new-issue')).toHaveText('Resume draft')
await page.locator('#issue-description').click()
await page.locator('#issue-description >> [contenteditable]').fill(issueName)
// Click button:has-text("Backlog")
await page.locator('#status-editor').click()
// Click button:has-text("Todo")
await page.locator('button:has-text("Todo")').click()
// Click button:has-text("No priority")
await page.locator('#priority-editor').click()
// Click button:has-text("Urgent")
await page.locator('button:has-text("Urgent")').click()
// Click button:has-text("Assignee")
await page.locator('#assignee-editor').click()
// Click button:has-text("Appleseed John")
await page.locator('button:has-text("Appleseed John")').click()
// Click button:has-text("0d")
await page.locator('#estimation-editor').click()
// Click [placeholder="Type text\.\.\."]
await page.locator('[placeholder="Type text\\.\\.\\."]').click()
// Fill [placeholder="Type text\.\.\."]
await page.locator('[placeholder="Type text\\.\\.\\."]').fill('1')
await page.locator('.ml-2 > .antiButton').click()
// Click button:has-text("No due date")
await page.locator('button:has-text("Due date")').click()
// Click text=24 >> nth=0
await page.locator('.date-popup-container >> text=24').first().click()
await page.keyboard.press('Escape')
await page.keyboard.press('Escape')
await page.locator('#new-issue').click()
await checkIssueDraft(page, {
name: issueName,
description: issueName,
status: 'Todo',
priority: 'Urgent',
assignee: 'Appleseed John',
estimation: '1d',
dueDate: '24'
await page.locator('#new-issue').click()
await checkIssueDraft(page, props)
})
})
test('sub-issue-draft', async ({ page }) => {
await navigate(page)
const props = {
name: getIssueName(),
description: 'description',
status: DEFAULT_STATUSES[1],
priority: 'Urgent',
assignee: DEFAULT_USER
}
await navigate(page)
await createIssue(page, props)
await page.click('text="Issues"')
const issuesPage = new IssuesPage(page)
await issuesPage.modelSelectorAll.click()
await fillSearch(page, props.name)
await openIssue(page, props.name)
await checkIssue(page, props)
props.name = `sub${props.name}`
await page.click('button:has-text("Add sub-issue")')
await fillIssueForm(page, props)
await page.keyboard.press('Escape')
await page.keyboard.press('Escape')
await page.locator('#new-issue').click()
await checkIssueDraft(page, props)
})

View File

@ -1,14 +1,16 @@
import { expect, test } from '@playwright/test'
import { PlatformSetting, PlatformURI } from './utils'
import { allure } from 'allure-playwright'
test.use({
storageState: PlatformSetting
})
test.describe('workbench tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await allure.parentSuite('Workbench test')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
})
test('navigator', async ({ page }) => {
// Click [id="app-recruit\:string\:RecruitApplication"]
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')