fix: more robust locators (#6796)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-10-03 20:43:39 +07:00 committed by GitHub
parent 4234931d82
commit 1ab7394695
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 12 deletions

View File

@ -11,7 +11,7 @@ export class CompanyDetailsPage extends CommonRecruitingPage {
}
readonly inputName = (): Locator => this.page.locator('div.antiEditBox input')
readonly buttonCompanyDetails = (): Locator => this.page.locator('div.flex-row-center > span', { hasText: 'Company' })
readonly buttonCompanyDetails = (): Locator => this.page.locator('.popupPanel-body__aside').locator('text=Company')
readonly buttonLocation = (): Locator =>
this.page.locator('//span[text()="Location"]/following-sibling::div[1]/button/span')

View File

@ -12,9 +12,11 @@ export class NavigationMenuPage {
readonly buttonMyApplications = (): Locator =>
this.page.locator('a[href$="my-applications"]', { hasText: 'My applications' })
readonly buttonTalents = (): Locator => this.page.locator('a[href$="talents"]', { hasText: 'Talents' })
readonly buttonVacancies = (): Locator => this.page.locator('a[href$="vacancies"]', { hasText: 'Vacancies' })
readonly buttonCompanies = (): Locator => this.page.locator('a[href$="organizations"]', { hasText: 'Companies' })
readonly navigator = (): Locator => this.page.locator('.antiPanel-navigator')
readonly buttonTalents = (): Locator => this.navigator().locator('a[href$="talents"]', { hasText: 'Talents' })
readonly buttonVacancies = (): Locator => this.navigator().locator('a[href$="vacancies"]', { hasText: 'Vacancies' })
readonly buttonCompanies = (): Locator =>
this.navigator().locator('a[href$="organizations"]', { hasText: 'Companies' })
// Action methods to click on each button
async clickButtonApplications (): Promise<void> {

View File

@ -8,8 +8,8 @@ export class RecruitingPage {
}
recruitApplication = (): Locator => this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]')
talentsNavElement = (): Locator => this.page.locator('text=Talents')
reviews = (): Locator => this.page.locator('text=Reviews')
talentsNavElement = (): Locator => this.page.locator('.antiPanel-navigator').locator('text=Talents')
reviews = (): Locator => this.page.locator('.antiPanel-navigator').locator('text=Reviews')
reviewButton = (): Locator => this.page.getByRole('button', { name: 'Review', exact: true })
frontendEngineerOption = (): Locator => this.page.locator('td:has-text("Frontend Engineer")')
@ -27,8 +27,8 @@ export class RecruitingPage {
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')
talentsLink = (): Locator => this.page.locator('.antiPanel-navigator').locator('text=Talents')
vacanciesLink = (): Locator => this.page.locator('.antiPanel-navigator').locator('text=Vacancies')
softwareEngineerLink = (): Locator => this.page.locator('text=Software Engineer')
applicationLabelChunterButton = (): Locator =>
this.page.locator('[id="app-chunter\\:string\\:ApplicationLabelChunter"]')

View File

@ -41,14 +41,14 @@ export class TalentsPage extends CommonRecruitingPage {
recruitApplicationButton = (): Locator => this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]')
talentsTab = (): Locator => this.page.locator('text=Talents')
talentsTab = (): Locator => this.page.locator('.antiPanel-navigator').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')
talentsLink = (): Locator => this.page.locator('.antiPanel-navigator').locator('text=Talents')
firstNameInput = (): Locator => this.page.locator('[placeholder="First name"]')
lastNameInput = (): Locator => this.page.locator('[placeholder="Last name"]')
skillsButton = (): Locator =>
@ -62,7 +62,7 @@ export class TalentsPage extends CommonRecruitingPage {
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')
skillsLink = (): Locator => this.page.locator('.antiPanel-navigator').locator('text=Skills')
newSkillButton = (): Locator => this.page.getByRole('button', { name: 'Skill', exact: true })
emailContact = (): Locator =>
this.page.locator('div[class^="popupPanel-body__header"] button[id="gmail:string:Email"]')

View File

@ -44,7 +44,7 @@ export class VacanciesPage extends CommonRecruitingPage {
readonly recruitApplicationButton = (): Locator =>
this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]')
readonly vacanciesMenuLink = (): Locator => this.page.locator('text=Vacancies')
readonly vacanciesMenuLink = (): Locator => this.page.locator('.antiPanel-navigator').locator('text=Vacancies')
readonly createVacancyButton = (): Locator => this.page.locator('button:has-text("Vacancy")')
readonly vacancyInputField = (): Locator => this.page.locator('form [placeholder="Software\\ Engineer"]')
readonly createButton = (): Locator => this.page.locator('form button:has-text("Create")')