mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 04:08:19 +00:00
Refactoring last batch of tests (#5504)
Signed-off-by: Jasmin <jasmin@hardcoreeng.com>
This commit is contained in:
parent
0611820bbf
commit
f641e398e1
@ -11,6 +11,9 @@ dependencies:
|
||||
'@elastic/elasticsearch':
|
||||
specifier: ^7.14.0
|
||||
version: 7.17.13
|
||||
'@faker-js/faker':
|
||||
specifier: ^8.4.1
|
||||
version: 8.4.1
|
||||
'@hocuspocus/provider':
|
||||
specifier: ^2.9.0
|
||||
version: 2.11.2(bufferutil@4.0.8)(utf-8-validate@6.0.3)(yjs@13.6.12)
|
||||
@ -3327,6 +3330,11 @@ packages:
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
dev: false
|
||||
|
||||
/@faker-js/faker@8.4.1:
|
||||
resolution: {integrity: sha512-XQ3cU+Q8Uqmrbf2e0cIC/QN43sTBSC8KF12u29Mb47tWrt2hAgBXSgpZMj4Ao8Uk0iJcU99QsOCaIL8934obCg==}
|
||||
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0, npm: '>=6.14.13'}
|
||||
dev: false
|
||||
|
||||
/@fal-works/esbuild-plugin-global-externals@2.1.2:
|
||||
resolution: {integrity: sha512-cEee/Z+I12mZcFJshKcCqC8tuX5hG3s+d+9nZ3LabqKF1vKdF41B92pJVCBggjAGORAeOzyyDDKrZwIkLffeOQ==}
|
||||
dev: false
|
||||
@ -24020,10 +24028,11 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/tests-sanity.tgz:
|
||||
resolution: {integrity: sha512-bHbtIpLtOSU+bGfGEPLPftv/Kn5lzKXV9uLgAZDbt1fCnlKLI7bM/YB4jcN3+zFCb471OFW0Mi6tX5VMW7uCyw==, tarball: file:projects/tests-sanity.tgz}
|
||||
resolution: {integrity: sha512-LeckKKWjsMQjujD+8WDNgLb5a/pycjFqGFiE/gsu35DzPH0xYhLA7CVeKpwCfb1+JXFL4HbhCjcXuSgNK5kc0A==, tarball: file:projects/tests-sanity.tgz}
|
||||
name: '@rush-temp/tests-sanity'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@faker-js/faker': 8.4.1
|
||||
'@playwright/test': 1.41.2
|
||||
'@types/jest': 29.5.12
|
||||
'@types/node': 20.11.19
|
||||
|
@ -41,7 +41,8 @@
|
||||
"prettier": "^3.1.0",
|
||||
"typescript": "^5.3.3",
|
||||
"@playwright/test": "^1.41.2",
|
||||
"allure-playwright": "^2.9.2"
|
||||
"allure-playwright": "^2.9.2",
|
||||
"@faker-js/faker": "^8.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"dotenv": "~16.0.0",
|
||||
|
@ -25,8 +25,17 @@ test.describe('Fulltext index', () => {
|
||||
})
|
||||
|
||||
test.describe('Documents', () => {
|
||||
let leftSideMenuPage: LeftSideMenuPage
|
||||
let documentsPage: DocumentsPage
|
||||
let documentContentPage: DocumentContentPage
|
||||
let spotlight: SpotlightPopup
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
documentsPage = new DocumentsPage(page)
|
||||
documentContentPage = new DocumentContentPage(page)
|
||||
spotlight = new SpotlightPopup(page)
|
||||
|
||||
await leftSideMenuPage.clickDocuments()
|
||||
})
|
||||
|
||||
@ -41,19 +50,11 @@ test.describe('Fulltext index', () => {
|
||||
|
||||
const content = `Indexable document content ${contentId}`
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
const documentsPage = new DocumentsPage(page)
|
||||
const documentContentPage = new DocumentContentPage(page)
|
||||
const spotlight = new SpotlightPopup(page)
|
||||
|
||||
await test.step('create document', async () => {
|
||||
await documentsPage.clickOnButtonCreateDocument()
|
||||
|
||||
await documentsPage.createDocument(newDocument)
|
||||
await documentsPage.openDocument(newDocument.title)
|
||||
|
||||
await documentContentPage.checkDocumentTitle(newDocument.title)
|
||||
|
||||
await documentContentPage.addContentToTheNewLine(content)
|
||||
await documentContentPage.checkContent(content)
|
||||
})
|
||||
@ -98,20 +99,11 @@ test.describe('Fulltext index', () => {
|
||||
|
||||
const updatedContentId = generateId()
|
||||
const updatedContent = `Indexable document content ${updatedContentId}`
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
const documentsPage = new DocumentsPage(page)
|
||||
const documentContentPage = new DocumentContentPage(page)
|
||||
const spotlight = new SpotlightPopup(page)
|
||||
|
||||
await test.step('create document', async () => {
|
||||
await documentsPage.clickOnButtonCreateDocument()
|
||||
|
||||
await documentsPage.createDocument(newDocument)
|
||||
await documentsPage.openDocument(newDocument.title)
|
||||
|
||||
await documentContentPage.checkDocumentTitle(newDocument.title)
|
||||
|
||||
await documentContentPage.addContentToTheNewLine(content)
|
||||
await documentContentPage.checkContent(content)
|
||||
})
|
||||
@ -163,14 +155,7 @@ test.describe('Fulltext index', () => {
|
||||
title: `Indexable Document ${titleId}`,
|
||||
space: 'Default'
|
||||
}
|
||||
|
||||
const content = `Indexable document content ${contentId}`
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
const documentsPage = new DocumentsPage(page)
|
||||
const documentContentPage = new DocumentContentPage(page)
|
||||
const spotlight = new SpotlightPopup(page)
|
||||
|
||||
await test.step('create document', async () => {
|
||||
await documentsPage.clickOnButtonCreateDocument()
|
||||
|
||||
@ -211,8 +196,16 @@ test.describe('Fulltext index', () => {
|
||||
})
|
||||
|
||||
test.describe('Issues', () => {
|
||||
let leftSideMenuPage: LeftSideMenuPage
|
||||
let issuesPage: IssuesPage
|
||||
let spotlight: SpotlightPopup
|
||||
let issuesDetailsPage: IssuesDetailsPage
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
issuesPage = new IssuesPage(page)
|
||||
spotlight = new SpotlightPopup(page)
|
||||
issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await leftSideMenuPage.clickTracker()
|
||||
})
|
||||
|
||||
@ -226,9 +219,6 @@ test.describe('Fulltext index', () => {
|
||||
status: 'Backlog'
|
||||
}
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
const spotlight = new SpotlightPopup(page)
|
||||
|
||||
await test.step('create issue', async () => {
|
||||
await issuesPage.createNewIssue(newIssue)
|
||||
})
|
||||
@ -267,10 +257,6 @@ test.describe('Fulltext index', () => {
|
||||
status: 'Backlog'
|
||||
}
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
const spotlight = new SpotlightPopup(page)
|
||||
|
||||
await test.step('create issue', async () => {
|
||||
await issuesPage.createNewIssue(newIssue)
|
||||
})
|
||||
@ -332,10 +318,6 @@ test.describe('Fulltext index', () => {
|
||||
status: 'Backlog'
|
||||
}
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
const spotlight = new SpotlightPopup(page)
|
||||
|
||||
await test.step('create issue', async () => {
|
||||
await issuesPage.createNewIssue(newIssue)
|
||||
})
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { type Locator, type Page } from '@playwright/test'
|
||||
import { type Locator, type Page, expect } from '@playwright/test'
|
||||
import { CommonPage } from './common-page'
|
||||
|
||||
export class LeftSideMenuPage extends CommonPage {
|
||||
@ -14,6 +14,22 @@ export class LeftSideMenuPage extends CommonPage {
|
||||
buttonTracker = (): Locator => this.page.locator('button[id$="TrackerApplication"]')
|
||||
buttonNotification = (): Locator => this.page.locator('button[id$="Inbox"]')
|
||||
buttonDocuments = (): Locator => this.page.locator('button[id$="DocumentApplication"]')
|
||||
profileButton = (): Locator => this.page.locator('#profile-button')
|
||||
inviteToWorkspaceButton = (): Locator => this.page.locator('button:has-text("Invite to workspace")')
|
||||
getInviteLinkButton = (): Locator => this.page.locator('button:has-text("Get invite link")')
|
||||
|
||||
// Actions
|
||||
async openProfileMenu (): Promise<void> {
|
||||
await this.profileButton().click()
|
||||
}
|
||||
|
||||
async inviteToWorkspace (): Promise<void> {
|
||||
await this.inviteToWorkspaceButton().click()
|
||||
}
|
||||
|
||||
async getInviteLink (): Promise<void> {
|
||||
await this.getInviteLinkButton().click()
|
||||
}
|
||||
|
||||
async clickChunter (): Promise<void> {
|
||||
await this.buttonChunter().click()
|
||||
@ -34,4 +50,29 @@ export class LeftSideMenuPage extends CommonPage {
|
||||
async clickDocuments (): Promise<void> {
|
||||
await this.buttonDocuments().click()
|
||||
}
|
||||
|
||||
// Retrieve the last token from local storage
|
||||
async getLastToken (): Promise<string> {
|
||||
return await this.page.evaluate(() => localStorage.getItem('login:metadata:LastToken') ?? '')
|
||||
}
|
||||
|
||||
// Set the last token in local storage on the same page
|
||||
async setLastToken (lastToken: string): Promise<void> {
|
||||
await this.page.evaluate((token) => {
|
||||
localStorage.setItem('login:metadata:LastToken', token)
|
||||
}, lastToken)
|
||||
}
|
||||
|
||||
// Set the last token in local storage on any specified page
|
||||
async setLastTokenOnPage (targetPage: Page, lastToken: string): Promise<void> {
|
||||
await targetPage.evaluate((token) => {
|
||||
localStorage.setItem('login:metadata:LastToken', token)
|
||||
}, lastToken)
|
||||
}
|
||||
|
||||
// Assert that the last token is not empty
|
||||
async verifyLastTokenNotEmpty (): Promise<void> {
|
||||
const lastToken = await this.getLastToken()
|
||||
expect(lastToken).not.toEqual('')
|
||||
}
|
||||
}
|
||||
|
57
tests/sanity/tests/model/profile/user-profile-page.ts
Normal file
57
tests/sanity/tests/model/profile/user-profile-page.ts
Normal file
@ -0,0 +1,57 @@
|
||||
import { expect, Page, Locator } from '@playwright/test'
|
||||
|
||||
export class UserProfilePage {
|
||||
private readonly page: Page
|
||||
|
||||
// Locators using lambda functions
|
||||
profileButton = (): Locator => this.page.locator('#profile-button')
|
||||
locationInput = (): Locator => this.page.locator('[placeholder="Location"]')
|
||||
phoneContactInput = (): Locator => this.page.locator('.search')
|
||||
phonePopupButton = (): Locator => this.page.locator('.popup button:has-text("Phone")')
|
||||
applyChangesButton = (): Locator => this.page.locator('.editor-container button:nth-child(3)')
|
||||
addSocialLinksButton = (): Locator => this.page.locator('[id="presentation:string:AddSocialLinks"]')
|
||||
selectProfile = (name: string): Locator => this.page.locator(`text=${name}`)
|
||||
|
||||
constructor (page: Page) {
|
||||
this.page = page
|
||||
}
|
||||
|
||||
async gotoProfile (workspaceUrl: string): Promise<void> {
|
||||
const response = await this.page.goto(workspaceUrl)
|
||||
if (response === null || response === undefined) {
|
||||
throw new Error(`Failed to navigate to ${workspaceUrl}`)
|
||||
}
|
||||
await response.finished()
|
||||
}
|
||||
|
||||
async openProfileMenu (): Promise<void> {
|
||||
await this.profileButton().click()
|
||||
}
|
||||
|
||||
async selectProfileByName (name: string): Promise<void> {
|
||||
await this.selectProfile(name).click()
|
||||
}
|
||||
|
||||
async verifyProfilePageUrl (expectedUrl: string): Promise<void> {
|
||||
await expect(this.page).toHaveURL(expectedUrl)
|
||||
}
|
||||
|
||||
async updateLocation (newLocation: string): Promise<void> {
|
||||
await this.locationInput().click()
|
||||
await this.locationInput().fill(newLocation)
|
||||
}
|
||||
|
||||
async addOrEditPhone (): Promise<void> {
|
||||
if ((await this.phoneContactInput().count()) === 0) {
|
||||
await this.addSocialLinksButton().click()
|
||||
await this.phonePopupButton().click()
|
||||
} else {
|
||||
await this.phoneContactInput().click()
|
||||
}
|
||||
await this.phoneContactInput().fill('+1 555 333 7777')
|
||||
}
|
||||
|
||||
async applyChanges (): Promise<void> {
|
||||
await this.applyChangesButton().click()
|
||||
}
|
||||
}
|
@ -7,26 +7,36 @@ export class RecruitingPage {
|
||||
this.page = page
|
||||
}
|
||||
|
||||
readonly recruitApplication = (): Locator => this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
readonly talentsNavElement = (): Locator => this.page.locator('text=Talents')
|
||||
readonly reviews = (): Locator => this.page.locator('text=Reviews')
|
||||
readonly reviewButton = (): Locator => this.page.locator('button:has-text("Review")')
|
||||
recruitApplication = (): Locator => this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
talentsNavElement = (): Locator => this.page.locator('text=Talents')
|
||||
reviews = (): Locator => this.page.locator('text=Reviews')
|
||||
reviewButton = (): Locator => this.page.locator('button:has-text("Review")')
|
||||
|
||||
readonly frontendEngineerOption = (): Locator => this.page.locator('td:has-text("Frontend Engineer")')
|
||||
readonly searchOrRunCommandInput = (): Locator =>
|
||||
this.page.locator('[placeholder="Search\\ or\\ run\\ a\\ command\\.\\.\\."]')
|
||||
frontendEngineerOption = (): Locator => this.page.locator('td:has-text("Frontend Engineer")')
|
||||
searchOrRunCommandInput = (): Locator => this.page.locator('[placeholder="Search\\ or\\ run\\ a\\ command\\.\\.\\."]')
|
||||
|
||||
readonly newTalentPopupOption = (): Locator => this.page.locator('div.selectPopup :text("New Talent")')
|
||||
readonly goToVacanciesPopupOption = (): Locator =>
|
||||
this.page.locator('div.selectPopup div.list-item :text("Go To Vacancies")')
|
||||
newTalentPopupOption = (): Locator => this.page.locator('div.selectPopup :text("New Talent")')
|
||||
goToVacanciesPopupOption = (): Locator => this.page.locator('div.selectPopup div.list-item :text("Go To Vacancies")')
|
||||
|
||||
readonly goToApplicationsPopupOption = (): Locator => this.page.locator('div.selectPopup :text("Go To Applications")')
|
||||
readonly cardCloseButton = (): Locator => this.page.locator('button#card-close')
|
||||
readonly selectedTalentsNavElement = (): Locator => this.page.locator('a[href$="talents"] > div.selected')
|
||||
readonly actionsInput = (): Locator => this.page.locator('input.actionsInput')
|
||||
readonly newTalentFirstName = (): Locator => this.page.getByPlaceholder('First name')
|
||||
readonly newTalentLastName = (): Locator => this.page.getByPlaceholder('Last name')
|
||||
readonly newTalentModalPath = (): Locator => this.page.getByText('Person New Talent')
|
||||
goToApplicationsPopupOption = (): Locator => this.page.locator('div.selectPopup :text("Go To Applications")')
|
||||
cardCloseButton = (): Locator => this.page.locator('button#card-close')
|
||||
selectedTalentsNavElement = (): Locator => this.page.locator('a[href$="talents"] > div.selected')
|
||||
actionsInput = (): Locator => this.page.locator('input.actionsInput')
|
||||
newTalentFirstName = (): Locator => this.page.getByPlaceholder('First name')
|
||||
newTalentLastName = (): Locator => this.page.getByPlaceholder('Last name')
|
||||
newTalentModalPath = (): Locator => this.page.getByText('Person New Talent')
|
||||
recruitApplicationButton = (): Locator => this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
applicationsLink = (): Locator => this.page.locator('text=/^Applications/')
|
||||
talentsLink = (): Locator => this.page.locator('text=Talents')
|
||||
vacanciesLink = (): Locator => this.page.locator('text=Vacancies')
|
||||
softwareEngineerLink = (): Locator => this.page.locator('text=Software Engineer')
|
||||
applicationLabelChunterButton = (): Locator =>
|
||||
this.page.locator('[id="app-chunter\\:string\\:ApplicationLabelChunter"]')
|
||||
|
||||
generalChatLink = (): Locator => this.page.locator('text=general')
|
||||
contactsButton = (): Locator => this.page.locator('[id="app-contact\\:string\\:Contacts"]')
|
||||
employeeSection = (): Locator => this.page.locator('.antiNav-element:has-text("Employee")')
|
||||
johnAppleseed = (): Locator => this.page.locator('text=Appleseed John')
|
||||
|
||||
async clickRecruitApplication (): Promise<void> {
|
||||
await this.recruitApplication().click()
|
||||
@ -96,4 +106,39 @@ export class RecruitingPage {
|
||||
expect(await this.newTalentLastName().isHidden())
|
||||
expect(await this.newTalentModalPath().isHidden())
|
||||
}
|
||||
|
||||
async navigateToRecruitApplication (workspaceUrl: string): Promise<void> {
|
||||
await this.page.goto(workspaceUrl)
|
||||
}
|
||||
|
||||
async openRecruitApplication (): Promise<void> {
|
||||
await this.recruitApplicationButton().click()
|
||||
}
|
||||
|
||||
async checkApplicationsVisibility (): Promise<void> {
|
||||
await this.applicationsLink().click()
|
||||
await expect(this.page.locator('text=Applications >> nth=1')).toBeVisible()
|
||||
expect(this.page.locator('text="APP-1"')).toBeDefined()
|
||||
}
|
||||
|
||||
async verifyTalentSection (): Promise<void> {
|
||||
await this.talentsLink().click()
|
||||
await expect(this.page.locator('text=P. Andrey')).toBeVisible()
|
||||
}
|
||||
|
||||
async navigateToVacanciesAndCheckSoftwareEngineer (): Promise<void> {
|
||||
await this.vacanciesLink().click()
|
||||
await this.softwareEngineerLink().click()
|
||||
expect(this.page.locator('text=Software Engineer')).toBeDefined()
|
||||
expect(this.page.locator('text="APP-1"')).toBeDefined()
|
||||
}
|
||||
|
||||
async navigateToGeneralChatAndContacts (): Promise<void> {
|
||||
await this.applicationLabelChunterButton().click()
|
||||
await this.generalChatLink().click()
|
||||
await expect(this.page.locator('.text-input')).toBeVisible()
|
||||
await this.contactsButton().click()
|
||||
await this.employeeSection().click()
|
||||
await expect(this.johnAppleseed()).toBeVisible()
|
||||
}
|
||||
}
|
||||
|
@ -11,43 +11,54 @@ export class TalentsPage extends CommonRecruitingPage {
|
||||
this.page = page
|
||||
}
|
||||
|
||||
readonly pageHeader = (): Locator => this.page.locator('span[class*="header"]', { hasText: 'Talents' })
|
||||
readonly buttonCreateTalent = (): Locator =>
|
||||
this.page.locator('div[class*="ac-header"] button > span', { hasText: 'Talent' })
|
||||
pageHeader = (): Locator => this.page.locator('span[class*="header"]', { hasText: 'Talents' })
|
||||
buttonCreateTalent = (): Locator => this.page.locator('div[class*="ac-header"] button > span', { hasText: 'Talent' })
|
||||
|
||||
readonly textVacancyMatchingTalent = (): Locator =>
|
||||
textVacancyMatchingTalent = (): Locator =>
|
||||
this.page.locator(
|
||||
'form[id="recruit:string:VacancyMatching"] table > tbody > tr > td:nth-child(1) span[class*="label"]'
|
||||
)
|
||||
|
||||
readonly textVacancyMatchingScore = (): Locator =>
|
||||
textVacancyMatchingScore = (): Locator =>
|
||||
this.page.locator('form[id="recruit:string:VacancyMatching"] table > tbody > tr > td:nth-child(2)')
|
||||
|
||||
readonly inputSearchTalent = (): Locator => this.page.locator('div[class*="header"] input')
|
||||
readonly andreyTalet = (): Locator => this.page.locator('text=P. Andrey')
|
||||
inputSearchTalent = (): Locator => this.page.locator('div[class*="header"] input')
|
||||
andreyTalet = (): Locator => this.page.locator('text=P. Andrey')
|
||||
|
||||
readonly addApplicationButton = (): Locator => this.page.locator('button[id="appls.add"]')
|
||||
readonly spaceSelector = (): Locator => this.page.locator('[id="space.selector"]')
|
||||
readonly searchInput = (): Locator => this.page.locator('[placeholder="Search..."]')
|
||||
readonly hrInterviewButton = (): Locator =>
|
||||
addApplicationButton = (): Locator => this.page.locator('button[id="appls.add"]')
|
||||
spaceSelector = (): Locator => this.page.locator('[id="space.selector"]')
|
||||
searchInput = (): Locator => this.page.locator('[placeholder="Search..."]')
|
||||
hrInterviewButton = (): Locator =>
|
||||
this.page.locator('[id="recruit:string:CreateApplication"] button:has-text("HR Interview")')
|
||||
|
||||
readonly createButton = (): Locator => this.page.locator('button:has-text("Create")')
|
||||
readonly assignedRecruiterButton = (): Locator => this.page.locator('button:has-text("Assigned recruiter")')
|
||||
readonly chenRosamundButton = (): Locator => this.page.locator('button:has-text("Chen Rosamund")')
|
||||
readonly vacancyApplicatio = (vacancyId: string): Locator =>
|
||||
this.page.locator(`tr:has-text("${vacancyId}") >> text=APP-`)
|
||||
createButton = (): Locator => this.page.locator('button:has-text("Create")')
|
||||
assignedRecruiterButton = (): Locator => this.page.locator('button:has-text("Assigned recruiter")')
|
||||
chenRosamundButton = (): Locator => this.page.locator('button:has-text("Chen Rosamund")')
|
||||
vacancyApplicatio = (vacancyId: string): Locator => this.page.locator(`tr:has-text("${vacancyId}") >> text=APP-`)
|
||||
|
||||
readonly recruitApplicationButton = (): Locator =>
|
||||
this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
recruitApplicationButton = (): Locator => this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
|
||||
readonly talentsTab = (): Locator => this.page.locator('text=Talents')
|
||||
readonly newTalentButton = (): Locator => this.page.locator('button:has-text("New Talent")')
|
||||
readonly addSocialLinksButton = (): Locator => this.page.locator('[id="presentation\\:string\\:AddSocialLinks"]')
|
||||
readonly emailSelectorButton = (): Locator => this.page.locator('.antiPopup').locator('text=Email')
|
||||
readonly confirmEmailButton = (): Locator => this.page.locator('#channel-ok.antiButton')
|
||||
readonly createTalentButton = (): Locator => this.page.locator('.antiCard button:has-text("Create")')
|
||||
readonly popupPanel = (): Locator => this.page.locator('.popupPanel')
|
||||
talentsTab = (): Locator => this.page.locator('text=Talents')
|
||||
newTalentButton = (): Locator => this.page.locator('button:has-text("New Talent")')
|
||||
addSocialLinksButton = (): Locator => this.page.locator('[id="presentation\\:string\\:AddSocialLinks"]')
|
||||
emailSelectorButton = (): Locator => this.page.locator('.antiPopup').locator('text=Email')
|
||||
confirmEmailButton = (): Locator => this.page.locator('#channel-ok.antiButton')
|
||||
createTalentButton = (): Locator => this.page.locator('.antiCard button:has-text("Create")')
|
||||
popupPanel = (): Locator => this.page.locator('.popupPanel')
|
||||
talentsLink = (): Locator => this.page.locator('text=Talents')
|
||||
firstNameInput = (): Locator => this.page.locator('[placeholder="First name"]')
|
||||
lastNameInput = (): Locator => this.page.locator('[placeholder="Last name"]')
|
||||
skillsButton = (): Locator => this.page.locator('button:has-text("Skills")')
|
||||
addSkillButton = (): Locator => this.page.locator('.header > button:nth-child(3)')
|
||||
skillTitleInput = (): Locator => this.page.getByPlaceholder('Please type title')
|
||||
createSkillInput = (): Locator => this.page.getByPlaceholder('Please type skill title')
|
||||
|
||||
createSkillButton = (): Locator => this.page.locator('form[id="tags:string:AddTag"] button:has-text("Create")')
|
||||
selectSkillButton = (skillName: string): Locator => this.page.locator(`button:has-text("${skillName}") .check`)
|
||||
createCandidateButton = (): Locator => this.page.locator('button:has-text("Create")')
|
||||
openOtherSkills = (): Locator => this.page.getByText('Other')
|
||||
skillsLink = (): Locator => this.page.locator('text=Skills')
|
||||
newSkillButton = (): Locator => this.page.locator('button:has-text("Skill")')
|
||||
|
||||
async clickAddApplication (): Promise<void> {
|
||||
await this.addApplicationButton().click()
|
||||
@ -208,4 +219,91 @@ export class TalentsPage extends CommonRecruitingPage {
|
||||
await this.inputSearchTalent().press('Enter')
|
||||
await expect(this.page.locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })).toBeVisible()
|
||||
}
|
||||
|
||||
async navigateToPage (workspaceUrl: string): Promise<void> {
|
||||
const response = await this.page.goto(workspaceUrl)
|
||||
if (response === null || response === undefined) {
|
||||
throw new Error(`Failed to navigate to ${workspaceUrl}`)
|
||||
}
|
||||
await response.finished()
|
||||
}
|
||||
|
||||
async openRecruitApplication (): Promise<void> {
|
||||
await this.recruitApplicationButton().click()
|
||||
}
|
||||
|
||||
async selectTalentsSection (PlatformURI: string): Promise<void> {
|
||||
await this.talentsLink().click()
|
||||
await expect(this.page).toHaveURL(PlatformURI)
|
||||
}
|
||||
|
||||
// async createNewTalent(firstName: string, lastName: string): Promise<void> {
|
||||
// await this.newTalentButton().click();
|
||||
// await this.firstNameInput().fill(firstName);
|
||||
// await this.lastNameInput().click();
|
||||
// await this.lastNameInput().fill(lastName);
|
||||
// }
|
||||
|
||||
async inputNewTallent (firstName: string, lastName: string): Promise<void> {
|
||||
await this.newTalentButton().click()
|
||||
await this.firstNameInput().fill(firstName)
|
||||
await this.lastNameInput().click()
|
||||
await this.lastNameInput().fill(lastName)
|
||||
}
|
||||
|
||||
async addSkill (skillName: string): Promise<void> {
|
||||
await this.skillsButton().click()
|
||||
await this.addSkillButton().click()
|
||||
await this.skillTitleInput().fill(skillName)
|
||||
await this.createSkillButton().click()
|
||||
await this.page.waitForSelector('form[id="tags:string:AddTag"]', { state: 'detached' })
|
||||
}
|
||||
|
||||
async clickOpenOtherSkills (): Promise<void> {
|
||||
await this.openOtherSkills().click()
|
||||
}
|
||||
|
||||
async selectSkill (skillName: string): Promise<void> {
|
||||
await this.selectSkillButton(skillName).click()
|
||||
await this.page.keyboard.press('Escape')
|
||||
}
|
||||
|
||||
async createCandidate (): Promise<void> {
|
||||
await this.createCandidateButton().click()
|
||||
await this.page.waitForSelector('form.antiCard', { state: 'detached' })
|
||||
}
|
||||
|
||||
async clickSkillsLink (): Promise<void> {
|
||||
await this.skillsLink().click()
|
||||
}
|
||||
|
||||
async createSkill (PlatformURI: string, skillName: string): Promise<void> {
|
||||
await expect(this.page).toHaveURL(PlatformURI)
|
||||
await this.newSkillButton().click()
|
||||
await this.createSkillInput().click()
|
||||
await this.createSkillInput().fill(skillName)
|
||||
await this.createSkillButton().click()
|
||||
await this.page.waitForSelector('form.antiCard', { state: 'detached' })
|
||||
}
|
||||
|
||||
async createCandidateWithSkills (firstName: string, lastName: string, skills: string[]): Promise<void> {
|
||||
await this.talentsLink().click()
|
||||
await this.newTalentButton().click()
|
||||
await this.firstNameInput().click()
|
||||
await this.firstNameInput().fill(firstName)
|
||||
await this.lastNameInput().click()
|
||||
await this.lastNameInput().fill(lastName)
|
||||
await this.skillsButton().click()
|
||||
await this.clickOpenOtherSkills()
|
||||
for (const skill of skills) {
|
||||
await this.page.click(`text=${skill}`)
|
||||
}
|
||||
await this.page.keyboard.press('Escape')
|
||||
await this.createCandidateButton().click()
|
||||
await this.page.waitForSelector('form.antiCard', { state: 'detached' })
|
||||
await this.page.click(`tr > :has-text("${lastName} ${firstName}")`)
|
||||
for (const skill of skills) {
|
||||
await expect(this.page.locator(`text=${skill}`).first()).toBeVisible()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,17 @@ export class TemplatePage extends CommonTrackerPage {
|
||||
filteredTemplateLocator = (templateName: string): Locator =>
|
||||
this.page.locator('span.issuePresenterRoot > span').filter({ hasText: templateName })
|
||||
|
||||
profileButton = (): Locator => this.page.locator('#profile-button')
|
||||
settingsButton = (): Locator => this.page.locator('button:has-text("Settings")')
|
||||
notificationsButton = (): Locator => this.page.getByRole('button', { name: 'Notifications' })
|
||||
textTemplatesLink = (): Locator => this.page.locator('text="Text Templates"')
|
||||
createTemplateButton = (): Locator => this.page.locator('#create-template')
|
||||
newTemplateInput = (): Locator => this.page.locator('[placeholder="New\\ template"]')
|
||||
proseMirrorEditor = (): Locator => this.page.locator('.ProseMirror')
|
||||
saveTemplateButton = (): Locator => this.page.locator('text=Save template')
|
||||
editTemplateButton = (): Locator => this.page.locator('text=Edit template')
|
||||
vacanciesLink = (): Locator => this.page.locator('#new-space-type')
|
||||
|
||||
async createNewTemplate (data: NewIssue): Promise<void> {
|
||||
await this.buttonNewTemplate().click()
|
||||
|
||||
@ -77,4 +88,47 @@ export class TemplatePage extends CommonTrackerPage {
|
||||
async checkTemplateNotExist (templateName: string): Promise<void> {
|
||||
await expect(this.filteredTemplateLocator(templateName)).toHaveCount(0)
|
||||
}
|
||||
|
||||
async navigateToWorkspace (workspaceUrl: string): Promise<void> {
|
||||
const response = await this.page.goto(workspaceUrl)
|
||||
if (response === null || response === undefined) {
|
||||
throw new Error(`Failed to navigate to ${workspaceUrl}`)
|
||||
}
|
||||
await response.finished()
|
||||
}
|
||||
|
||||
async openProfileMenu (): Promise<void> {
|
||||
await this.profileButton().click()
|
||||
}
|
||||
|
||||
async openSettings (): Promise<void> {
|
||||
await this.settingsButton().click()
|
||||
}
|
||||
|
||||
async goToNotifications (): Promise<void> {
|
||||
await this.notificationsButton().click()
|
||||
}
|
||||
|
||||
async selectTextTemplates (): Promise<void> {
|
||||
await this.textTemplatesLink().click()
|
||||
}
|
||||
|
||||
async selectVacancies (): Promise<void> {
|
||||
await this.vacanciesLink().click()
|
||||
}
|
||||
|
||||
async createTemplate (templateName: string, templateContent: string): Promise<void> {
|
||||
await this.createTemplateButton().click()
|
||||
await this.newTemplateInput().fill(templateName)
|
||||
await this.proseMirrorEditor().fill(templateContent)
|
||||
await this.proseMirrorEditor().press('Enter')
|
||||
await this.proseMirrorEditor().fill('some more value')
|
||||
await this.saveTemplateButton().click()
|
||||
}
|
||||
|
||||
async editTemplate (newContent: string): Promise<void> {
|
||||
await this.editTemplateButton().click()
|
||||
await this.proseMirrorEditor().fill(newContent)
|
||||
await this.saveTemplateButton().click()
|
||||
}
|
||||
}
|
||||
|
@ -1,89 +1,50 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
import { test } from '@playwright/test'
|
||||
import { PlatformSetting, PlatformURI } from './utils'
|
||||
import { UserProfilePage } from './model/profile/user-profile-page'
|
||||
import { TemplatePage } from './model/tracker/templates-page'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
})
|
||||
test.describe('contact tests', () => {
|
||||
let userProfilePage: UserProfilePage
|
||||
let templatePage: TemplatePage
|
||||
const platformUri = `${PlatformURI}/workbench/sanity-ws`
|
||||
const expectedProfileUrl = `${PlatformURI}/workbench/sanity-ws/setting/profile`
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
userProfilePage = new UserProfilePage(page)
|
||||
templatePage = new TemplatePage(page)
|
||||
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()
|
||||
// Click #profile-button
|
||||
await page.click('#profile-button')
|
||||
await page.click('text=Appleseed John')
|
||||
// await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/setting/setting`)
|
||||
// Click text=Edit profile
|
||||
// await page.click('text=Edit profile')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/setting/profile`)
|
||||
|
||||
// Click [placeholder="Location"]
|
||||
await page.click('[placeholder="Location"]')
|
||||
// Fill [placeholder="Location"]
|
||||
await page.fill('[placeholder="Location"]', 'LoPlaza')
|
||||
// Click .flex-center.icon-button
|
||||
|
||||
if ((await page.locator('[id="contact:string:Phone"]').count()) === 0) {
|
||||
await page.click('[id="presentation:string:AddSocialLinks"]')
|
||||
await page.click('.popup button:has-text("Phone")')
|
||||
} else {
|
||||
await page.click('id=contact:string:Phone')
|
||||
}
|
||||
await page.fill('[placeholder="+1 555 333 7777"]', '+1 555 333 7777')
|
||||
// Click text=Apply
|
||||
await page.click('.editor-container button:nth-child(3)')
|
||||
test('update-profile', async () => {
|
||||
await userProfilePage.gotoProfile(platformUri)
|
||||
await userProfilePage.openProfileMenu()
|
||||
await userProfilePage.selectProfileByName('Appleseed John')
|
||||
await userProfilePage.verifyProfilePageUrl(expectedProfileUrl)
|
||||
await userProfilePage.updateLocation('LoPlaza')
|
||||
await userProfilePage.addOrEditPhone()
|
||||
await userProfilePage.applyChanges()
|
||||
})
|
||||
|
||||
test('create-template', async ({ page }) => {
|
||||
// Go to http://localhost:8083/workbench/sanity-ws
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
// Click #profile-button
|
||||
await page.click('#profile-button')
|
||||
// Click button:has-text("Settings")
|
||||
// await page.hover('button:has-text("Settings")')
|
||||
await page.click('button:has-text("Settings")')
|
||||
// Click text=Workspace Notifications >> button
|
||||
// await page.click('.box > div:nth-child(4)')
|
||||
await page.getByRole('button', { name: 'Notifications' }).click()
|
||||
await page.click('text="Text Templates"')
|
||||
// Click .flex-center.icon-button
|
||||
await page.click('#create-template')
|
||||
// Click [placeholder="New\ template"]
|
||||
// await page.click('[placeholder="New\\ template"]')
|
||||
// Fill [placeholder="New\ template"]
|
||||
await page.fill('[placeholder="New\\ template"]', 't1')
|
||||
|
||||
await page.fill('.ProseMirror', 'some text value')
|
||||
await page.press('.ProseMirror', 'Enter')
|
||||
await page.fill('.ProseMirror', 'some more value')
|
||||
|
||||
// Click text=Save template
|
||||
await page.click('text=Save template')
|
||||
// Click text=Edit template
|
||||
await page.click('text=Edit template')
|
||||
// Click text=Template valuesome more value
|
||||
await page.fill('.ProseMirror', 'some more2 value')
|
||||
// Click text=Save template
|
||||
await page.click('text=Save template')
|
||||
// Click text=Edit template
|
||||
test('create-template', async () => {
|
||||
await templatePage.navigateToWorkspace(platformUri)
|
||||
await templatePage.openProfileMenu()
|
||||
await templatePage.openSettings()
|
||||
await templatePage.goToNotifications()
|
||||
await templatePage.selectTextTemplates()
|
||||
await templatePage.createTemplate('t1', 'some text value')
|
||||
await templatePage.editTemplate('some more2 value')
|
||||
})
|
||||
|
||||
test('manage-templates', async ({ page }) => {
|
||||
// Go to http://localhost:8083/workbench/sanity-ws
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
// Click #profile-button
|
||||
await page.click('#profile-button')
|
||||
// await page.click('text=Workspace')
|
||||
// await page.hover('button:has-text("Settings")')
|
||||
await page.click('button:has-text("Settings")')
|
||||
// Click text=Workspace Notifications >> button
|
||||
// await page.click('.box > div:nth-child(4)')
|
||||
await page.getByRole('button', { name: 'Notifications' }).click()
|
||||
// Click text=Vacancies
|
||||
await page.locator('#new-space-type').click()
|
||||
test('manage-templates', async () => {
|
||||
await templatePage.navigateToWorkspace(platformUri)
|
||||
await templatePage.openProfileMenu()
|
||||
await templatePage.openSettings()
|
||||
await templatePage.goToNotifications()
|
||||
await templatePage.selectVacancies()
|
||||
|
||||
// TODO: Need rework.
|
||||
// await page.getByRole('button', { name: 'Recruiting', exact: true }).click()
|
||||
// await page.locator('#navGroup-statuses').getByText('New Recruiting project type').first().click()
|
||||
|
@ -1,113 +1,48 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
import { test } from '@playwright/test'
|
||||
import { generateId, PlatformSetting, PlatformURI } from './utils'
|
||||
import { TalentsPage } from './model/recruiting/talents-page'
|
||||
import { faker } from '@faker-js/faker'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
})
|
||||
|
||||
test.describe('recruit tests', () => {
|
||||
let talentPage: TalentsPage
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
talentPage = new TalentsPage(page)
|
||||
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()
|
||||
// Click [id="app-recruit\:string\:RecruitApplication"]
|
||||
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit`)
|
||||
// Click text=Talents
|
||||
await page.click('text=Talents')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit/talents`)
|
||||
// Click button:has-text("Talent")
|
||||
await page.click('button:has-text("Talent")')
|
||||
// Fill [placeholder="John"]
|
||||
await page.fill('[placeholder="First name"]', 'Petr')
|
||||
// Click [placeholder="Appleseed"]
|
||||
await page.click('[placeholder="Last name"]')
|
||||
// Fill [placeholder="Appleseed"]
|
||||
await page.fill('[placeholder="Last name"]', 'Dooliutl')
|
||||
// Click .ml-4 .tooltip-trigger .flex-center
|
||||
await page.click('button:has-text("Skills")')
|
||||
// Click text=Add/Create Skill Suggested Cancel >> button
|
||||
await page.click('.header > button:nth-child(3)')
|
||||
// Fill [placeholder="Please\ type\ Skill\ title"]
|
||||
await page.fill('[placeholder="Please\\ type\\ \\ title"]', 's1')
|
||||
// Click text=Create Skill s1 Please type description here Category Other Create Cancel >> button
|
||||
await page.click('form[id="tags:string:AddTag"] button:has-text("Create")')
|
||||
await page.waitForSelector('form[id="tags:string:AddTag"]', { state: 'detached' })
|
||||
await page.click('button:has-text("Other")')
|
||||
// Click text=s1
|
||||
// await page.click('text=s1')
|
||||
await page.click('button:has-text("s1") .check')
|
||||
// Click :nth-match(:text("Cancel"), 2)
|
||||
// await page.click('button:has-text("Cancel")')
|
||||
await page.keyboard.press('Escape')
|
||||
// await page.keyboard.press('Escape')
|
||||
// Click button:has-text("Create")
|
||||
await page.click('button:has-text("Create")')
|
||||
await page.waitForSelector('form.antiCard', { state: 'detached' })
|
||||
test('create-skill-candidate-with-skill', async () => {
|
||||
const platformUri = `${PlatformURI}/workbench/sanity-ws`
|
||||
const randomSkill = faker.string.alpha(5)
|
||||
|
||||
await talentPage.navigateToPage(platformUri)
|
||||
await talentPage.openRecruitApplication()
|
||||
await talentPage.selectTalentsSection(platformUri + '/recruit/talents')
|
||||
await talentPage.inputNewTallent('Petr', 'Dooliutl')
|
||||
await talentPage.addSkill(randomSkill)
|
||||
await talentPage.clickOpenOtherSkills()
|
||||
await talentPage.selectSkill(randomSkill)
|
||||
await talentPage.createCandidate()
|
||||
})
|
||||
|
||||
test('create-tag-candidate', async ({ page }) => {
|
||||
// Go to http://localhost:8083/workbench/sanity-ws
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
// Click [id="app-recruit\:string\:RecruitApplication"]
|
||||
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit`)
|
||||
// Click text=Skills
|
||||
await page.click('text=Skills')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit/skills`)
|
||||
// Click button:has-text("Skill")
|
||||
await page.click('button:has-text("Skill")')
|
||||
// Click [placeholder="Please\ type\ skill\ title"]
|
||||
await page.click('[placeholder="Please\\ type\\ skill\\ title"]')
|
||||
// Fill [placeholder="Please\ type\ skill\ title"]
|
||||
await page.fill('[placeholder="Please\\ type\\ skill\\ title"]', 'java')
|
||||
// Click button:has-text("Create")
|
||||
await page.click('button:has-text("Create")')
|
||||
// Click button:has-text("Skill")
|
||||
await page.click('button:has-text("Skill")')
|
||||
// Fill [placeholder="Please\ type\ skill\ title"]
|
||||
await page.fill('[placeholder="Please\\ type\\ skill\\ title"]', 'MongoDB')
|
||||
// Click button:has-text("Create")
|
||||
await page.click('button:has-text("Create")')
|
||||
// Click button:has-text("Skill")
|
||||
await page.click('button:has-text("Skill")')
|
||||
// Fill [placeholder="Please\ type\ skill\ title"]
|
||||
await page.fill('[placeholder="Please\\ type\\ skill\\ title"]', 'C++')
|
||||
// Click button:has-text("Create")
|
||||
await page.click('button:has-text("Create")')
|
||||
await page.waitForSelector('form.antiCard', { state: 'detached' })
|
||||
// Click text=Talents
|
||||
await page.click('text=Talents')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit/talents`)
|
||||
// Click button:has-text("Talent")
|
||||
await page.click('button:has-text("Talent")')
|
||||
// Click #add-tag div div
|
||||
await page.click('button:has-text("Skills")')
|
||||
await page.click('button:has-text("Backend development")')
|
||||
// Click text=java
|
||||
await page.click('text=java')
|
||||
// Click :nth-match(:text("Cancel"), 2)
|
||||
// await page.click('button:has-text("Cancel")')
|
||||
await page.keyboard.press('Escape')
|
||||
// Click [placeholder="John"]
|
||||
await page.click('[placeholder="First name"]')
|
||||
// Fill [placeholder="John"]
|
||||
const first = 'first-' + generateId(4)
|
||||
await page.fill('[placeholder="First name"]', first)
|
||||
// Click [placeholder="Appleseed"]
|
||||
await page.click('[placeholder="Last name"]')
|
||||
// Fill [placeholder="Appleseed"]
|
||||
const last = 'last-' + generateId(4)
|
||||
await page.fill('[placeholder="Last name"]', last)
|
||||
// Click button:has-text("Create")
|
||||
await page.click('button:has-text("Create")')
|
||||
await page.waitForSelector('form.antiCard', { state: 'detached' })
|
||||
// Click text=q w
|
||||
await page.click(`tr > :has-text("${last} ${first}")`)
|
||||
// Click text=java
|
||||
await expect(page.locator('text=java').first()).toBeVisible()
|
||||
const platformUri = `${PlatformURI}/workbench/sanity-ws`
|
||||
const randomSkill1 = faker.string.alpha(5)
|
||||
const randomSkill2 = faker.string.alpha(5)
|
||||
const randomSkill3 = faker.string.alpha(5)
|
||||
|
||||
await talentPage.navigateToPage(platformUri)
|
||||
await talentPage.openRecruitApplication()
|
||||
await talentPage.clickSkillsLink()
|
||||
await talentPage.createSkill(platformUri + '/recruit/skills', randomSkill1)
|
||||
await talentPage.createSkill(platformUri + '/recruit/skills', randomSkill2)
|
||||
await talentPage.createSkill(platformUri + '/recruit/skills', randomSkill3)
|
||||
const firstName = 'first-' + generateId(4)
|
||||
const lastName = 'last-' + generateId(4)
|
||||
await talentPage.createCandidateWithSkills(firstName, lastName, [randomSkill1, randomSkill2, randomSkill3])
|
||||
})
|
||||
})
|
||||
|
@ -1,56 +1,26 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
import { PlatformSetting, PlatformURI } from './utils'
|
||||
import { RecruitingPage } from './model/recruiting/recruiting-page'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
})
|
||||
test.describe('workbench tests', () => {
|
||||
let recruitingPage: RecruitingPage
|
||||
test.beforeEach(async ({ page }) => {
|
||||
recruitingPage = new RecruitingPage(page)
|
||||
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"]')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit`)
|
||||
// Click text=Applications
|
||||
await page.click('text=/^Applications/')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit/candidates`)
|
||||
// Click text=Applications Application >> span
|
||||
await expect(page.locator('text=Applications >> nth=1')).toBeVisible()
|
||||
expect(page.locator('text="APP-1')).toBeDefined()
|
||||
const platformUri = `${PlatformURI}/workbench/sanity-ws`
|
||||
|
||||
// Click text=Talents
|
||||
await page.click('text=Talents')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit/talents`)
|
||||
|
||||
await expect(page.locator('text=P. Andrey')).toBeVisible()
|
||||
|
||||
// Click text=Vacancies
|
||||
await page.click('text=Vacancies')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit/vacancies`)
|
||||
// Click text=Software Engineer
|
||||
await page.click('text=Software Engineer')
|
||||
await page.click('.antiSection-header >> text=Applications')
|
||||
expect(page.locator('text=Software Engineer')).toBeDefined()
|
||||
expect(page.locator('text="APP-1"')).toBeDefined()
|
||||
// await page.click('[name="tooltip-task:string:Kanban"]')
|
||||
await page.click('.tablist-container div:nth-child(2)')
|
||||
|
||||
// Click [id="app-chunter\:string\:ApplicationLabelChunter"]
|
||||
await page.click('[id="app-chunter\\:string\\:ApplicationLabelChunter"]')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/chunter`)
|
||||
|
||||
await page.click('text=general')
|
||||
|
||||
// Click .text-input
|
||||
await expect(page.locator('.text-input')).toBeVisible()
|
||||
|
||||
await page.click('[id="app-contact\\:string\\:Contacts"]')
|
||||
await page.click('.antiNav-element:has-text("Employee")')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/contact/employees`)
|
||||
// Click text=John Appleseed
|
||||
await expect(page.locator('text=Appleseed John')).toBeVisible()
|
||||
await recruitingPage.navigateToRecruitApplication(platformUri)
|
||||
await recruitingPage.openRecruitApplication()
|
||||
await recruitingPage.checkApplicationsVisibility()
|
||||
await recruitingPage.verifyTalentSection()
|
||||
await recruitingPage.navigateToVacanciesAndCheckSoftwareEngineer()
|
||||
await recruitingPage.navigateToGeneralChatAndContacts()
|
||||
})
|
||||
test('check-for-last-loc', async ({ page }) => {
|
||||
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { test, expect } from '@playwright/test'
|
||||
import { test } from '@playwright/test'
|
||||
import { LoginPage } from '../model/login-page'
|
||||
import { DefaultWorkspace, generateId, PlatformURI, PlatformUser } from '../utils'
|
||||
import { SelectWorkspacePage } from '../model/select-workspace-page'
|
||||
@ -12,7 +12,23 @@ import { TrackerNavigationMenuPage } from '../model/tracker/tracker-navigation-m
|
||||
import { SignInJoinPage } from '../model/signin-page'
|
||||
|
||||
test.describe('Workspace tests', () => {
|
||||
test('Create a workspace with a custom name', async ({ page }) => {
|
||||
let loginPage: LoginPage
|
||||
let signUpPage: SignUpPage
|
||||
let selectWorkspacePage: SelectWorkspacePage
|
||||
let leftSideMenuPage: LeftSideMenuPage
|
||||
let trackerNavigationMenuPage: TrackerNavigationMenuPage
|
||||
let issuesPage: IssuesPage
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
loginPage = new LoginPage(page)
|
||||
signUpPage = new SignUpPage(page)
|
||||
selectWorkspacePage = new SelectWorkspacePage(page)
|
||||
leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
|
||||
issuesPage = new IssuesPage(page)
|
||||
})
|
||||
|
||||
test('Create a workspace with a custom name', async () => {
|
||||
const newUser: SignUpData = {
|
||||
firstName: `FirstName-${generateId()}`,
|
||||
lastName: `LastName-${generateId()}`,
|
||||
@ -20,18 +36,10 @@ test.describe('Workspace tests', () => {
|
||||
password: '1234'
|
||||
}
|
||||
const newWorkspaceName = `New Workspace Name - ${generateId(2)}`
|
||||
|
||||
const loginPage = new LoginPage(page)
|
||||
await loginPage.goto()
|
||||
await loginPage.clickSignUp()
|
||||
|
||||
const signUpPage = new SignUpPage(page)
|
||||
await signUpPage.signUp(newUser)
|
||||
|
||||
const selectWorkspacePage = new SelectWorkspacePage(page)
|
||||
await selectWorkspacePage.createWorkspace(newWorkspaceName)
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.clickTracker()
|
||||
})
|
||||
|
||||
@ -57,24 +65,13 @@ test.describe('Workspace tests', () => {
|
||||
filePath: 'cat.jpeg'
|
||||
}
|
||||
const newWorkspaceName = `New Issue Name - ${generateId(2)}`
|
||||
|
||||
const loginPage = new LoginPage(page)
|
||||
await loginPage.goto()
|
||||
await loginPage.clickSignUp()
|
||||
|
||||
const signUpPage = new SignUpPage(page)
|
||||
await signUpPage.signUp(newUser)
|
||||
|
||||
const selectWorkspacePage = new SelectWorkspacePage(page)
|
||||
await selectWorkspacePage.createWorkspace(newWorkspaceName)
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.clickTracker()
|
||||
|
||||
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
|
||||
await trackerNavigationMenuPage.openIssuesForProject('Default')
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.clickModelSelectorAll()
|
||||
await issuesPage.createNewIssue(newIssue)
|
||||
await issuesPage.searchIssueByName(newIssue.title)
|
||||
@ -97,11 +94,9 @@ test.describe('Workspace tests', () => {
|
||||
}
|
||||
const newWorkspaceName = `New Workspace Name - ${generateId(2)}`
|
||||
|
||||
const loginPage = new LoginPage(page)
|
||||
await loginPage.goto()
|
||||
await loginPage.clickSignUp()
|
||||
|
||||
const signUpPage = new SignUpPage(page)
|
||||
await signUpPage.checkInfo(page, 'Required field First name')
|
||||
await signUpPage.enterFirstName(newUser.firstName)
|
||||
await signUpPage.checkInfo(page, 'Required field Last name')
|
||||
@ -114,7 +109,6 @@ test.describe('Workspace tests', () => {
|
||||
await signUpPage.enterRepeatPassword(newUser.password)
|
||||
await signUpPage.checkInfoSectionNotExist(page)
|
||||
await signUpPage.clickSignUp()
|
||||
const selectWorkspacePage = new SelectWorkspacePage(page)
|
||||
await selectWorkspacePage.checkInfo(page, 'Required field Workspace name')
|
||||
await selectWorkspacePage.enterWorkspaceName(newWorkspaceName)
|
||||
await selectWorkspacePage.checkInfoSectionNotExist(page)
|
||||
@ -128,32 +122,21 @@ test.describe('Workspace tests', () => {
|
||||
password: '1234'
|
||||
}
|
||||
const newWorkspaceName = `Some HULY #@$ WS - ${generateId(12)}`
|
||||
|
||||
const loginPage = new LoginPage(page)
|
||||
await loginPage.goto()
|
||||
await loginPage.clickSignUp()
|
||||
|
||||
const signUpPage = new SignUpPage(page)
|
||||
await signUpPage.signUp(newUser)
|
||||
|
||||
const selectWorkspacePage = new SelectWorkspacePage(page)
|
||||
await selectWorkspacePage.createWorkspace(newWorkspaceName)
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.clickTracker()
|
||||
|
||||
// Generate invite link
|
||||
|
||||
await page.click('#profile-button')
|
||||
await page.click('button:has-text("Invite to workspace")')
|
||||
await page.click('button:has-text("Get invite link")')
|
||||
await leftSideMenuPage.openProfileMenu()
|
||||
await leftSideMenuPage.inviteToWorkspace()
|
||||
await leftSideMenuPage.getInviteLink()
|
||||
|
||||
const linkText = await page.locator('.antiPopup .link').textContent()
|
||||
|
||||
const page2 = await browser.newPage()
|
||||
|
||||
await page2.goto(linkText ?? '')
|
||||
|
||||
const newUser2: SignUpData = {
|
||||
firstName: `FirstName2-${generateId()}`,
|
||||
lastName: `LastName2-${generateId()}`,
|
||||
@ -177,30 +160,19 @@ test.describe('Workspace tests', () => {
|
||||
password: '1234'
|
||||
}
|
||||
const newWorkspaceName = `Some HULY #@$ WS - ${generateId(12)}`
|
||||
|
||||
const loginPage = new LoginPage(page)
|
||||
await loginPage.goto()
|
||||
await loginPage.clickSignUp()
|
||||
|
||||
const signUpPage = new SignUpPage(page)
|
||||
await signUpPage.signUp(newUser)
|
||||
|
||||
const selectWorkspacePage = new SelectWorkspacePage(page)
|
||||
await selectWorkspacePage.createWorkspace(newWorkspaceName)
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.clickTracker()
|
||||
|
||||
// Generate invite link
|
||||
|
||||
await page.click('#profile-button')
|
||||
await page.click('button:has-text("Invite to workspace")')
|
||||
await page.click('button:has-text("Get invite link")')
|
||||
await leftSideMenuPage.openProfileMenu()
|
||||
await leftSideMenuPage.inviteToWorkspace()
|
||||
await leftSideMenuPage.getInviteLink()
|
||||
|
||||
const linkText = await page.locator('.antiPopup .link').textContent()
|
||||
|
||||
const page2 = await browser.newPage()
|
||||
|
||||
const loginPage2 = new LoginPage(page2)
|
||||
await loginPage2.goto()
|
||||
await loginPage2.clickSignUp()
|
||||
@ -216,9 +188,7 @@ test.describe('Workspace tests', () => {
|
||||
await signUpPage2.signUp(newUser2)
|
||||
|
||||
// Ok we signed in, and no workspace present.
|
||||
|
||||
await page2.goto(linkText ?? '')
|
||||
|
||||
const joinPage = new SignInJoinPage(page2)
|
||||
await joinPage.join(newUser2)
|
||||
|
||||
@ -227,32 +197,28 @@ test.describe('Workspace tests', () => {
|
||||
})
|
||||
|
||||
test('Create workspace with LastToken in the localStorage', async ({ page, browser }) => {
|
||||
const loginPage = new LoginPage(page)
|
||||
await loginPage.goto()
|
||||
await loginPage.login(PlatformUser, '1234')
|
||||
|
||||
const selectWorkspacePage = new SelectWorkspacePage(page)
|
||||
await selectWorkspacePage.selectWorkspace(DefaultWorkspace)
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.clickTracker()
|
||||
|
||||
const lastToken = await page.evaluate(() => localStorage.getItem('login:metadata:LastToken') ?? '')
|
||||
expect(lastToken).not.toEqual('')
|
||||
// Get and check the last token
|
||||
await leftSideMenuPage.verifyLastTokenNotEmpty()
|
||||
|
||||
await test.step('Check create workspace action', async () => {
|
||||
const newWorkspaceName = `Some HULY #@$ WS - ${generateId(12)}`
|
||||
const pageSecond = await browser.newPage()
|
||||
|
||||
await (await pageSecond.goto(`${PlatformURI}/login/login`))?.finished()
|
||||
await pageSecond.evaluate((lastToken) => {
|
||||
localStorage.setItem('login:metadata:LastToken', lastToken)
|
||||
}, lastToken)
|
||||
await (await pageSecond.goto(`${PlatformURI}/login/createWorkspace`))?.finished()
|
||||
// Authenticate in new browser context
|
||||
await pageSecond.goto(`${PlatformURI}/login/login`)
|
||||
await leftSideMenuPage.setLastTokenOnPage(pageSecond, await leftSideMenuPage.getLastToken())
|
||||
await pageSecond.goto(`${PlatformURI}/login/createWorkspace`)
|
||||
|
||||
// Create workspace in the second context
|
||||
const selectWorkspacePageSecond = new SelectWorkspacePage(pageSecond)
|
||||
await selectWorkspacePageSecond.createWorkspace(newWorkspaceName)
|
||||
|
||||
// Use the tracker in the second context
|
||||
const leftSideMenuPageSecond = new LeftSideMenuPage(pageSecond)
|
||||
await leftSideMenuPageSecond.clickTracker()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user