diff --git a/tests/sanity/tests/channel.spec.ts b/tests/sanity/tests/channel.spec.ts index cf52d243f6..cc1a25c996 100644 --- a/tests/sanity/tests/channel.spec.ts +++ b/tests/sanity/tests/channel.spec.ts @@ -20,7 +20,7 @@ test.describe('channel tests', () => { }) test('create new private channel tests', async () => { - await leftSideMenuPage.buttonChunter.click() + await leftSideMenuPage.clickChunter() await chunterPage.clickChannelBrowser() await chunterPage.clickNewChannelHeader() const channel = 'channel-' + generateId() diff --git a/tests/sanity/tests/collaborative/applications.spec.ts b/tests/sanity/tests/collaborative/applications.spec.ts index 3f5241809e..9dc092ede2 100644 --- a/tests/sanity/tests/collaborative/applications.spec.ts +++ b/tests/sanity/tests/collaborative/applications.spec.ts @@ -43,8 +43,8 @@ test.describe('Collaborative tests for Application', () => { await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage) - await leftSideMenuPageSecond.checkExistNewNotification(userSecondPage) - await leftSideMenuPageSecond.buttonNotification.click() + await leftSideMenuPageSecond.checkExistNewNotification() + await leftSideMenuPageSecond.clickNotification() // TODO: rewrite checkNotificationCollaborators and uncomment // const notificationPageSecond = new NotificationPage(userSecondPage) @@ -68,8 +68,8 @@ test.describe('Collaborative tests for Application', () => { await test.step('User1. Check notification and check comment from user1', async () => { const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.checkExistNewNotification(page) - await leftSideMenuPage.buttonNotification.click() + await leftSideMenuPage.checkExistNewNotification() + await leftSideMenuPage.clickNotification() // TODO: rewrite checkNotificationCollaborators and uncomment // const notificationPage = new NotificationPage(page) diff --git a/tests/sanity/tests/collaborative/issues.spec.ts b/tests/sanity/tests/collaborative/issues.spec.ts index 559c031463..4d0829f963 100644 --- a/tests/sanity/tests/collaborative/issues.spec.ts +++ b/tests/sanity/tests/collaborative/issues.spec.ts @@ -38,7 +38,7 @@ test.describe('Collaborative test for issue', () => { // create a new issue by first user await (await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.createNewIssue(newIssue) @@ -153,7 +153,7 @@ test.describe('Collaborative test for issue', () => { // const notificationPageSecond = new NotificationPage(userSecondPage) // await notificationPageSecond.checkNotificationIssue(issue.title, newAssignee) // - // await leftSideMenuPageSecond.buttonTracker.click() + // await leftSideMenuPageSecond.clickTracker() // }) await test.step('user2. check issue assignee', async () => { diff --git a/tests/sanity/tests/documents/documents-link.spec.ts b/tests/sanity/tests/documents/documents-link.spec.ts index 5365baac55..40c06b8835 100644 --- a/tests/sanity/tests/documents/documents-link.spec.ts +++ b/tests/sanity/tests/documents/documents-link.spec.ts @@ -19,7 +19,7 @@ test.describe('Documents link tests', () => { await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonDocuments.click() + await leftSideMenuPage.clickDocuments() const documentsPage = new DocumentsPage(page) await documentsPage.clickOnButtonCreateDocument() @@ -31,7 +31,7 @@ test.describe('Documents link tests', () => { await documentContentPage.executeMoreAction('Public link') // remove after UBERF-5994 fixed - await documentContentPage.closePopup(page) + await documentContentPage.closePopup() await page.reload({ waitUntil: 'commit' }) await documentContentPage.executeMoreAction('Public link') diff --git a/tests/sanity/tests/documents/documents.spec.ts b/tests/sanity/tests/documents/documents.spec.ts index 3418a47185..fcd292e917 100644 --- a/tests/sanity/tests/documents/documents.spec.ts +++ b/tests/sanity/tests/documents/documents.spec.ts @@ -21,7 +21,7 @@ test.describe('Documents tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonDocuments.click() + await leftSideMenuPage.clickDocuments() const documentsPage = new DocumentsPage(page) await documentsPage.clickOnButtonCreateDocument() @@ -43,7 +43,7 @@ test.describe('Documents tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonDocuments.click() + await leftSideMenuPage.clickDocuments() const documentsPage = new DocumentsPage(page) await documentsPage.clickOnButtonCreateDocument() @@ -77,7 +77,7 @@ test.describe('Documents tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonDocuments.click() + await leftSideMenuPage.clickDocuments() const documentsPage = new DocumentsPage(page) await documentsPage.checkTeamspaceNotExist(moveTeamspace.title) @@ -112,7 +112,7 @@ test.describe('Documents tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonDocuments.click() + await leftSideMenuPage.clickDocuments() const documentsPage = new DocumentsPage(page) await documentsPage.openTeamspace(colDocument.space) @@ -135,7 +135,7 @@ test.describe('Documents tests', () => { await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage) - await leftSideMenuPageSecond.buttonDocuments.click() + await leftSideMenuPageSecond.clickDocuments() const documentsPageSecond = new DocumentsPage(userSecondPage) await documentsPageSecond.openTeamspace(colDocument.space) @@ -168,7 +168,7 @@ test.describe('Documents tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonDocuments.click() + await leftSideMenuPage.clickDocuments() const documentsPage = new DocumentsPage(page) await documentsPage.clickOnButtonCreateDocument() diff --git a/tests/sanity/tests/documents/teamspace.spec.ts b/tests/sanity/tests/documents/teamspace.spec.ts index 1a8de790f2..598e2e9141 100644 --- a/tests/sanity/tests/documents/teamspace.spec.ts +++ b/tests/sanity/tests/documents/teamspace.spec.ts @@ -21,7 +21,7 @@ test.describe('Teamspace tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonDocuments.click() + await leftSideMenuPage.clickDocuments() const documentsPage = new DocumentsPage(page) await documentsPage.checkTeamspaceNotExist(newTeamspace.title) @@ -35,7 +35,7 @@ test.describe('Teamspace tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonDocuments.click() + await leftSideMenuPage.clickDocuments() const documentsPage = new DocumentsPage(page) await documentsPage.checkTeamspaceExist(archiveTeamspace.title) @@ -59,7 +59,7 @@ test.describe('Teamspace tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonDocuments.click() + await leftSideMenuPage.clickDocuments() const documentsPage = new DocumentsPage(page) await documentsPage.checkTeamspaceNotExist(editTeamspace.title) diff --git a/tests/sanity/tests/indexer.spec.ts b/tests/sanity/tests/indexer.spec.ts index 92c46da405..65ad6abf41 100644 --- a/tests/sanity/tests/indexer.spec.ts +++ b/tests/sanity/tests/indexer.spec.ts @@ -27,7 +27,7 @@ test.describe('Fulltext index', () => { test.describe('Documents', () => { test.beforeEach(async ({ page }) => { const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonDocuments.click() + await leftSideMenuPage.clickDocuments() }) test('Search created document', async ({ page }) => { @@ -60,7 +60,7 @@ test.describe('Fulltext index', () => { await test.step('close document', async () => { // Go to inbox to close the document and trigger indexation - await leftSideMenuPage.buttonNotification.click() + await leftSideMenuPage.clickNotification() }) await test.step('search by title', async () => { @@ -124,7 +124,7 @@ test.describe('Fulltext index', () => { await test.step('close document', async () => { // Go to inbox to close the document and trigger indexation - await leftSideMenuPage.buttonNotification.click() + await leftSideMenuPage.clickNotification() }) await test.step('search by old title', async () => { @@ -196,7 +196,7 @@ test.describe('Fulltext index', () => { await documentContentPage.executeMoreAction('Delete') await documentContentPage.pressYesForPopup(page) // Go to inbox to close the document and trigger indexation - await leftSideMenuPage.buttonNotification.click() + await leftSideMenuPage.clickNotification() }) await test.step('search by title', async () => { @@ -213,7 +213,7 @@ test.describe('Fulltext index', () => { test.describe('Issues', () => { test.beforeEach(async ({ page }) => { const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() }) test('Search created issue', async ({ page }) => { @@ -388,7 +388,7 @@ test.describe('Fulltext index', () => { const spotlight = new SpotlightPopup(page) await test.step('create issue', async () => { - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() await issuesPage.createNewIssue(newIssue) }) @@ -411,14 +411,14 @@ test.describe('Fulltext index', () => { const newWorkspaceName = `New Workspace Name - ${generateId(2)}` await loginPage.goto() - await loginPage.linkSignUp.click() + await loginPage.clickSignUp() await signUpPage.signUp(newUser) await selectWorkspacePage.createWorkspace(newWorkspaceName) }) await test.step('search by title', async () => { - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() await expect(async () => { await spotlight.open() await spotlight.fillSearchInput(titleId) diff --git a/tests/sanity/tests/model/calendar-page.ts b/tests/sanity/tests/model/calendar-page.ts index 316965a64d..bdb0fd3de3 100644 --- a/tests/sanity/tests/model/calendar-page.ts +++ b/tests/sanity/tests/model/calendar-page.ts @@ -3,56 +3,65 @@ import { CommonPage } from './common-page' export class CalendarPage extends CommonPage { readonly page: Page - readonly buttonDatePopupToday: Locator - readonly inputTargetDateDay: Locator - readonly inputTargetDateMonth: Locator - readonly inputTargetDateYear: Locator - readonly buttonTargetDateSave: Locator - readonly inputPopupDateDay: Locator - readonly inputPopupDateMonth: Locator - readonly inputPopupDateYear: Locator - readonly inputPopupTime: Locator - readonly inputPopupDateSave: Locator constructor (page: Page) { - super() + super(page) this.page = page - this.buttonDatePopupToday = page.locator('div.popup div.today:not(.wrongMonth)') - this.inputTargetDateDay = page.locator('div.date-popup-container div.datetime-input span.digit:nth-child(1)') - this.inputTargetDateMonth = page.locator('div.date-popup-container div.datetime-input span.digit:nth-child(3)') - this.inputTargetDateYear = page.locator('div.date-popup-container div.datetime-input span.digit:nth-child(5)') - this.buttonTargetDateSave = page.locator('div.date-popup-container div.footer button') - this.inputPopupDateDay = page.locator('div[class*="date-popup"] div.datetime-input span.digit:first-child') - this.inputPopupDateMonth = page.locator('div[class*="date-popup"] div.datetime-input span.digit:nth-child(3)') - this.inputPopupDateYear = page.locator('div[class*="date-popup"] div.datetime-input span.digit:nth-child(5)') - this.inputPopupTime = page.locator('div[class*="date-popup"] div.datetime-input span.digit:nth-child(7)') - this.inputPopupDateSave = page.locator('div[class*="date-popup"] div.footer button') + } + + buttonDatePopupToday = (): Locator => this.page.locator('div.popup div.today:not(.wrongMonth)') + inputTargetDateDay = (): Locator => + this.page.locator('div.date-popup-container div.datetime-input span.digit:nth-child(1)') + + inputTargetDateMonth = (): Locator => + this.page.locator('div.date-popup-container div.datetime-input span.digit:nth-child(3)') + + inputTargetDateYear = (): Locator => + this.page.locator('div.date-popup-container div.datetime-input span.digit:nth-child(5)') + + buttonTargetDateSave = (): Locator => this.page.locator('div.date-popup-container div.footer button') + inputPopupDateDay = (): Locator => + this.page.locator('div[class*="date-popup"] div.datetime-input span.digit:first-child') + + inputPopupDateMonth = (): Locator => + this.page.locator('div[class*="date-popup"] div.datetime-input span.digit:nth-child(3)') + + inputPopupDateYear = (): Locator => + this.page.locator('div[class*="date-popup"] div.datetime-input span.digit:nth-child(5)') + + inputPopupTime = (): Locator => + this.page.locator('div[class*="date-popup"] div.datetime-input span.digit:nth-child(7)') + + inputPopupDateSave = (): Locator => this.page.locator('div[class*="date-popup"] div.footer button') + buttonInDays = (inDays: string): Locator => + this.page.locator('div.popup div.shift-container div.btn span', { hasText: inDays }) + + async clickButtonDatePopupToday (): Promise { + await this.buttonDatePopupToday().click() } async fillDatePopup (day: string, month: string, year: string): Promise { - await expect(this.inputTargetDateDay).toBeVisible() - await this.inputTargetDateDay.pressSequentially(day) - await this.inputTargetDateMonth.pressSequentially(month) - await this.inputTargetDateYear.pressSequentially(year) - await this.buttonTargetDateSave.click() + await expect(this.inputTargetDateDay()).toBeVisible() + await this.inputTargetDateDay().pressSequentially(day) + await this.inputTargetDateMonth().pressSequentially(month) + await this.inputTargetDateYear().pressSequentially(year) + await this.buttonTargetDateSave().click() } async fillDatePopupInDays (inDays: string): Promise { - await expect(this.inputTargetDateDay).toBeVisible() - await this.page.locator('div.popup div.shift-container div.btn span', { hasText: inDays }).click() + await expect(this.inputTargetDateDay()).toBeVisible() + await this.buttonInDays(inDays).click() } async fillSelectDatePopup (day: string, month: string, year: string, time: string): Promise { - await this.inputPopupDateDay.click() - await this.inputPopupDateDay.pressSequentially(day) - await this.inputPopupDateMonth.click() - await this.inputPopupDateMonth.pressSequentially(month) - await this.inputPopupDateYear.click() - await this.inputPopupDateYear.pressSequentially(year) - - await this.inputPopupTime.click() - await this.inputPopupTime.pressSequentially(time) - - await this.inputPopupDateSave.click() + await this.inputPopupDateDay().click() + await this.inputPopupDateDay().pressSequentially(day) + await this.inputPopupDateMonth().click() + await this.inputPopupDateMonth().pressSequentially(month) + await this.inputPopupDateYear().click() + await this.inputPopupDateYear().pressSequentially(year) + await this.inputPopupTime().click() + await this.inputPopupTime().pressSequentially(time) + await this.inputPopupDateSave().click() } } diff --git a/tests/sanity/tests/model/common-page.ts b/tests/sanity/tests/model/common-page.ts index 3ffdb7f578..fd5cbe1bdf 100644 --- a/tests/sanity/tests/model/common-page.ts +++ b/tests/sanity/tests/model/common-page.ts @@ -1,119 +1,162 @@ -import { Page, expect } from '@playwright/test' +import { type Locator, type Page, expect } from '@playwright/test' export class CommonPage { + readonly page: Page + + constructor (page: Page) { + this.page = page + } + + selectPopupInput = (): Locator => this.page.locator('div.selectPopup input') + selectPopupInputSearch = (): Locator => this.page.locator('div.popup input.search') + selectPopupListItem = (name: string): Locator => this.page.locator('div.selectPopup div.list-item', { hasText: name }) + selectPopupListItemFirst = (): Locator => this.page.locator('div.selectPopup div.list-item') + selectPopupHeaderButtonLast = (): Locator => this.page.locator('div.selectPopup div.header button:last-child') + selectPopupButton = (): Locator => this.page.locator('div.selectPopup button') + selectPopupHeaderButtonFirst = (): Locator => this.page.locator('div.selectPopup div.header button:nth-of-type(1)') + popupSpanLabel = (point: string): Locator => + this.page.locator('div[class$="opup"] span[class*="label"]', { hasText: point }) + + selectPopupSpanLines = (item: string): Locator => + this.page.locator('div.selectPopup span[class^="lines"]', { hasText: item }) + + popupButtonChannelOk = (): Locator => this.page.locator('div.popup button#channel-ok') + viewStringDeleteObjectButtonPrimary = (): Locator => + this.page.locator('form[id="view:string:DeleteObject"] button.primary') + + tagsStringAddTagForm = (field: string): Locator => + this.page.locator(`div.popup form[id="tags:string:AddTag"] input[placeholder$="${field}"]`) + + tagsStringAddTagButtonSubmit = (): Locator => + this.page.locator('div.popup form[id="tags:string:AddTag"] button[type="submit"]') + + notifyContainerButton = (): Locator => this.page.locator('div.notify-container button[type="button"].small').nth(0) + errorSpan = (): Locator => this.page.locator('div.ERROR span') + infoSpan = (): Locator => this.page.locator('div.INFO span') + popupSubmitButton = (): Locator => this.page.locator('div.popup button[type="submit"]') + historyBoxButtonFirst = (): Locator => this.page.locator('div.history-box button:first-child') + inboxNotyButton = (): Locator => this.page.locator('button[id$="Inbox"] > div.noty') + mentionPopupListItem = (mentionName: string): Locator => + this.page.locator('form.mentionPoup div.list-item span.name', { hasText: mentionName }) + + hulyPopupRowButton = (name: string): Locator => + this.page.locator('div.hulyPopup-container button.hulyPopup-row', { hasText: name }) + + cardCloseButton = (): Locator => this.page.locator('div.popup button[id="card-close"]') + menuPopupItemButton = (itemText: string): Locator => + this.page.locator('div.selectPopup button.menu-item', { hasText: itemText }) + async selectMenuItem (page: Page, name: string, fullWordFilter: boolean = false): Promise { if (name !== 'first') { const filterText = fullWordFilter ? name : name.split(' ')[0] - await page.locator('div.selectPopup input').fill(filterText) + await this.selectPopupInput().fill(filterText) // TODO need to remove after fixed UBERF-4968 await page.waitForTimeout(300) } - await page.locator('div.selectPopup div.list-item:first-child').click() + await this.selectPopupListItemFirst().first().click() } async pressCreateButtonSelectPopup (page: Page): Promise { - await page.locator('div.selectPopup div.header button:last-child').click() + await this.selectPopupHeaderButtonLast().click() } async pressShowAllButtonSelectPopup (page: Page): Promise { - await page.locator('div.selectPopup div.header button:nth-of-type(1)').click() + await this.selectPopupHeaderButtonFirst().click() } async selectFromDropdown (page: Page, point: string): Promise { - await page.locator('div[class$="opup"] span[class*="label"]', { hasText: point }).click() + await this.popupSpanLabel(point).click() } async checkDropdownHasNo (page: Page, item: string): Promise { - await expect(page.locator('div.selectPopup span[class^="lines"]', { hasText: item })).not.toBeVisible() + await expect(this.selectPopupSpanLines(item)).not.toBeVisible() } async fillToDropdown (page: Page, input: string): Promise { - await page.locator('div.popup input.search').fill(input) - await page.locator('div.popup button#channel-ok').click() + await this.selectPopupInputSearch().fill(input) + await this.popupButtonChannelOk().click() } async fillToSelectPopup (page: Page, input: string): Promise { - await expect(page.locator('div.selectPopup input')).toBeVisible() - await page.locator('div.selectPopup input').fill(input) - await page.locator('div.selectPopup button').click() + await expect(this.selectPopupInput()).toBeVisible() + await this.selectPopupInput().fill(input) + await this.selectPopupButton().click() } async checkFromDropdown (page: Page, point: string): Promise { - await page.locator('div.selectPopup span[class^="lines"]', { hasText: point }).first().click() + await this.selectPopupSpanLines(point).first().click() } async pressYesDeletePopup (page: Page): Promise { - await page.locator('form[id="view:string:DeleteObject"] button.primary').click() + await this.viewStringDeleteObjectButtonPrimary().click() } async addNewTagPopup (page: Page, title: string, description: string): Promise { - await page.locator('div.popup form[id="tags:string:AddTag"] input[placeholder$="title"]').fill(title) - await page - .locator('div.popup form[id="tags:string:AddTag"] input[placeholder="Please type description here"]') - .fill(description) - await page.locator('div.popup form[id="tags:string:AddTag"] button[type="submit"]').click() - await page.locator('div.popup form[id="tags:string:AddTag"]').waitFor({ state: 'hidden' }) + await this.tagsStringAddTagForm('title').fill(title) + await this.tagsStringAddTagForm('Please type description here').fill(description) + await this.tagsStringAddTagButtonSubmit().click() + await this.tagsStringAddTagButtonSubmit().waitFor({ state: 'hidden' }) } async selectAssignee (page: Page, name: string): Promise { if (name !== 'first') { - await page.locator('div.selectPopup input').fill(name.split(' ')[0]) - await expect(page.locator('div.selectPopup div.list-item')).toHaveCount(1) + await this.selectPopupInput().fill(name.split(' ')[0]) + await expect(this.selectPopupListItemFirst()).toHaveCount(1) } - await page.locator('div.selectPopup div.list-item').click() + await this.selectPopupListItemFirst().first().click() } - async checkExistNewNotification (page: Page): Promise { - await expect(page.locator('button[id$="Inbox"] > div.noty')).toBeVisible() + async checkExistNewNotification (): Promise { + await expect(this.inboxNotyButton()).toBeVisible() } async pressYesForPopup (page: Page): Promise { - await expect(page.locator('div.popup button[type="submit"]')).toBeVisible() - await page.locator('div.popup button[type="submit"]').click() + await expect(this.popupSubmitButton()).toBeVisible() + await this.popupSubmitButton().click() } async pressButtonBack (page: Page): Promise { - await page.locator('div.history-box button:first-child').click() + await this.historyBoxButtonFirst().click() } async checkFromDropdownWithSearch (page: Page, point: string): Promise { - await page.locator('div.selectPopup input').fill(point) - await page.locator('div.selectPopup span[class^="lines"]', { hasText: point }).click() + await this.selectPopupInput().fill(point) + await this.selectPopupSpanLines(point).click() } async closeNotification (page: Page): Promise { - await page.locator('div.notify-container button[type="button"].small').nth(0).click() + await this.notifyContainerButton().click() } async checkError (page: Page, errorMessage: string): Promise { - await expect(page.locator('div.ERROR span')).toHaveText(errorMessage) + await expect(this.errorSpan()).toHaveText(errorMessage) } async checkInfo (page: Page, errorMessage: string): Promise { - await expect(page.locator('div.INFO span')).toHaveText(errorMessage) + await expect(this.infoSpan()).toHaveText(errorMessage) } async checkInfoSectionNotExist (page: Page): Promise { - await expect(page.locator('div.INFO span')).not.toBeAttached() + await expect(this.infoSpan()).not.toBeAttached() } - async selectMention (page: Page, mentionName: string): Promise { - await page.locator('form.mentionPoup div.list-item span.name', { hasText: mentionName }).click() + async selectMention (mentionName: string): Promise { + await this.mentionPopupListItem(mentionName).click() } - async selectListItem (page: Page, name: string): Promise { - await page.locator('div.selectPopup div.list-item', { hasText: name }).click({ delay: 100 }) + async selectListItem (name: string): Promise { + await this.selectPopupListItem(name).click({ delay: 100 }) } - async selectPopupItem (page: Page, name: string): Promise { - await page.locator('div.hulyPopup-container button.hulyPopup-row', { hasText: name }).click({ delay: 100 }) + async selectPopupItem (name: string): Promise { + await this.hulyPopupRowButton(name).click({ delay: 100 }) } - async closePopup (page: Page): Promise { - await page.locator('div.popup button[id="card-close"]').click() + async closePopup (): Promise { + await this.cardCloseButton().click() } - async checkPopupItem (page: Page, itemText: string): Promise { - await expect(page.locator('div.selectPopup button.menu-item', { hasText: itemText })).toBeVisible() + async checkPopupItem (itemText: string): Promise { + await expect(this.menuPopupItemButton(itemText)).toBeVisible() } } diff --git a/tests/sanity/tests/model/contacts/employee-details-page.ts b/tests/sanity/tests/model/contacts/employee-details-page.ts index 163806cf85..c0b8dad7f6 100644 --- a/tests/sanity/tests/model/contacts/employee-details-page.ts +++ b/tests/sanity/tests/model/contacts/employee-details-page.ts @@ -6,7 +6,7 @@ export class EmployeeDetailsPage extends CommonPage { readonly page: Page constructor (page: Page) { - super() + super(page) this.page = page } diff --git a/tests/sanity/tests/model/contacts/employees-page.ts b/tests/sanity/tests/model/contacts/employees-page.ts index 8ba7a4342b..3b76de05a2 100644 --- a/tests/sanity/tests/model/contacts/employees-page.ts +++ b/tests/sanity/tests/model/contacts/employees-page.ts @@ -5,7 +5,7 @@ export class EmployeesPage extends CommonPage { readonly page: Page constructor (page: Page) { - super() + super(page) this.page = page } diff --git a/tests/sanity/tests/model/documents/document-content-page.ts b/tests/sanity/tests/model/documents/document-content-page.ts index 1d93514161..93f4dda03e 100644 --- a/tests/sanity/tests/model/documents/document-content-page.ts +++ b/tests/sanity/tests/model/documents/document-content-page.ts @@ -5,7 +5,7 @@ export class DocumentContentPage extends CommonPage { readonly page: Page constructor (page: Page) { - super() + super(page) this.page = page } diff --git a/tests/sanity/tests/model/documents/document-create-popup.ts b/tests/sanity/tests/model/documents/document-create-popup.ts index e1655f9a11..59bad07634 100644 --- a/tests/sanity/tests/model/documents/document-create-popup.ts +++ b/tests/sanity/tests/model/documents/document-create-popup.ts @@ -6,7 +6,7 @@ export class DocumentCreatePopup extends CommonPage { readonly page: Page constructor (page: Page) { - super() + super(page) this.page = page } diff --git a/tests/sanity/tests/model/documents/document-move-popup.ts b/tests/sanity/tests/model/documents/document-move-popup.ts index 152c3a0ff9..2b609d5328 100644 --- a/tests/sanity/tests/model/documents/document-move-popup.ts +++ b/tests/sanity/tests/model/documents/document-move-popup.ts @@ -5,7 +5,7 @@ export class DocumentMovePopup extends CommonPage { readonly page: Page constructor (page: Page) { - super() + super(page) this.page = page } diff --git a/tests/sanity/tests/model/documents/documents-page.ts b/tests/sanity/tests/model/documents/documents-page.ts index de213160cb..105f09b98a 100644 --- a/tests/sanity/tests/model/documents/documents-page.ts +++ b/tests/sanity/tests/model/documents/documents-page.ts @@ -8,7 +8,7 @@ export class DocumentsPage extends CommonPage { readonly page: Page constructor (page: Page) { - super() + super(page) this.page = page this.popupCreateDocument = new DocumentCreatePopup(page) this.popupMoveDocument = new DocumentMovePopup(page) diff --git a/tests/sanity/tests/model/left-side-menu-page.ts b/tests/sanity/tests/model/left-side-menu-page.ts index d8878fad82..c58ebf5258 100644 --- a/tests/sanity/tests/model/left-side-menu-page.ts +++ b/tests/sanity/tests/model/left-side-menu-page.ts @@ -3,19 +3,35 @@ import { CommonPage } from './common-page' export class LeftSideMenuPage extends CommonPage { readonly page: Page - readonly buttonChunter: Locator - readonly buttonContacts: Locator - readonly buttonTracker: Locator - readonly buttonNotification: Locator - readonly buttonDocuments: Locator constructor (page: Page) { - super() + super(page) 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"]') - this.buttonDocuments = page.locator('button[id$="DocumentApplication"]') + } + + buttonChunter = (): Locator => this.page.locator('button[id$="ApplicationLabelChunter"]') + buttonContacts = (): Locator => this.page.locator('button[id$="Contacts"]') + buttonTracker = (): Locator => this.page.locator('button[id$="TrackerApplication"]') + buttonNotification = (): Locator => this.page.locator('button[id$="Inbox"]') + buttonDocuments = (): Locator => this.page.locator('button[id$="DocumentApplication"]') + + async clickChunter (): Promise { + await this.buttonChunter().click() + } + + async clickContacts (): Promise { + await this.buttonContacts().click() + } + + async clickTracker (): Promise { + await this.buttonTracker().click() + } + + async clickNotification (): Promise { + await this.buttonNotification().click() + } + + async clickDocuments (): Promise { + await this.buttonDocuments().click() } } diff --git a/tests/sanity/tests/model/login-page.ts b/tests/sanity/tests/model/login-page.ts index 35503c9d83..fe0457773b 100644 --- a/tests/sanity/tests/model/login-page.ts +++ b/tests/sanity/tests/model/login-page.ts @@ -3,27 +3,28 @@ import { PlatformURI } from '../utils' export class LoginPage { readonly page: Page - readonly inputEmail: Locator - readonly inputPassword: Locator - readonly buttonLogin: Locator - readonly linkSignUp: Locator constructor (page: Page) { this.page = page - this.inputEmail = page.locator('input[name=email]') - this.inputPassword = page.locator('input[name=current-password]') - this.buttonLogin = page.locator('button', { hasText: 'Log In' }) - this.linkSignUp = page.locator('a.title', { hasText: 'Sign Up' }) } + inputEmail = (): Locator => this.page.locator('input[name=email]') + inputPassword = (): Locator => this.page.locator('input[name=current-password]') + buttonLogin = (): Locator => this.page.locator('button', { hasText: 'Log In' }) + linkSignUp = (): Locator => this.page.locator('a.title', { hasText: 'Sign Up' }) + async goto (): Promise { await (await this.page.goto(`${PlatformURI}/login/login`))?.finished() } + async clickSignUp (): Promise { + await this.linkSignUp().click() + } + async login (email: string, password: string): Promise { - await this.inputEmail.fill(email) - await this.inputPassword.fill(password) - expect(await this.buttonLogin.isEnabled()).toBe(true) - await this.buttonLogin.click() + await this.inputEmail().fill(email) + await this.inputPassword().fill(password) + expect(await this.buttonLogin().isEnabled()).toBe(true) + await this.buttonLogin().click() } } diff --git a/tests/sanity/tests/model/notification-page.ts b/tests/sanity/tests/model/notification-page.ts index f84c74e05c..793d9130ab 100644 --- a/tests/sanity/tests/model/notification-page.ts +++ b/tests/sanity/tests/model/notification-page.ts @@ -1,4 +1,4 @@ -import { expect, type Page } from '@playwright/test' +import { expect, type Page, Locator } from '@playwright/test' export class NotificationPage { readonly page: Page @@ -7,15 +7,16 @@ export class NotificationPage { this.page = page } - // TODO: rewrite functions according to new inbox + notificationLocator = (name: string): Locator => + this.page.locator('div[class*="inbox-activity"] span', { hasText: name }) async checkNotificationIssue (name: string, assignee: string): Promise { - const notification = this.page.locator('div[class*="inbox-activity"] span', { hasText: name }) + const notification = this.notificationLocator(name) await expect(notification.locator('xpath=../../..').locator('a span.ap-label')).toHaveText(assignee) } async checkNotificationCollaborators (name: string, text: string): Promise { - const notification = this.page.locator('div[class*="inbox-activity"] span', { hasText: name }) + const notification = this.notificationLocator(name) await expect(notification.locator('xpath=../../..').locator('div[class*="title"]')).toHaveText(text) } } diff --git a/tests/sanity/tests/model/planning/planning-page.ts b/tests/sanity/tests/model/planning/planning-page.ts index ef475e0012..be51c290ec 100644 --- a/tests/sanity/tests/model/planning/planning-page.ts +++ b/tests/sanity/tests/model/planning/planning-page.ts @@ -97,18 +97,18 @@ export class PlanningPage extends CalendarPage { if (data.duedate != null) { await (popup ? this.buttonPopupCreateDueDate().click() : this.buttonPanelCreateDueDate().click()) if (data.duedate === 'today') { - await this.buttonDatePopupToday.click() + await this.clickButtonDatePopupToday() } else { await this.selectMenuItem(this.page, data.duedate) } } if (data.priority != null) { await (popup ? this.buttonPopupCreatePriority().click() : this.buttonPanelCreatePriority().click()) - await this.selectListItem(this.page, data.priority) + await this.selectListItem(data.priority) } if (data.visible != null) { await (popup ? this.buttonPopupCreateVisible().click() : this.buttonPanelCreateVisible().click()) - await this.selectPopupItem(this.page, data.visible) + await this.selectPopupItem(data.visible) } if (data.labels != null && data.createLabel != null) { await (popup ? this.buttonPopupCreateAddLabel().click() : this.buttonPanelCreateAddLabel().click()) @@ -218,7 +218,7 @@ export class PlanningPage extends CalendarPage { } if (data.labels != null) { await this.buttonPanelLabelFirst().click() - await this.checkPopupItem(this.page, data.labels) + await this.checkPopupItem(data.labels) await this.buttonPanelLabelFirst().click({ force: true }) } if (data.slots != null) { diff --git a/tests/sanity/tests/model/recruiting/vacancy-details-page.ts b/tests/sanity/tests/model/recruiting/vacancy-details-page.ts index 50d42ba1d9..db4b450d5f 100644 --- a/tests/sanity/tests/model/recruiting/vacancy-details-page.ts +++ b/tests/sanity/tests/model/recruiting/vacancy-details-page.ts @@ -46,6 +46,6 @@ export class VacancyDetailsPage extends CommonRecruitingPage { async addDueDateToday (): Promise { await this.buttonInputDueDate().click() - await this.buttonDatePopupToday.click() + await this.clickButtonDatePopupToday() } } diff --git a/tests/sanity/tests/model/select-workspace-page.ts b/tests/sanity/tests/model/select-workspace-page.ts index c81bfa31bf..a85ec09994 100644 --- a/tests/sanity/tests/model/select-workspace-page.ts +++ b/tests/sanity/tests/model/select-workspace-page.ts @@ -3,28 +3,31 @@ import { CommonPage } from './common-page' export class SelectWorkspacePage extends CommonPage { readonly page: Page - readonly buttonWorkspace: Locator - readonly buttonCreateWorkspace: Locator - readonly buttonWorkspaceName: Locator - readonly buttonCreateNewWorkspace: Locator constructor (page: Page) { - super() + super(page) this.page = page - this.buttonWorkspace = page.locator('div[class*="workspace"]') - this.buttonCreateWorkspace = page.locator('button > span', { hasText: 'Create workspace' }) - this.buttonWorkspaceName = page.locator('input') - this.buttonCreateNewWorkspace = page.locator('div.form-row button') } + buttonWorkspace = (): Locator => this.page.locator('div[class*="workspace"]') + buttonCreateWorkspace = (): Locator => this.page.locator('button > span', { hasText: 'Create workspace' }) + buttonWorkspaceName = (): Locator => this.page.locator('input') + buttonCreateNewWorkspace = (): Locator => this.page.locator('div.form-row button') + + workspaceButtonByName = (workspace: string): Locator => this.buttonWorkspace().filter({ hasText: workspace }) + async selectWorkspace (workspace: string): Promise { - await this.buttonWorkspace.filter({ hasText: workspace }).click() + await this.workspaceButtonByName(workspace).click() + } + + async enterWorkspaceName (workspaceName: string): Promise { + await this.buttonWorkspaceName().fill(workspaceName) } async createWorkspace (workspaceName: string): Promise { - await this.buttonCreateWorkspace.waitFor({ state: 'visible' }) - await this.buttonWorkspaceName.fill(workspaceName) - expect(await this.buttonCreateNewWorkspace.isEnabled()).toBe(true) - await this.buttonCreateNewWorkspace.click() + await this.buttonCreateWorkspace().waitFor({ state: 'visible' }) + await this.enterWorkspaceName(workspaceName) + expect(await this.buttonCreateNewWorkspace().isEnabled()).toBe(true) + await this.buttonCreateNewWorkspace().click() } } diff --git a/tests/sanity/tests/model/signin-page.ts b/tests/sanity/tests/model/signin-page.ts index 7a50dfb25b..f72f3036bb 100644 --- a/tests/sanity/tests/model/signin-page.ts +++ b/tests/sanity/tests/model/signin-page.ts @@ -4,22 +4,20 @@ import { SignUpData } from './common-types' export class SignInJoinPage extends CommonPage { readonly page: Page - readonly inputEmail: Locator - readonly inputPassword: Locator - readonly buttonJoin: Locator constructor (page: Page) { - super() + super(page) this.page = page - this.inputEmail = page.locator('input[name="email"]') - this.inputPassword = page.locator('//div[text()="Password"]/../input') - this.buttonJoin = page.locator('button', { hasText: 'Join' }) } + inputEmail = (): Locator => this.page.locator('input[name="email"]') + inputPassword = (): Locator => this.page.locator('//div[text()="Password"]/../input') + buttonJoin = (): Locator => this.page.locator('button', { hasText: 'Join' }) + async join (data: Pick): Promise { - await this.inputEmail.fill(data.email) - await this.inputPassword.fill(data.password) - expect(await this.buttonJoin.isEnabled()).toBe(true) - await this.buttonJoin.click() + await this.inputEmail().fill(data.email) + await this.inputPassword().fill(data.password) + expect(await this.buttonJoin().isEnabled()).toBe(true) + await this.buttonJoin().click() } } diff --git a/tests/sanity/tests/model/signup-page.ts b/tests/sanity/tests/model/signup-page.ts index f8f647528b..9fd25a6df4 100644 --- a/tests/sanity/tests/model/signup-page.ts +++ b/tests/sanity/tests/model/signup-page.ts @@ -4,40 +4,58 @@ import { CommonPage } from './common-page' export class SignUpPage extends CommonPage { readonly page: Page - readonly inputFirstName: Locator - readonly inputLastName: Locator - readonly inputEmail: Locator - readonly inputNewPassword: Locator - readonly inputRepeatPassword: Locator - readonly buttonSignUp: Locator - readonly buttonJoin: Locator constructor (page: Page) { - super() + super(page) this.page = page - this.inputFirstName = page.locator('input[name="given-name"]') - this.inputLastName = page.locator('input[name="family-name"]') - this.inputEmail = page.locator('input[name="email"]') - this.inputNewPassword = page.locator('//div[text()="Password"]/../input') - this.inputRepeatPassword = page.locator('//div[text()="Repeat password"]/../input') - this.buttonSignUp = page.locator('button', { hasText: 'Sign Up' }) - this.buttonJoin = page.locator('button', { hasText: 'Join' }) + } + + inputFirstName = (): Locator => this.page.locator('input[name="given-name"]') + inputLastName = (): Locator => this.page.locator('input[name="family-name"]') + inputEmail = (): Locator => this.page.locator('input[name="email"]') + inputNewPassword = (): Locator => this.page.locator('//div[text()="Password"]/../input') + inputRepeatPassword = (): Locator => this.page.locator('//div[text()="Repeat password"]/../input') + buttonSignUp = (): Locator => this.page.locator('button', { hasText: 'Sign Up' }) + buttonJoin = (): Locator => this.page.locator('button', { hasText: 'Join' }) + + async enterFirstName (firstName: string): Promise { + await this.inputFirstName().fill(firstName) + } + + async enterLastName (lastName: string): Promise { + await this.inputLastName().fill(lastName) + } + + async enterEmail (email: string): Promise { + await this.inputEmail().fill(email) + } + + async enterPassword (password: string): Promise { + await this.inputNewPassword().fill(password) + } + + async enterRepeatPassword (password: string): Promise { + await this.inputRepeatPassword().fill(password) + } + + async clickSignUp (): Promise { + await this.buttonSignUp().click() } async signUp (data: SignUpData, mode: 'join' | 'signup' = 'signup'): Promise { - await this.inputFirstName.fill(data.firstName) - await this.inputLastName.fill(data.lastName) - await this.inputEmail.fill(data.email) - await this.inputNewPassword.fill(data.password) - await this.inputRepeatPassword.fill(data.password) + await this.enterFirstName(data.firstName) + await this.enterLastName(data.lastName) + await this.enterEmail(data.email) + await this.enterPassword(data.password) + await this.enterRepeatPassword(data.password) switch (mode) { case 'join': - expect(await this.buttonJoin.isEnabled()).toBe(true) - await this.buttonJoin.click() + expect(await this.buttonJoin().isEnabled()).toBe(true) + await this.buttonJoin().click() break case 'signup': - expect(await this.buttonSignUp.isEnabled()).toBe(true) - await this.buttonSignUp.click() + expect(await this.buttonSignUp().isEnabled()).toBe(true) + await this.buttonSignUp().click() } } } diff --git a/tests/sanity/tests/model/spotlight-popup.ts b/tests/sanity/tests/model/spotlight-popup.ts index 01316ec4e4..9a6fb9a368 100644 --- a/tests/sanity/tests/model/spotlight-popup.ts +++ b/tests/sanity/tests/model/spotlight-popup.ts @@ -4,41 +4,39 @@ import { StatusBar } from './statusbar' export class SpotlightPopup extends CommonPage { readonly page: Page - readonly popup: Locator - readonly input: Locator readonly statusbar: StatusBar constructor (page: Page) { - super() + super(page) this.page = page - this.popup = page.locator('div.popup') - this.input = this.popup.locator('input') - this.statusbar = new StatusBar(page) } + popup = (): Locator => this.page.locator('div.popup') + input = (): Locator => this.popup().locator('input') + searchResult = (search: string): Locator => this.popup().locator('div.list-item', { hasText: search }) + async open (): Promise { - const visible = await this.popup.isVisible() + const visible = await this.popup().isVisible() if (visible) { await this.close() } await this.statusbar.clickButtonSearch() - await expect(this.popup).toBeVisible() + await expect(this.popup()).toBeVisible() } async close (): Promise { await this.page.keyboard.press('Escape') - await expect(this.popup).not.toBeVisible() + await expect(this.popup()).not.toBeVisible() } async fillSearchInput (search: string): Promise { - await this.input.fill(search) - await expect(this.input).toHaveValue(search) + await this.input().fill(search) + await expect(this.input()).toHaveValue(search) await this.page.waitForTimeout(500) } async checkSearchResult (search: string, count: number): Promise { - const result = this.popup.locator('div.list-item', { hasText: search }) - await expect(result).toHaveCount(count) + await expect(this.searchResult(search)).toHaveCount(count) } } diff --git a/tests/sanity/tests/model/statusbar.ts b/tests/sanity/tests/model/statusbar.ts index 21d99050f2..bcf5871496 100644 --- a/tests/sanity/tests/model/statusbar.ts +++ b/tests/sanity/tests/model/statusbar.ts @@ -2,28 +2,25 @@ import { Locator, Page } from '@playwright/test' export class StatusBar { readonly page: Page - readonly statusbar: Locator - readonly buttonBack: Locator - readonly buttonForward: Locator - readonly buttonSearch: Locator constructor (page: Page) { this.page = page - this.statusbar = page.locator('div.antiStatusBar') - this.buttonBack = this.statusbar.locator('button[id="statusbar-back"]') - this.buttonForward = this.statusbar.locator('button[id="statusbar-forward"]') - this.buttonSearch = this.statusbar.locator('button[id="statusbar-search"]') } + statusbar = (): Locator => this.page.locator('div.antiStatusBar') + buttonBack = (): Locator => this.statusbar().locator('button[id="statusbar-back"]') + buttonForward = (): Locator => this.statusbar().locator('button[id="statusbar-forward"]') + buttonSearch = (): Locator => this.statusbar().locator('button[id="statusbar-search"]') + async clickButtonBack (): Promise { - await this.buttonBack.click() + await this.buttonBack().click() } async clickButtonForward (): Promise { - await this.buttonForward.click() + await this.buttonForward().click() } async clickButtonSearch (): Promise { - await this.buttonSearch.click() + await this.buttonSearch().click() } } diff --git a/tests/sanity/tests/model/tracker/common-tracker-page.ts b/tests/sanity/tests/model/tracker/common-tracker-page.ts index 5ae960d833..a8063e89db 100644 --- a/tests/sanity/tests/model/tracker/common-tracker-page.ts +++ b/tests/sanity/tests/model/tracker/common-tracker-page.ts @@ -179,7 +179,7 @@ export class CommonTrackerPage extends CalendarPage { async addMentions (mention: string): Promise { await this.inputComment().fill(`@${mention}`) - await this.selectMention(this.page, mention) + await this.selectMention(mention) await this.buttonSendComment().click() } diff --git a/tests/sanity/tests/model/tracker/template-details-page.ts b/tests/sanity/tests/model/tracker/template-details-page.ts index db3ede1d96..8e17edfdb7 100644 --- a/tests/sanity/tests/model/tracker/template-details-page.ts +++ b/tests/sanity/tests/model/tracker/template-details-page.ts @@ -67,7 +67,7 @@ export class TemplateDetailsPage extends CommonTrackerPage { if (data.duedate != null) { if (data.duedate === 'today') { await this.buttonDueDate().click() - await this.buttonDatePopupToday.click() + await this.buttonDatePopupToday().click() } else { await this.buttonDueDate().click() await this.buttonSaveDueDate().click() diff --git a/tests/sanity/tests/model/tracker/tracker-navigation-menu-page.ts b/tests/sanity/tests/model/tracker/tracker-navigation-menu-page.ts index 2539125d94..c5661f7004 100644 --- a/tests/sanity/tests/model/tracker/tracker-navigation-menu-page.ts +++ b/tests/sanity/tests/model/tracker/tracker-navigation-menu-page.ts @@ -5,7 +5,7 @@ export class TrackerNavigationMenuPage extends CommonPage { page: Page constructor (page: Page) { - super() + super(page) this.page = page } diff --git a/tests/sanity/tests/recruiting/vacancies.spec.ts b/tests/sanity/tests/recruiting/vacancies.spec.ts index 491952d9ee..9f6001c1a0 100644 --- a/tests/sanity/tests/recruiting/vacancies.spec.ts +++ b/tests/sanity/tests/recruiting/vacancies.spec.ts @@ -33,7 +33,7 @@ test.describe('Vacancy tests', () => { await page.click('button:has-text("Application")') await page.click('form[id="recruit:string:CreateApplication"] [id="vacancy.talant.selector"]') - await new CommonPage().selectAssignee(page, 'Alex') + await new CommonPage(page).selectAssignee(page, 'Alex') await page.click('form[id="recruit:string:CreateApplication"] button:has-text("Create")') await page.waitForSelector('form.antiCard', { state: 'detached' }) diff --git a/tests/sanity/tests/tracker/attachments.spec.ts b/tests/sanity/tests/tracker/attachments.spec.ts index 2a7dc0a741..17f1568fc2 100644 --- a/tests/sanity/tests/tracker/attachments.spec.ts +++ b/tests/sanity/tests/tracker/attachments.spec.ts @@ -22,7 +22,7 @@ test.describe('Attachments tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) await trackerNavigationMenuPage.openIssuesForProject('Default') diff --git a/tests/sanity/tests/tracker/component.spec.ts b/tests/sanity/tests/tracker/component.spec.ts index 45d8d9c636..e80d074eba 100644 --- a/tests/sanity/tests/tracker/component.spec.ts +++ b/tests/sanity/tests/tracker/component.spec.ts @@ -52,7 +52,7 @@ test.describe('Tracker component tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) await trackerNavigationMenuPage.openComponentsForProject('Default') @@ -78,7 +78,7 @@ test.describe('Tracker component tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) await trackerNavigationMenuPage.openComponentsForProject('Default') diff --git a/tests/sanity/tests/tracker/filter.spec.ts b/tests/sanity/tests/tracker/filter.spec.ts index 8d8410b54b..f34affe788 100644 --- a/tests/sanity/tests/tracker/filter.spec.ts +++ b/tests/sanity/tests/tracker/filter.spec.ts @@ -32,7 +32,7 @@ test.describe('Tracker filters tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() @@ -130,7 +130,7 @@ test.describe('Tracker filters tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() @@ -232,7 +232,7 @@ test.describe('Tracker filters tests', () => { test('Status filter', async ({ page }) => { const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.linkSidebarAll().click() @@ -252,7 +252,7 @@ test.describe('Tracker filters tests', () => { test('Priority filter', async ({ page }) => { const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() @@ -272,7 +272,7 @@ test.describe('Tracker filters tests', () => { test('Created by filter', async ({ page }) => { const createdBy = 'Appleseed John' const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() @@ -293,7 +293,7 @@ test.describe('Tracker filters tests', () => { test('Component filter', async ({ page }) => { const defaultComponent = 'Default component' const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() @@ -316,7 +316,7 @@ test.describe('Tracker filters tests', () => { const firstSearch = 'issue' const secondSearch = 'done' const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() @@ -344,7 +344,7 @@ test.describe('Tracker filters tests', () => { test('Modified by filter', async ({ page }) => { const modifierName = 'Appleseed John' const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() @@ -373,7 +373,7 @@ test.describe('Tracker filters tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() @@ -416,7 +416,7 @@ test.describe('Tracker filters tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() @@ -461,7 +461,7 @@ test.describe('Tracker filters tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() diff --git a/tests/sanity/tests/tracker/issues-duplicate.spec.ts b/tests/sanity/tests/tracker/issues-duplicate.spec.ts index a6b6836f55..096b4a3844 100644 --- a/tests/sanity/tests/tracker/issues-duplicate.spec.ts +++ b/tests/sanity/tests/tracker/issues-duplicate.spec.ts @@ -28,7 +28,7 @@ test.describe('Tracker duplicate issue tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) await trackerNavigationMenuPage.openIssuesForProject('Default') diff --git a/tests/sanity/tests/tracker/issues.spec.ts b/tests/sanity/tests/tracker/issues.spec.ts index 88a63bacf4..8a15931997 100644 --- a/tests/sanity/tests/tracker/issues.spec.ts +++ b/tests/sanity/tests/tracker/issues.spec.ts @@ -17,7 +17,7 @@ test.describe('Tracker issue tests', () => { await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() }) test('Create an issue with all parameters and attachments', async ({ page }) => { diff --git a/tests/sanity/tests/tracker/mentions.spec.ts b/tests/sanity/tests/tracker/mentions.spec.ts index 4d48e3b0db..12f773273b 100644 --- a/tests/sanity/tests/tracker/mentions.spec.ts +++ b/tests/sanity/tests/tracker/mentions.spec.ts @@ -22,7 +22,7 @@ test.describe('Mentions issue tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() @@ -44,7 +44,7 @@ test.describe('Mentions issue tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() @@ -72,7 +72,7 @@ test.describe('Mentions issue tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() diff --git a/tests/sanity/tests/tracker/milestone.spec.ts b/tests/sanity/tests/tracker/milestone.spec.ts index d6b709562d..63a1630c6d 100644 --- a/tests/sanity/tests/tracker/milestone.spec.ts +++ b/tests/sanity/tests/tracker/milestone.spec.ts @@ -24,7 +24,7 @@ test.describe('Tracker milestone tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) await trackerNavigationMenuPage.openMilestonesForProject('Default') @@ -47,7 +47,7 @@ test.describe('Tracker milestone tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) await trackerNavigationMenuPage.openMilestonesForProject('Default') @@ -75,7 +75,7 @@ test.describe('Tracker milestone tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) await trackerNavigationMenuPage.openMilestonesForProject('Default') diff --git a/tests/sanity/tests/tracker/public-link.spec.ts b/tests/sanity/tests/tracker/public-link.spec.ts index 661588f1d5..2dde2c86fd 100644 --- a/tests/sanity/tests/tracker/public-link.spec.ts +++ b/tests/sanity/tests/tracker/public-link.spec.ts @@ -21,7 +21,7 @@ test.describe('Tracker public link issues tests', () => { await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() await prepareNewIssueWithOpenStep(page, publicLinkIssue) const issuesDetailsPage = new IssuesDetailsPage(page) @@ -72,7 +72,7 @@ test.describe('Tracker public link issues tests', () => { await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() await prepareNewIssueWithOpenStep(page, publicLinkIssue) const issuesDetailsPage = new IssuesDetailsPage(page) diff --git a/tests/sanity/tests/tracker/related-issues.spec.ts b/tests/sanity/tests/tracker/related-issues.spec.ts index ce9aa8adda..f42b6c13ef 100644 --- a/tests/sanity/tests/tracker/related-issues.spec.ts +++ b/tests/sanity/tests/tracker/related-issues.spec.ts @@ -34,7 +34,7 @@ test.describe('Tracker related issue tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() diff --git a/tests/sanity/tests/tracker/relations.spec.ts b/tests/sanity/tests/tracker/relations.spec.ts index 4a6a9e6a27..8df565d659 100644 --- a/tests/sanity/tests/tracker/relations.spec.ts +++ b/tests/sanity/tests/tracker/relations.spec.ts @@ -25,7 +25,7 @@ test.describe('Relations', () => { description: 'Second. Mark as blocked by' } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const secondIssueId = await prepareNewIssueStep(page, secondIssue) const firstIssueId = await prepareNewIssueStep(page, firstIssue) @@ -71,7 +71,7 @@ test.describe('Relations', () => { description: 'Second. Mark as blocked by' } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const secondIssueId = await prepareNewIssueStep(page, secondIssue) const firstIssueId = await prepareNewIssueStep(page, firstIssue) @@ -119,7 +119,7 @@ test.describe('Relations', () => { description: 'Second. Reference another issue' } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const secondIssueId = await prepareNewIssueStep(page, secondIssue) const firstIssueId = await prepareNewIssueStep(page, firstIssue) @@ -165,7 +165,7 @@ test.describe('Relations', () => { description: 'Second. Remove relation be editing issue details' } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const secondIssueId = await prepareNewIssueStep(page, secondIssue) await prepareNewIssueStep(page, firstIssue) diff --git a/tests/sanity/tests/tracker/subissues.spec.ts b/tests/sanity/tests/tracker/subissues.spec.ts index f976864c28..c0e3f7c70e 100644 --- a/tests/sanity/tests/tracker/subissues.spec.ts +++ b/tests/sanity/tests/tracker/subissues.spec.ts @@ -75,7 +75,7 @@ test.describe('Tracker sub-issues tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() @@ -112,7 +112,7 @@ test.describe('Tracker sub-issues tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() @@ -152,7 +152,7 @@ test.describe('Tracker sub-issues tests', () => { const templateName = 'New Issue' const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const issuesPage = new IssuesPage(page) await issuesPage.modelSelectorAll().click() diff --git a/tests/sanity/tests/tracker/template.spec.ts b/tests/sanity/tests/tracker/template.spec.ts index 012ff6ef2a..0bc0a12fae 100644 --- a/tests/sanity/tests/tracker/template.spec.ts +++ b/tests/sanity/tests/tracker/template.spec.ts @@ -29,7 +29,7 @@ test.describe('Tracker template tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) await trackerNavigationMenuPage.openTemplateForProject('Default') @@ -62,7 +62,7 @@ test.describe('Tracker template tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) await trackerNavigationMenuPage.openTemplateForProject('Default') @@ -117,7 +117,7 @@ test.describe('Tracker template tests', () => { } const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) await trackerNavigationMenuPage.openTemplateForProject('Default') diff --git a/tests/sanity/tests/workspace/create.spec.ts b/tests/sanity/tests/workspace/create.spec.ts index 9c1f2d4300..3114767dc5 100644 --- a/tests/sanity/tests/workspace/create.spec.ts +++ b/tests/sanity/tests/workspace/create.spec.ts @@ -23,7 +23,7 @@ test.describe('Workspace tests', () => { const loginPage = new LoginPage(page) await loginPage.goto() - await loginPage.linkSignUp.click() + await loginPage.clickSignUp() const signUpPage = new SignUpPage(page) await signUpPage.signUp(newUser) @@ -32,7 +32,7 @@ test.describe('Workspace tests', () => { await selectWorkspacePage.createWorkspace(newWorkspaceName) const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() }) test('Create a new issue in the workspace with a custom name', async ({ page }) => { @@ -60,7 +60,7 @@ test.describe('Workspace tests', () => { const loginPage = new LoginPage(page) await loginPage.goto() - await loginPage.linkSignUp.click() + await loginPage.clickSignUp() const signUpPage = new SignUpPage(page) await signUpPage.signUp(newUser) @@ -69,7 +69,7 @@ test.describe('Workspace tests', () => { await selectWorkspacePage.createWorkspace(newWorkspaceName) const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page) await trackerNavigationMenuPage.openIssuesForProject('Default') @@ -99,25 +99,24 @@ test.describe('Workspace tests', () => { const loginPage = new LoginPage(page) await loginPage.goto() - await loginPage.linkSignUp.click() + await loginPage.clickSignUp() const signUpPage = new SignUpPage(page) await signUpPage.checkInfo(page, 'Required field First name') - await signUpPage.inputFirstName.fill(newUser.firstName) + await signUpPage.enterFirstName(newUser.firstName) await signUpPage.checkInfo(page, 'Required field Last name') - await signUpPage.inputLastName.fill(newUser.lastName) + await signUpPage.enterLastName(newUser.lastName) await signUpPage.checkInfo(page, 'Required field Email') - await signUpPage.inputEmail.fill(newUser.email) + await signUpPage.enterEmail(newUser.email) await signUpPage.checkInfo(page, 'Required field Password') - await signUpPage.inputNewPassword.fill(newUser.password) + await signUpPage.enterPassword(newUser.password) await signUpPage.checkInfo(page, "Repeat password don't match Password") - await signUpPage.inputRepeatPassword.fill(newUser.password) + await signUpPage.enterRepeatPassword(newUser.password) await signUpPage.checkInfoSectionNotExist(page) - await signUpPage.buttonSignUp.click() - + await signUpPage.clickSignUp() const selectWorkspacePage = new SelectWorkspacePage(page) await selectWorkspacePage.checkInfo(page, 'Required field Workspace name') - await selectWorkspacePage.buttonWorkspaceName.fill(newWorkspaceName) + await selectWorkspacePage.enterWorkspaceName(newWorkspaceName) await selectWorkspacePage.checkInfoSectionNotExist(page) }) @@ -132,7 +131,7 @@ test.describe('Workspace tests', () => { const loginPage = new LoginPage(page) await loginPage.goto() - await loginPage.linkSignUp.click() + await loginPage.clickSignUp() const signUpPage = new SignUpPage(page) await signUpPage.signUp(newUser) @@ -141,7 +140,7 @@ test.describe('Workspace tests', () => { await selectWorkspacePage.createWorkspace(newWorkspaceName) const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() // Generate invite link @@ -167,7 +166,7 @@ test.describe('Workspace tests', () => { await signUpPage2.signUp(newUser2, 'join') const leftSideMenuPage2 = new LeftSideMenuPage(page2) - await leftSideMenuPage2.buttonTracker.click() + await leftSideMenuPage2.clickTracker() }) test('Create a workspace with join link - existing account', async ({ page, browser }) => { @@ -181,7 +180,7 @@ test.describe('Workspace tests', () => { const loginPage = new LoginPage(page) await loginPage.goto() - await loginPage.linkSignUp.click() + await loginPage.clickSignUp() const signUpPage = new SignUpPage(page) await signUpPage.signUp(newUser) @@ -190,7 +189,7 @@ test.describe('Workspace tests', () => { await selectWorkspacePage.createWorkspace(newWorkspaceName) const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() // Generate invite link @@ -204,7 +203,7 @@ test.describe('Workspace tests', () => { const loginPage2 = new LoginPage(page2) await loginPage2.goto() - await loginPage2.linkSignUp.click() + await loginPage2.clickSignUp() const newUser2: SignUpData = { firstName: `FirstName2-${generateId()}`, @@ -224,7 +223,7 @@ test.describe('Workspace tests', () => { await joinPage.join(newUser2) const leftSideMenuPage2 = new LeftSideMenuPage(page2) - await leftSideMenuPage2.buttonTracker.click() + await leftSideMenuPage2.clickTracker() }) test('Create workspace with LastToken in the localStorage', async ({ page, browser }) => { @@ -236,7 +235,7 @@ test.describe('Workspace tests', () => { await selectWorkspacePage.selectWorkspace(DefaultWorkspace) const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.buttonTracker.click() + await leftSideMenuPage.clickTracker() const lastToken = await page.evaluate(() => localStorage.getItem('login:metadata:LastToken') ?? '') expect(lastToken).not.toEqual('') @@ -255,7 +254,7 @@ test.describe('Workspace tests', () => { await selectWorkspacePageSecond.createWorkspace(newWorkspaceName) const leftSideMenuPageSecond = new LeftSideMenuPage(pageSecond) - await leftSideMenuPageSecond.buttonTracker.click() + await leftSideMenuPageSecond.clickTracker() }) }) })