diff --git a/tests/readme.md b/tests/readme.md index 2665a0403f..05de55dff8 100644 --- a/tests/readme.md +++ b/tests/readme.md @@ -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 +``` \ No newline at end of file diff --git a/tests/sanity/tests/actions.spec.ts b/tests/sanity/tests/actions.spec.ts index 45c63faaf7..8c38ce5955 100644 --- a/tests/sanity/tests/actions.spec.ts +++ b/tests/sanity/tests/actions.spec.ts @@ -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"]') diff --git a/tests/sanity/tests/channel.spec.ts b/tests/sanity/tests/channel.spec.ts index 913c4113c1..99c9f5a0cf 100644 --- a/tests/sanity/tests/channel.spec.ts +++ b/tests/sanity/tests/channel.spec.ts @@ -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() }) diff --git a/tests/sanity/tests/contact.duplicate.spec.ts b/tests/sanity/tests/contact.duplicate.spec.ts index e8cef2ecd4..6fc9e096f4 100644 --- a/tests/sanity/tests/contact.duplicate.spec.ts +++ b/tests/sanity/tests/contact.duplicate.spec.ts @@ -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"]') diff --git a/tests/sanity/tests/contacts.spec.ts b/tests/sanity/tests/contacts.spec.ts index 0689f71f3b..bd05ccc4de 100644 --- a/tests/sanity/tests/contacts.spec.ts +++ b/tests/sanity/tests/contacts.spec.ts @@ -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() diff --git a/tests/sanity/tests/hr.spec.ts b/tests/sanity/tests/hr.spec.ts index a84be73f76..a1773d9bc4 100644 --- a/tests/sanity/tests/hr.spec.ts +++ b/tests/sanity/tests/hr.spec.ts @@ -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') + // }) }) diff --git a/tests/sanity/tests/login.spec.ts b/tests/sanity/tests/login.spec.ts index 02d66e19ae..1131aff8db 100644 --- a/tests/sanity/tests/login.spec.ts +++ b/tests/sanity/tests/login.spec.ts @@ -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) diff --git a/tests/sanity/tests/org.members.spec.ts b/tests/sanity/tests/org.members.spec.ts index 5d6621d6ea..a4ef109962 100644 --- a/tests/sanity/tests/org.members.spec.ts +++ b/tests/sanity/tests/org.members.spec.ts @@ -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() }) diff --git a/tests/sanity/tests/playwright.config.ts b/tests/sanity/tests/playwright.config.ts index ece162dc5b..97b3c7e13d 100644 --- a/tests/sanity/tests/playwright.config.ts +++ b/tests/sanity/tests/playwright.config.ts @@ -18,6 +18,14 @@ const config: PlaywrightTestConfig = { expect: { timeout: 15000 }, - reporter: 'allure-playwright' + reporter: [ + [ + 'allure-playwright', + { + detail: true, + suiteTitle: true + } + ] + ] } export default config diff --git a/tests/sanity/tests/recruiting/applications.spec.ts b/tests/sanity/tests/recruiting/applications.spec.ts index 0e9f2a01a9..1580bf022b 100644 --- a/tests/sanity/tests/recruiting/applications.spec.ts +++ b/tests/sanity/tests/recruiting/applications.spec.ts @@ -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() }) diff --git a/tests/sanity/tests/recruiting/interview.spec.ts b/tests/sanity/tests/recruiting/interview.spec.ts index 5ff5f78f0d..02476633b6 100644 --- a/tests/sanity/tests/recruiting/interview.spec.ts +++ b/tests/sanity/tests/recruiting/interview.spec.ts @@ -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-")') + // }) }) diff --git a/tests/sanity/tests/recruiting/reviews.spec.ts b/tests/sanity/tests/recruiting/reviews.spec.ts index 4ca2abbbac..642aa07f85 100644 --- a/tests/sanity/tests/recruiting/reviews.spec.ts +++ b/tests/sanity/tests/recruiting/reviews.spec.ts @@ -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') diff --git a/tests/sanity/tests/recruiting/skills.spec.ts b/tests/sanity/tests/recruiting/skills.spec.ts index 20cb205808..c53abc0050 100644 --- a/tests/sanity/tests/recruiting/skills.spec.ts +++ b/tests/sanity/tests/recruiting/skills.spec.ts @@ -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}")`) + // }) }) diff --git a/tests/sanity/tests/recruiting/talents.spec.ts b/tests/sanity/tests/recruiting/talents.spec.ts index 7fa4249e98..7d42b8f2a8 100644 --- a/tests/sanity/tests/recruiting/talents.spec.ts +++ b/tests/sanity/tests/recruiting/talents.spec.ts @@ -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() }) diff --git a/tests/sanity/tests/recruiting/vacancies.spec.ts b/tests/sanity/tests/recruiting/vacancies.spec.ts index ac88fa87f5..9c24e57b36 100644 --- a/tests/sanity/tests/recruiting/vacancies.spec.ts +++ b/tests/sanity/tests/recruiting/vacancies.spec.ts @@ -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() }) diff --git a/tests/sanity/tests/settings.spec.ts b/tests/sanity/tests/settings.spec.ts index ddfb2e21c5..43a39cfa9c 100644 --- a/tests/sanity/tests/settings.spec.ts +++ b/tests/sanity/tests/settings.spec.ts @@ -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() diff --git a/tests/sanity/tests/tags.spec.ts b/tests/sanity/tests/tags.spec.ts index cec5db288e..d164571d33 100644 --- a/tests/sanity/tests/tags.spec.ts +++ b/tests/sanity/tests/tags.spec.ts @@ -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() diff --git a/tests/sanity/tests/tracker/issues.spec.ts b/tests/sanity/tests/tracker/issues.spec.ts index 8cf92146a6..48babbbe38 100644 --- a/tests/sanity/tests/tracker/issues.spec.ts +++ b/tests/sanity/tests/tracker/issues.spec.ts @@ -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() }) diff --git a/tests/sanity/tests/tracker/tracker.layout.spec.ts b/tests/sanity/tests/tracker/layout.spec.ts similarity index 98% rename from tests/sanity/tests/tracker/tracker.layout.spec.ts rename to tests/sanity/tests/tracker/layout.spec.ts index 2f39f30a2d..41b283421b 100644 --- a/tests/sanity/tests/tracker/tracker.layout.spec.ts +++ b/tests/sanity/tests/tracker/layout.spec.ts @@ -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 let issuesProps: IssueProps[] = [] test.beforeEach(async ({ page }) => { + await allure.parentSuite('Tracker tests') test.setTimeout(60000) await navigate(page) if (issuesPropsP === undefined) { diff --git a/tests/sanity/tests/tracker/tracker.loading.spec.ts b/tests/sanity/tests/tracker/loading.spec.ts similarity index 92% rename from tests/sanity/tests/tracker/tracker.loading.spec.ts rename to tests/sanity/tests/tracker/loading.spec.ts index af9fde6cc3..df7499ebdf 100644 --- a/tests/sanity/tests/tracker/tracker.loading.spec.ts +++ b/tests/sanity/tests/tracker/loading.spec.ts @@ -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() diff --git a/tests/sanity/tests/tracker/tracker.projects.spec.ts b/tests/sanity/tests/tracker/projects.spec.ts similarity index 94% rename from tests/sanity/tests/tracker/tracker.projects.spec.ts rename to tests/sanity/tests/tracker/projects.spec.ts index bbad6ea945..968535e461 100644 --- a/tests/sanity/tests/tracker/tracker.projects.spec.ts +++ b/tests/sanity/tests/tracker/projects.spec.ts @@ -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"]') diff --git a/tests/sanity/tests/tracker/tracker.spec.ts b/tests/sanity/tests/tracker/tracker.spec.ts index 5fc8b20379..127d612607 100644 --- a/tests/sanity/tests/tracker/tracker.spec.ts +++ b/tests/sanity/tests/tracker/tracker.spec.ts @@ -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 { - 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 { + 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) -}) diff --git a/tests/sanity/tests/workbench.spec.ts b/tests/sanity/tests/workbench.spec.ts index 14dc0d8955..02d1dd2e9d 100644 --- a/tests/sanity/tests/workbench.spec.ts +++ b/tests/sanity/tests/workbench.spec.ts @@ -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"]')