Recruting test refactoring (#5473)

Signed-off-by: Jasmin <jasmin@hardcoreeng.com>
This commit is contained in:
JasminMus 2024-04-29 20:38:35 +02:00 committed by GitHub
parent 7d12548067
commit 7b0a8827ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 513 additions and 364 deletions

View File

@ -10,7 +10,15 @@ test.use({
}) })
// ADDED NEW // ADDED NEW
test.describe('Collaborative test for issue', () => { test.describe('Collaborative test for issue', () => {
let leftSideMenuPage: LeftSideMenuPage
let issuesPage: IssuesPage
let issuesDetailsPage: IssuesDetailsPage
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
leftSideMenuPage = new LeftSideMenuPage(page)
issuesPage = new IssuesPage(page)
issuesDetailsPage = new IssuesDetailsPage(page)
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() await (await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished()
}) })
@ -37,13 +45,11 @@ test.describe('Collaborative test for issue', () => {
// create a new issue by first user // create a new issue by first user
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() await (await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished()
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.clickTracker() await leftSideMenuPage.clickTracker()
const issuesPage = new IssuesPage(page)
await issuesPage.createNewIssue(newIssue) await issuesPage.createNewIssue(newIssue)
await issuesPage.linkSidebarAll().click() await issuesPage.clickLinkSidebarAll()
await issuesPage.modelSelectorAll().click() await issuesPage.clickModelSelectorAll()
await issuesPage.searchIssueByName(newIssue.title) await issuesPage.searchIssueByName(newIssue.title)
await issuesPage.openIssueByName(newIssue.title) await issuesPage.openIssueByName(newIssue.title)
@ -52,8 +58,8 @@ test.describe('Collaborative test for issue', () => {
await userSecondPage.evaluate(() => { await userSecondPage.evaluate(() => {
localStorage.setItem('platform.activity.threshold', '0') localStorage.setItem('platform.activity.threshold', '0')
}) })
await issuesPageSecond.linkSidebarAll().click() await issuesPageSecond.clickLinkSidebarAll()
await issuesPageSecond.modelSelectorAll().click() await issuesPageSecond.clickModelSelectorAll()
await issuesPageSecond.searchIssueByName(newIssue.title) await issuesPageSecond.searchIssueByName(newIssue.title)
await issuesPageSecond.openIssueByName(newIssue.title) await issuesPageSecond.openIssueByName(newIssue.title)
@ -84,25 +90,22 @@ test.describe('Collaborative test for issue', () => {
} }
const issuesPageSecond = new IssuesPage(userSecondPage) const issuesPageSecond = new IssuesPage(userSecondPage)
await issuesPageSecond.linkSidebarAll().click() await issuesPageSecond.clickLinkSidebarAll()
await issuesPageSecond.modelSelectorAll().click() await issuesPageSecond.clickModelSelectorAll()
// change status // change status
const issuesPage = new IssuesPage(page) await issuesPage.clickLinkSidebarAll()
await issuesPage.linkSidebarAll().click() await issuesPage.clickMdelSelectorBacklog()
await issuesPage.modelSelectorBacklog().click()
await issuesPage.searchIssueByName(issue.title) await issuesPage.searchIssueByName(issue.title)
await issuesPage.openIssueByName(issue.title) await issuesPage.openIssueByName(issue.title)
const issuesDetailsPage = new IssuesDetailsPage(page)
await issuesDetailsPage.editIssue({ status: 'In Progress' }) await issuesDetailsPage.editIssue({ status: 'In Progress' })
// check by another user // check by another user
await issuesPageSecond.modelSelectorBacklog().click() await issuesPageSecond.clickMdelSelectorBacklog()
// not active for another user // not active for another user
await issuesPageSecond.checkIssueNotExist(issue.title) await issuesPageSecond.checkIssueNotExist(issue.title)
await issuesPageSecond.modelSelectorActive().click() await issuesPageSecond.clickModalSelectorActive()
await issuesPageSecond.searchIssueByName(issue.title) await issuesPageSecond.searchIssueByName(issue.title)
await issuesPageSecond.openIssueByName(issue.title) await issuesPageSecond.openIssueByName(issue.title)
@ -134,13 +137,11 @@ test.describe('Collaborative test for issue', () => {
await test.step(`user1. change assignee to ${newAssignee}`, async () => { await test.step(`user1. change assignee to ${newAssignee}`, async () => {
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() await (await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished()
const issuesPage = new IssuesPage(page) await issuesPage.clickLinkSidebarAll()
await issuesPage.linkSidebarAll().click() await issuesPage.clickMdelSelectorBacklog()
await issuesPage.modelSelectorBacklog().click()
await issuesPage.searchIssueByName(issue.title) await issuesPage.searchIssueByName(issue.title)
await issuesPage.openIssueByName(issue.title) await issuesPage.openIssueByName(issue.title)
const issuesDetailsPage = new IssuesDetailsPage(page)
await issuesDetailsPage.editIssue({ assignee: newAssignee }) await issuesDetailsPage.editIssue({ assignee: newAssignee })
}) })
@ -158,8 +159,8 @@ test.describe('Collaborative test for issue', () => {
await test.step('user2. check issue assignee', async () => { await test.step('user2. check issue assignee', async () => {
const issuesPageSecond = new IssuesPage(userSecondPage) const issuesPageSecond = new IssuesPage(userSecondPage)
await issuesPageSecond.linkSidebarMyIssue().click() await issuesPageSecond.clickLinkSidebarMyIssue()
await issuesPageSecond.modelSelectorBacklog().click() await issuesPageSecond.clickMdelSelectorBacklog()
await issuesPageSecond.searchIssueByName(issue.title) await issuesPageSecond.searchIssueByName(issue.title)
await issuesPageSecond.openIssueByName(issue.title) await issuesPageSecond.openIssueByName(issue.title)

View File

@ -10,26 +10,28 @@ test.use({
}) })
// ADDED NEW // ADDED NEW
test.describe('Documents tests', () => { test.describe('Documents tests', () => {
let leftSideMenuPage: LeftSideMenuPage
let documentsPage: DocumentsPage
let documentContentPage: DocumentContentPage
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
leftSideMenuPage = new LeftSideMenuPage(page)
documentsPage = new DocumentsPage(page)
documentContentPage = new DocumentContentPage(page)
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
}) })
test('Create a document', async ({ page }) => { test('Create a document', async () => {
const newDocument: NewDocument = { const newDocument: NewDocument = {
title: `New Document-${generateId()}`, title: `New Document-${generateId()}`,
space: 'Default' space: 'Default'
} }
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.clickDocuments() await leftSideMenuPage.clickDocuments()
const documentsPage = new DocumentsPage(page)
await documentsPage.clickOnButtonCreateDocument() await documentsPage.clickOnButtonCreateDocument()
await documentsPage.createDocument(newDocument) await documentsPage.createDocument(newDocument)
await documentsPage.openDocument(newDocument.title) await documentsPage.openDocument(newDocument.title)
const documentContentPage = new DocumentContentPage(page)
await documentContentPage.checkDocumentTitle(newDocument.title) await documentContentPage.checkDocumentTitle(newDocument.title)
}) })
@ -41,25 +43,15 @@ test.describe('Documents tests', () => {
title: `Edit Document Title-${generateId()}`, title: `Edit Document Title-${generateId()}`,
space: 'Default' space: 'Default'
} }
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.clickDocuments() await leftSideMenuPage.clickDocuments()
const documentsPage = new DocumentsPage(page)
await documentsPage.clickOnButtonCreateDocument() await documentsPage.clickOnButtonCreateDocument()
await documentsPage.createDocument(editDocument) await documentsPage.createDocument(editDocument)
await documentsPage.openDocument(editDocument.title) await documentsPage.openDocument(editDocument.title)
const documentContentPage = new DocumentContentPage(page)
await documentContentPage.checkDocumentTitle(editDocument.title) await documentContentPage.checkDocumentTitle(editDocument.title)
let content = await documentContentPage.addContentToTheNewLine(contentOne) let content = await documentContentPage.addContentToTheNewLine(contentOne)
await documentContentPage.checkContent(content) await documentContentPage.checkContent(content)
content = await documentContentPage.addContentToTheNewLine(contentTwo) content = await documentContentPage.addContentToTheNewLine(contentTwo)
await documentContentPage.checkContent(content) await documentContentPage.checkContent(content)
await documentContentPage.updateDocumentTitle(newDocumentTitle) await documentContentPage.updateDocumentTitle(newDocumentTitle)
await documentContentPage.checkDocumentTitle(newDocumentTitle) await documentContentPage.checkDocumentTitle(newDocumentTitle)
}) })
@ -76,27 +68,18 @@ test.describe('Documents tests', () => {
private: false private: false
} }
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.clickDocuments() await leftSideMenuPage.clickDocuments()
const documentsPage = new DocumentsPage(page)
await documentsPage.checkTeamspaceNotExist(moveTeamspace.title) await documentsPage.checkTeamspaceNotExist(moveTeamspace.title)
await documentsPage.createNewTeamspace(moveTeamspace) await documentsPage.createNewTeamspace(moveTeamspace)
await documentsPage.checkTeamspaceExist(moveTeamspace.title) await documentsPage.checkTeamspaceExist(moveTeamspace.title)
await documentsPage.clickOnButtonCreateDocument() await documentsPage.clickOnButtonCreateDocument()
await documentsPage.createDocument(moveDocument) await documentsPage.createDocument(moveDocument)
await documentsPage.openDocument(moveDocument.title) await documentsPage.openDocument(moveDocument.title)
const documentContentPage = new DocumentContentPage(page)
await documentContentPage.checkDocumentTitle(moveDocument.title) await documentContentPage.checkDocumentTitle(moveDocument.title)
const content = await documentContentPage.addContentToTheNewLine(contentFirst) const content = await documentContentPage.addContentToTheNewLine(contentFirst)
await documentContentPage.checkContent(content) await documentContentPage.checkContent(content)
await documentsPage.moreActionsOnDocument(moveDocument.title, 'Move') await documentsPage.moreActionsOnDocument(moveDocument.title, 'Move')
await documentsPage.fillMoveDocumentForm(moveTeamspace.title) await documentsPage.fillMoveDocumentForm(moveTeamspace.title)
await documentsPage.openTeamspace(moveTeamspace.title) await documentsPage.openTeamspace(moveTeamspace.title)
await documentsPage.openDocumentForTeamspace(moveTeamspace.title, moveDocument.title) await documentsPage.openDocumentForTeamspace(moveTeamspace.title, moveDocument.title)
await documentContentPage.checkDocumentTitle(moveDocument.title) await documentContentPage.checkDocumentTitle(moveDocument.title)
@ -111,20 +94,13 @@ test.describe('Documents tests', () => {
space: 'Default' space: 'Default'
} }
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.clickDocuments() await leftSideMenuPage.clickDocuments()
const documentsPage = new DocumentsPage(page)
await documentsPage.openTeamspace(colDocument.space) await documentsPage.openTeamspace(colDocument.space)
await documentsPage.clickOnButtonCreateDocument() await documentsPage.clickOnButtonCreateDocument()
await documentsPage.createDocument(colDocument) await documentsPage.createDocument(colDocument)
await documentsPage.openDocument(colDocument.title) await documentsPage.openDocument(colDocument.title)
await test.step('User1. Add content first user', async () => { await test.step('User1. Add content first user', async () => {
const documentContentPage = new DocumentContentPage(page)
await documentContentPage.checkDocumentTitle(colDocument.title) await documentContentPage.checkDocumentTitle(colDocument.title)
content = await documentContentPage.addContentToTheNewLine(contentFirstUser) content = await documentContentPage.addContentToTheNewLine(contentFirstUser)
await documentContentPage.checkContent(content) await documentContentPage.checkContent(content)
}) })
@ -136,15 +112,12 @@ test.describe('Documents tests', () => {
const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage) const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage)
await leftSideMenuPageSecond.clickDocuments() await leftSideMenuPageSecond.clickDocuments()
const documentsPageSecond = new DocumentsPage(userSecondPage) const documentsPageSecond = new DocumentsPage(userSecondPage)
await documentsPageSecond.openTeamspace(colDocument.space) await documentsPageSecond.openTeamspace(colDocument.space)
await documentsPageSecond.openDocument(colDocument.title) await documentsPageSecond.openDocument(colDocument.title)
const documentContentPageSecond = new DocumentContentPage(page) const documentContentPageSecond = new DocumentContentPage(page)
await documentContentPageSecond.checkDocumentTitle(colDocument.title) await documentContentPageSecond.checkDocumentTitle(colDocument.title)
await documentContentPageSecond.checkContent(content) await documentContentPageSecond.checkContent(content)
content = await documentContentPageSecond.addContentToTheNewLine(contentSecondUser) content = await documentContentPageSecond.addContentToTheNewLine(contentSecondUser)
await documentContentPageSecond.checkContent(content) await documentContentPageSecond.checkContent(content)
} finally { } finally {
@ -154,7 +127,6 @@ test.describe('Documents tests', () => {
}) })
await test.step('User1. Check final content', async () => { await test.step('User1. Check final content', async () => {
const documentContentPage = new DocumentContentPage(page)
await documentContentPage.checkDocumentTitle(colDocument.title) await documentContentPage.checkDocumentTitle(colDocument.title)
await documentContentPage.checkContent(content) await documentContentPage.checkContent(content)
}) })
@ -167,22 +139,14 @@ test.describe('Documents tests', () => {
space: 'Default' space: 'Default'
} }
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.clickDocuments() await leftSideMenuPage.clickDocuments()
const documentsPage = new DocumentsPage(page)
await documentsPage.clickOnButtonCreateDocument() await documentsPage.clickOnButtonCreateDocument()
await documentsPage.createDocument(linkDocument) await documentsPage.createDocument(linkDocument)
await documentsPage.openDocument(linkDocument.title) await documentsPage.openDocument(linkDocument.title)
const documentContentPage = new DocumentContentPage(page)
await documentContentPage.checkDocumentTitle(linkDocument.title) await documentContentPage.checkDocumentTitle(linkDocument.title)
await documentContentPage.addRandomLines(5) await documentContentPage.addRandomLines(5)
await documentContentPage.addContentToTheNewLine(contentLink) await documentContentPage.addContentToTheNewLine(contentLink)
await documentContentPage.addRandomLines(5) await documentContentPage.addRandomLines(5)
await documentContentPage.addLinkToText(contentLink, 'test/link/123456') await documentContentPage.addLinkToText(contentLink, 'test/link/123456')
await documentContentPage.checkLinkInTheText(contentLink, 'test/link/123456') await documentContentPage.checkLinkInTheText(contentLink, 'test/link/123456')
}) })

View File

@ -9,7 +9,12 @@ test.use({
}) })
test.describe('Teamspace tests', () => { test.describe('Teamspace tests', () => {
let leftSideMenuPage: LeftSideMenuPage
let documentsPage: DocumentsPage
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
leftSideMenuPage = new LeftSideMenuPage(page)
documentsPage = new DocumentsPage(page)
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
}) })
@ -20,10 +25,7 @@ test.describe('Teamspace tests', () => {
private: false private: false
} }
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.clickDocuments() await leftSideMenuPage.clickDocuments()
const documentsPage = new DocumentsPage(page)
await documentsPage.checkTeamspaceNotExist(newTeamspace.title) await documentsPage.checkTeamspaceNotExist(newTeamspace.title)
await documentsPage.createNewTeamspace(newTeamspace) await documentsPage.createNewTeamspace(newTeamspace)
await documentsPage.checkTeamspaceExist(newTeamspace.title) await documentsPage.checkTeamspaceExist(newTeamspace.title)
@ -34,15 +36,10 @@ test.describe('Teamspace tests', () => {
title: 'Teamspace for archive' title: 'Teamspace for archive'
} }
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.clickDocuments() await leftSideMenuPage.clickDocuments()
const documentsPage = new DocumentsPage(page)
await documentsPage.checkTeamspaceExist(archiveTeamspace.title) await documentsPage.checkTeamspaceExist(archiveTeamspace.title)
await documentsPage.moreActionTeamspace(archiveTeamspace.title, 'Archive') await documentsPage.moreActionTeamspace(archiveTeamspace.title, 'Archive')
await documentsPage.pressYesForPopup(page) await documentsPage.pressYesForPopup(page)
await documentsPage.checkTeamspaceNotExist(archiveTeamspace.title) await documentsPage.checkTeamspaceNotExist(archiveTeamspace.title)
}) })
@ -58,18 +55,12 @@ test.describe('Teamspace tests', () => {
private: false private: false
} }
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.clickDocuments() await leftSideMenuPage.clickDocuments()
const documentsPage = new DocumentsPage(page)
await documentsPage.checkTeamspaceNotExist(editTeamspace.title) await documentsPage.checkTeamspaceNotExist(editTeamspace.title)
await documentsPage.createNewTeamspace(editTeamspace) await documentsPage.createNewTeamspace(editTeamspace)
await documentsPage.checkTeamspaceExist(editTeamspace.title) await documentsPage.checkTeamspaceExist(editTeamspace.title)
await documentsPage.moreActionTeamspace(editTeamspace.title, 'Edit teamspace') await documentsPage.moreActionTeamspace(editTeamspace.title, 'Edit teamspace')
await documentsPage.editTeamspace(updateEditTeamspace) await documentsPage.editTeamspace(updateEditTeamspace)
await documentsPage.moreActionTeamspace(updateEditTeamspace.title, 'Edit teamspace') await documentsPage.moreActionTeamspace(updateEditTeamspace.title, 'Edit teamspace')
await documentsPage.checkTeamspace(updateEditTeamspace) await documentsPage.checkTeamspace(updateEditTeamspace)
}) })

View File

@ -17,6 +17,8 @@ export class DocumentContentPage extends CommonPage {
this.page.locator('form[id="text-editor:string:Link"] button[type="submit"]') this.page.locator('form[id="text-editor:string:Link"] button[type="submit"]')
readonly buttonMoreActions = (): Locator => this.page.locator('div.popupPanel-title button#btn-doc-title-open-more') readonly buttonMoreActions = (): Locator => this.page.locator('div.popupPanel-title button#btn-doc-title-open-more')
readonly popupPanel = (): Locator => this.page.locator('div.popupPanel-title')
readonly popupPanelH1 = (): Locator => this.page.locator('div.antiPopup > h1')
async checkDocumentTitle (title: string): Promise<void> { async checkDocumentTitle (title: string): Promise<void> {
await expect(this.buttonDocumentTitle()).toHaveValue(title) await expect(this.buttonDocumentTitle()).toHaveValue(title)
@ -64,4 +66,8 @@ export class DocumentContentPage extends CommonPage {
await this.buttonMoreActions().click() await this.buttonMoreActions().click()
await this.selectFromDropdown(this.page, action) await this.selectFromDropdown(this.page, action)
} }
async checkIfPopupHasText (text: string): Promise<void> {
await expect(this.popupPanelH1()).toHaveText(text)
}
} }

View File

@ -25,6 +25,11 @@ export class ApplicationsPage extends CommonRecruitingPage {
readonly textTableFirstCell = (): Locator => this.page.locator('div[class$="firstCell"]') readonly textTableFirstCell = (): Locator => this.page.locator('div[class$="firstCell"]')
readonly buttonTypeSelector = (): Locator => this.page.locator('div[class*="header"] div[class*="title"] button') readonly buttonTypeSelector = (): Locator => this.page.locator('div[class*="header"] div[class*="title"] button')
// ACTIONS
async clickButtonTabCreated (): Promise<void> {
await this.buttonTabCreated().click()
}
async createNewApplication (data: NewApplication): Promise<void> { async createNewApplication (data: NewApplication): Promise<void> {
await this.buttonCreateApplication().click() await this.buttonCreateApplication().click()
await this.selectTalent(data.talentsName ?? 'first') await this.selectTalent(data.talentsName ?? 'first')

View File

@ -47,12 +47,64 @@ export class CommonRecruitingPage extends CalendarPage {
readonly newReviewTitle = (): Locator => readonly newReviewTitle = (): Locator =>
this.page.locator('div.popup form[id="recruit:string:CreateReviewParams"] input[placeholder="Title"]') this.page.locator('div.popup form[id="recruit:string:CreateReviewParams"] input[placeholder="Title"]')
readonly title = (): Locator => this.page.locator('[placeholder="Title"]')
readonly newReviewDescription = (): Locator => readonly newReviewDescription = (): Locator =>
this.page.locator('div.popup form[id="recruit:string:CreateReviewParams"] div.text-editor-view') this.page.locator('div.popup form[id="recruit:string:CreateReviewParams"] div.text-editor-view')
readonly submitNewReview = (): Locator => readonly submitNewReview = (): Locator =>
this.page.locator('div.popup form[id="recruit:string:CreateReviewParams"] button[type="submit"]') this.page.locator('div.popup form[id="recruit:string:CreateReviewParams"] button[type="submit"]')
readonly appleseedJohnButton = (): Locator => this.page.locator('button:has-text("Appleseed John")')
readonly chenRosamundButton = (): Locator => this.page.locator('button:has-text("Chen Rosamund")')
readonly searchInput = (): Locator => this.page.locator('[placeholder="Search\\.\\.\\."]')
readonly talentButton = (): Locator => this.page.locator('form button:has-text("Talent")')
readonly createButton = (): Locator => this.page.locator('button:has-text("Create")')
readonly reviewItemLink = (reviewId: string): Locator => this.page.locator(`tr:has-text('${reviewId}') td a`)
readonly twoMembersButton = (): Locator => this.page.locator('button:has-text("2 members")')
readonly chenRosamundPopupButton = (): Locator => this.page.locator('.popup button:has-text("Chen Rosamund")')
async clickOnTitle (): Promise<void> {
await this.title().click()
}
async fillTitle (title: string): Promise<void> {
await this.title().fill(title)
}
async clickAppleseedJohn (): Promise<void> {
await this.appleseedJohnButton().click()
}
async clickChenRosamund (): Promise<void> {
await this.chenRosamundButton().click()
}
async pressEscapeInSearch (): Promise<void> {
await this.searchInput().press('Escape')
}
async clickTalent (): Promise<void> {
await this.talentButton().click()
}
async createApplication (): Promise<void> {
await this.createButton().click()
await this.page.waitForSelector('form.antiCard', { state: 'detached' })
}
async selectReviewItem (reviewId: string): Promise<void> {
await this.reviewItemLink(reviewId).first().click()
}
async clickTwoMembers (): Promise<void> {
await this.twoMembersButton().click()
}
async clickChenRosamundInPopup (): Promise<void> {
await this.chenRosamundPopupButton().click()
}
async addComment (comment: string): Promise<void> { async addComment (comment: string): Promise<void> {
await this.inputComment().fill(comment) await this.inputComment().fill(comment)
await this.buttonSendComment().click() await this.buttonSendComment().click()

View File

@ -9,6 +9,9 @@ export class RecruitingPage {
readonly recruitApplication = (): Locator => this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]') readonly recruitApplication = (): Locator => this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]')
readonly talentsNavElement = (): Locator => this.page.locator('text=Talents') 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")')
readonly frontendEngineerOption = (): Locator => this.page.locator('td:has-text("Frontend Engineer")') readonly frontendEngineerOption = (): Locator => this.page.locator('td:has-text("Frontend Engineer")')
readonly searchOrRunCommandInput = (): Locator => readonly searchOrRunCommandInput = (): Locator =>
this.page.locator('[placeholder="Search\\ or\\ run\\ a\\ command\\.\\.\\."]') this.page.locator('[placeholder="Search\\ or\\ run\\ a\\ command\\.\\.\\."]')
@ -29,6 +32,14 @@ export class RecruitingPage {
await this.recruitApplication().click() await this.recruitApplication().click()
} }
async clickOnReviews (): Promise<void> {
await this.reviews().click()
}
async clickOnReviewButton (): Promise<void> {
await this.reviewButton().click()
}
async clickTalentsNavElement (): Promise<void> { async clickTalentsNavElement (): Promise<void> {
await this.talentsNavElement().click() await this.talentsNavElement().click()
} }

View File

@ -25,7 +25,8 @@ export class TalentDetailsPage extends CommonRecruitingPage {
readonly buttonPopupMergeContacts = (): Locator => readonly buttonPopupMergeContacts = (): Locator =>
this.page.locator('form[id="contact:string:MergePersons"] button > span', { hasText: 'Merge contacts' }) this.page.locator('form[id="contact:string:MergePersons"] button > span', { hasText: 'Merge contacts' })
readonly textAttachmentName = (): Locator => this.page.locator('div.name a') // Assuming this locator is also used appropriately readonly textAttachmentName = (): Locator => this.page.locator('div.name a')
readonly titleAndSourceTalent = (title: string): Locator => this.page.locator('button > span', { hasText: title })
async addSkill (skillTag: string, skillDescription: string): Promise<void> { async addSkill (skillTag: string, skillDescription: string): Promise<void> {
await this.buttonAddSkill().click() await this.buttonAddSkill().click()
@ -90,4 +91,10 @@ export class TalentDetailsPage extends CommonRecruitingPage {
await this.page.waitForSelector(`div[class*="header"] div.name:nth-child(2) :has-text("${applicationFirstName}")`) await this.page.waitForSelector(`div[class*="header"] div.name:nth-child(2) :has-text("${applicationFirstName}")`)
} }
} }
async checkMergeContacts (talentName: string, title: string, source: string): Promise<void> {
await expect(this.page.locator('div.location input')).toHaveValue(talentName)
await expect(this.titleAndSourceTalent(title)).toBeVisible()
await expect(this.titleAndSourceTalent(source)).toBeVisible()
}
} }

View File

@ -24,6 +24,147 @@ export class TalentsPage extends CommonRecruitingPage {
this.page.locator('form[id="recruit:string:VacancyMatching"] table > tbody > tr > td:nth-child(2)') 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 inputSearchTalent = (): Locator => this.page.locator('div[class*="header"] input')
readonly 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 =>
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-`)
readonly 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')
async clickAddApplication (): Promise<void> {
await this.addApplicationButton().click()
}
async selectSpace (): Promise<void> {
await this.spaceSelector().click()
}
async searchAndSelectVacancy (vacancyId: string): Promise<void> {
await this.searchInput().fill(vacancyId)
await this.page.click(`button:has-text("${vacancyId}")`)
await this.page.waitForSelector('space.selector', { state: 'detached' })
}
async waitForHRInterviewVisible (): Promise<void> {
await this.hrInterviewButton().isVisible()
}
async waitForTimeout (): Promise<void> {
await this.page.waitForTimeout(100)
}
async createApplication (): Promise<void> {
await this.createButton().click()
await this.page.waitForSelector('form.antiCard', { state: 'detached' })
}
async clickVacancyApplication (vacancyId: string): Promise<void> {
await this.vacancyApplicatio(vacancyId).click()
}
async assignRecruiter (): Promise<void> {
await this.assignedRecruiterButton().click()
}
async selectChenRosamund (): Promise<void> {
await this.chenRosamundButton().click()
}
async clickOnAndreyTalet (): Promise<void> {
await this.andreyTalet().click()
}
async clickRecruitApplication (): Promise<void> {
await this.recruitApplicationButton().click()
}
async clickTalentsTab (): Promise<void> {
await this.talentsTab().click()
}
async clickNewTalent (): Promise<void> {
await this.newTalentButton().click()
}
async enterFirstName (firstName: string): Promise<void> {
const input = this.page.locator('[placeholder="First name"]')
await input.click()
await input.fill(firstName)
}
async enterLastName (lastName: string): Promise<void> {
const input = this.page.locator('[placeholder="Last name"]')
await input.click()
await input.fill(lastName)
}
async enterTitle (title: string = 'Super Candidate'): Promise<void> {
const input = this.page.locator('[placeholder="Title"]')
await input.click()
await input.fill(title)
}
async enterLocation (location: string): Promise<void> {
const input = this.page.locator('[placeholder="Location"]')
await input.click()
await input.fill(location)
}
async addSocialLinks (): Promise<void> {
await this.addSocialLinksButton().click()
}
async selectEmail (): Promise<void> {
await this.emailSelectorButton().click()
}
async enterEmail (email: string): Promise<void> {
const input = this.page.locator('[placeholder="john\\.appleseed@apple\\.com"]')
await input.fill(email)
}
async confirmEmail (): Promise<void> {
await this.confirmEmailButton().click()
}
async createTalent (): Promise<void> {
await this.createTalentButton().click()
await this.page.waitForSelector('form.antiCard', { state: 'detached' })
}
async verifyTalentDetails (firstName: string, lastName: string, location: string): Promise<void> {
const fullName = `${lastName} ${firstName}`
await this.page.click(`text="${fullName}"`)
await expect(this.page.locator(`text=${firstName}`).first()).toBeVisible()
await expect(this.page.locator(`text=${lastName}`).first()).toBeVisible()
await expect(this.page.locator(`text=${location}`).first()).toBeVisible()
}
async verifyEmailInPopup (email: string): Promise<void> {
const emailLocator = this.popupPanel().locator('[id="gmail\\:string\\:Email"]')
await emailLocator.scrollIntoViewIfNeeded()
await emailLocator.click()
const actualEmail = await this.page.locator('.cover-channel >> input').inputValue()
expect(actualEmail).toEqual(email)
}
async createNewTalent (): Promise<TalentName> { async createNewTalent (): Promise<TalentName> {
const talentName: TalentName = { const talentName: TalentName = {

View File

@ -37,6 +37,87 @@ export class VacanciesPage extends CommonRecruitingPage {
readonly vacancyByName = (vacancyName: string): Locator => readonly vacancyByName = (vacancyName: string): Locator =>
this.page.locator('tr', { hasText: vacancyName }).locator('div[class$="firstCell"]') this.page.locator('tr', { hasText: vacancyName }).locator('div[class$="firstCell"]')
readonly vacancy = (): Locator => this.page.locator('has-text("Vacancy")')
readonly vacancyButton = (): Locator => this.page.locator('button:has-text("Vacancy")')
readonly softwareEngineerInput = (): Locator => this.page.locator('[placeholder="Software\\ Engineer"]')
readonly vacanciesCreateButton = (): Locator => this.page.locator('button:has-text("Create")')
readonly recruitApplicationButton = (): Locator =>
this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]')
readonly vacanciesMenuLink = (): Locator => this.page.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")')
readonly vacancyRow = (vacancyId: string): Locator =>
this.page.locator(`tr:has-text("${vacancyId}") > td:nth-child(3) >> .sm-tool-icon`)
readonly applicationButton = (): Locator => this.page.locator('button:has-text("Application")')
readonly talentSelector = (): Locator =>
this.page.locator('form[id="recruit:string:CreateApplication"] [id="vacancy.talant.selector"]')
readonly softwareEngineerLink = (): Locator => this.page.locator('text=Software Engineer')
readonly applicationsTabHeader = (): Locator => this.page.locator('.antiSection-header >> text=Applications')
readonly secondTab = (): Locator => this.page.getByText('Done states')
readonly applicantMarina = (): Locator => this.page.locator('text=M. Marina').first()
readonly applicantJohn = (): Locator => this.page.locator('text=Multiseed John').first()
readonly applicantAlex = (): Locator => this.page.locator('text=P. Alex').first()
async clickOnVacancy (): Promise<void> {
await this.vacanciesMenuLink().click()
}
async clickOnVacancyButton (): Promise<void> {
await this.vacancyButton().click()
}
async fillSoftwareEngineerInput (vacancyId: string): Promise<void> {
await this.softwareEngineerInput().fill(vacancyId)
}
async clickOnVacanciesCreateButton (): Promise<void> {
await this.vacanciesCreateButton().click()
}
async createVacancy (vacancyId: string): Promise<void> {
await this.recruitApplicationButton().click()
await this.vacanciesMenuLink().click()
await this.createVacancyButton().click()
await this.vacancyInputField().fill(vacancyId)
await this.createButton().click()
await this.page.waitForSelector('form.antiCard', { state: 'detached' })
}
async modifyVacancy (vacancyId: string): Promise<void> {
await this.vacancyRow(vacancyId).click()
}
async createApplicationVacencies (assigneeName: string): Promise<void> {
await this.applicationButton().click()
await this.talentSelector().click()
await this.selectAssignee(this.page, assigneeName)
await this.createButton().click()
await this.page.waitForSelector('form.antiCard', { state: 'detached' })
await expect(this.page.locator('text=APP-').first()).toBeVisible()
await expect(this.page.locator(`text=P. ${assigneeName}`).first()).toBeVisible()
}
async navigateToSoftwareEngineerVacancies (): Promise<void> {
await this.recruitApplicationButton().click()
await this.vacanciesMenuLink().click()
await this.softwareEngineerLink().click()
}
async selectApplicationsTab (): Promise<void> {
await this.applicationsTabHeader().click()
await this.secondTab().click()
}
async verifyApplicantsVisibility (): Promise<void> {
await expect(this.applicantMarina()).toBeVisible()
await expect(this.applicantJohn()).toBeVisible()
await expect(this.applicantAlex()).toBeVisible()
}
async createNewVacancy ({ title, description, location }: NewVacancy): Promise<void> { async createNewVacancy ({ title, description, location }: NewVacancy): Promise<void> {
await this.buttonCreateNewVacancy().click() await this.buttonCreateNewVacancy().click()

View File

@ -48,4 +48,16 @@ export class VacancyDetailsPage extends CommonRecruitingPage {
await this.buttonInputDueDate().click() await this.buttonInputDueDate().click()
await this.clickButtonDatePopupToday() await this.clickButtonDatePopupToday()
} }
async fillInputDescription (description: string): Promise<void> {
await this.inputDescription().fill(description)
}
async checkIfVacancyInputComentIsVisible (): Promise<void> {
await expect(this.inputComment()).toBeVisible()
}
async checkIfInputDescriptionHasText (description: string): Promise<void> {
await expect(this.inputDescription()).toHaveText(description)
}
} }

View File

@ -92,6 +92,28 @@ export class IssuesPage extends CommonTrackerPage {
commentCountLocator = (issueName: string): Locator => commentCountLocator = (issueName: string): Locator =>
this.commonAncestorForOperations(issueName).locator('button > div[slot="content"]').first() this.commonAncestorForOperations(issueName).locator('button > div[slot="content"]').first()
// ACTIONS
async clickLinkSidebarAll (): Promise<void> {
await this.linkSidebarAll().click()
}
async clickModelSelectorAll (): Promise<void> {
await this.modelSelectorAll().click()
}
async clickMdelSelectorBacklog (): Promise<void> {
await this.modelSelectorBacklog().click()
}
async clickModalSelectorActive (): Promise<void> {
await this.modelSelectorActive().click()
}
async clickLinkSidebarMyIssue (): Promise<void> {
await this.linkSidebarMyIssue().click()
}
async createNewIssue (data: NewIssue, closeNotification: boolean = false): Promise<void> { async createNewIssue (data: NewIssue, closeNotification: boolean = false): Promise<void> {
await this.buttonCreateNewIssue().click() await this.buttonCreateNewIssue().click()
await this.fillNewIssueForm(data) await this.fillNewIssueForm(data)

View File

@ -5,164 +5,131 @@ import { ApplicationsPage } from '../model/recruiting/applications-page'
import { ApplicationsDetailsPage } from '../model/recruiting/applications-details-page' import { ApplicationsDetailsPage } from '../model/recruiting/applications-details-page'
import { VacancyDetailsPage } from '../model/recruiting/vacancy-details-page' import { VacancyDetailsPage } from '../model/recruiting/vacancy-details-page'
import { VacanciesPage } from '../model/recruiting/vacancies-page' import { VacanciesPage } from '../model/recruiting/vacancies-page'
import { RecruitingPage } from '../model/recruiting/recruiting-page'
import { TalentsPage } from '../model/recruiting/talents-page'
test.use({ test.use({
storageState: PlatformSetting storageState: PlatformSetting
}) })
test.describe('Application tests', () => { test.describe('Application tests', () => {
let recrutingPage: RecruitingPage
let vacanciesPage: VacanciesPage
let vacancyDetailsPage: VacancyDetailsPage
let navigationMenuPage: NavigationMenuPage
let talentsPage: TalentsPage
let applicationsDetailsPage: ApplicationsDetailsPage
let applicationsPage: ApplicationsPage
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
recrutingPage = new RecruitingPage(page)
vacanciesPage = new VacanciesPage(page)
vacancyDetailsPage = new VacancyDetailsPage(page)
navigationMenuPage = new NavigationMenuPage(page)
talentsPage = new TalentsPage(page)
applicationsDetailsPage = new ApplicationsDetailsPage(page)
applicationsPage = new ApplicationsPage(page)
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
}) })
test('create application', async ({ page }) => { test('create application', async ({ page }) => {
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.waitForLoadState('load')
const vacancyId = 'My vacancy ' + generateId(4) const vacancyId = 'My vacancy ' + generateId(4)
await recrutingPage.clickRecruitApplication()
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click() await page.waitForLoadState('load')
await vacanciesPage.clickOnVacancy()
await page.locator('text=Vacancies').click() await vacanciesPage.clickOnVacancyButton()
await vacanciesPage.fillSoftwareEngineerInput(vacancyId)
await page.click('button:has-text("Vacancy")') await vacanciesPage.clickOnVacanciesCreateButton()
await page.fill('[placeholder="Software\\ Engineer"]', vacancyId)
await page.click('button:has-text("Create")')
const vacanciesPage = new VacanciesPage(page)
await vacanciesPage.openVacancyByName(vacancyId) await vacanciesPage.openVacancyByName(vacancyId)
const vacancyDetailsPage = new VacancyDetailsPage(page) await vacancyDetailsPage.checkIfVacancyInputComentIsVisible()
await expect(vacancyDetailsPage.inputComment()).toBeVisible()
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonTalents() await navigationMenuPage.clickButtonTalents()
await talentsPage.clickOnAndreyTalet()
await page.click('text=P. Andrey')
// Click on Add button // Click on Add button
// await page.click('.applications-container .flex-row-center .flex-center') // await page.click('.applications-container .flex-row-center .flex-center')
await page.click('button[id="appls.add"]') await talentsPage.clickAddApplication()
await talentsPage.selectSpace()
await page.click('[id = "space.selector"]') await talentsPage.searchAndSelectVacancy(vacancyId)
await talentsPage.waitForHRInterviewVisible()
await page.fill('[placeholder="Search..."]', vacancyId)
await page.click(`button:has-text("${vacancyId}")`)
await page.waitForSelector('space.selector', { state: 'detached' })
await expect(page.locator('[id="recruit:string:CreateApplication"] button:has-text("HR Interview")')).toBeVisible()
// We need to be sure state is proper one, no other way to do it. // We need to be sure state is proper one, no other way to do it.
await page.waitForTimeout(100) await page.waitForTimeout(100)
await talentsPage.createApplication()
await page.click('button:has-text("Create")') await talentsPage.clickVacancyApplication(vacancyId)
await page.waitForSelector('form.antiCard', { state: 'detached' }) await talentsPage.assignRecruiter()
await talentsPage.selectChenRosamund()
await page.click(`tr:has-text("${vacancyId}") >> text=APP-`) // ADD ASSERTION HERE
await page.click('button:has-text("Assigned recruiter")')
await page.click('button:has-text("Chen Rosamund")')
}) })
test.skip('Edit an Application', async ({ page }) => { test.skip('Edit an Application', async ({ page }) => {
const vacancyName = 'Edit an Application Vacancy ' + generateId(4) const vacancyName = 'Edit an Application Vacancy ' + generateId(4)
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonVacancies() await navigationMenuPage.clickButtonVacancies()
const vacanciesPage = new VacanciesPage(page)
await vacanciesPage.createNewVacancy({ await vacanciesPage.createNewVacancy({
title: vacancyName, title: vacancyName,
description: 'Vacancy description from Edit a Vacancy test', description: 'Vacancy description from Edit a Vacancy test',
location: 'Edit a Vacancy location' location: 'Edit a Vacancy location'
}) })
await navigationMenuPage.clickButtonApplications() await navigationMenuPage.clickButtonApplications()
const applicationsPage = new ApplicationsPage(page)
const talentName = await applicationsPage.createNewApplicationWithNewTalent({ const talentName = await applicationsPage.createNewApplicationWithNewTalent({
vacancy: vacancyName, vacancy: vacancyName,
recruiterName: 'first' recruiterName: 'first'
}) })
await applicationsPage.openApplicationByTalentName(talentName) await applicationsPage.openApplicationByTalentName(talentName)
const applicationsDetailsPage = new ApplicationsDetailsPage(page)
await applicationsDetailsPage.addComment('Test Comment 123') await applicationsDetailsPage.addComment('Test Comment 123')
await applicationsDetailsPage.checkCommentExist('Test Comment 123') await applicationsDetailsPage.checkCommentExist('Test Comment 123')
await applicationsDetailsPage.addAttachments('cat.jpeg') await applicationsDetailsPage.addAttachments('cat.jpeg')
await applicationsDetailsPage.addFirstReview('First Application Review', 'First Application review description') await applicationsDetailsPage.addFirstReview('First Application Review', 'First Application review description')
}) })
test('Change Done status', async ({ page }) => { test('Change Done status', async ({ page }) => {
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonApplications() await navigationMenuPage.clickButtonApplications()
let applicationsPage = new ApplicationsPage(page)
const talentName = await applicationsPage.createNewApplicationWithNewTalent({ const talentName = await applicationsPage.createNewApplicationWithNewTalent({
vacancy: 'first', vacancy: 'first',
recruiterName: 'first' recruiterName: 'first'
}) })
await applicationsPage.openApplicationByTalentName(talentName) await applicationsPage.openApplicationByTalentName(talentName)
let applicationsDetailsPage = new ApplicationsDetailsPage(page)
await applicationsDetailsPage.changeState('Lost') await applicationsDetailsPage.changeState('Lost')
await navigationMenuPage.clickButtonMyApplications() await navigationMenuPage.clickButtonMyApplications()
applicationsPage = new ApplicationsPage(page) await applicationsPage.clickButtonTabCreated()
await applicationsPage.buttonTabCreated().click()
await applicationsPage.checkApplicationState(talentName, 'Lost') await applicationsPage.checkApplicationState(talentName, 'Lost')
await applicationsPage.openApplicationByTalentName(talentName) await applicationsPage.openApplicationByTalentName(talentName)
applicationsDetailsPage = new ApplicationsDetailsPage(page)
await applicationsDetailsPage.changeState('Won') await applicationsDetailsPage.changeState('Won')
await navigationMenuPage.clickButtonMyApplications() await navigationMenuPage.clickButtonMyApplications()
applicationsPage = new ApplicationsPage(page) await applicationsPage.clickButtonTabCreated()
await applicationsPage.buttonTabCreated().click()
await applicationsPage.checkApplicationState(talentName, 'Won') await applicationsPage.checkApplicationState(talentName, 'Won')
}) })
test('Delete an Application', async ({ page }) => { test('Delete an Application', async ({ page }) => {
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonApplications() await navigationMenuPage.clickButtonApplications()
const applicationsPage = new ApplicationsPage(page)
const talentName = await applicationsPage.createNewApplicationWithNewTalent({ const talentName = await applicationsPage.createNewApplicationWithNewTalent({
vacancy: 'first', vacancy: 'first',
recruiterName: 'first' recruiterName: 'first'
}) })
await applicationsPage.openApplicationByTalentName(talentName) await applicationsPage.openApplicationByTalentName(talentName)
const applicationsDetailsPage = new ApplicationsDetailsPage(page)
const applicationId = await applicationsDetailsPage.getApplicationId() const applicationId = await applicationsDetailsPage.getApplicationId()
await applicationsDetailsPage.deleteEntity() await applicationsDetailsPage.deleteEntity()
expect(page.url()).toContain(applicationId) expect(page.url()).toContain(applicationId)
await navigationMenuPage.clickButtonApplications() await navigationMenuPage.clickButtonApplications()
await applicationsPage.checkApplicationNotExist(applicationId) await applicationsPage.checkApplicationNotExist(applicationId)
}) })
test('Change & Save all States', async ({ page }) => { test('Change & Save all States', async ({ page }) => {
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonApplications() await navigationMenuPage.clickButtonApplications()
const applicationsPage = new ApplicationsPage(page)
const talentName = await applicationsPage.createNewApplicationWithNewTalent({ const talentName = await applicationsPage.createNewApplicationWithNewTalent({
vacancy: 'first', vacancy: 'first',
recruiterName: 'first' recruiterName: 'first'
}) })
await applicationsPage.checkApplicationState(talentName, 'HR Interview') await applicationsPage.checkApplicationState(talentName, 'HR Interview')
await applicationsPage.openApplicationByTalentName(talentName) await applicationsPage.openApplicationByTalentName(talentName)
let applicationsDetailsPage = new ApplicationsDetailsPage(page)
await applicationsDetailsPage.changeState('Technical Interview') await applicationsDetailsPage.changeState('Technical Interview')
await navigationMenuPage.clickButtonApplications() await navigationMenuPage.clickButtonApplications()
await applicationsPage.checkApplicationState(talentName, 'Technical Interview') await applicationsPage.checkApplicationState(talentName, 'Technical Interview')
await applicationsPage.changeApplicationStatus(talentName, 'Test task') await applicationsPage.changeApplicationStatus(talentName, 'Test task')
await applicationsPage.checkApplicationState(talentName, 'Test task') await applicationsPage.checkApplicationState(talentName, 'Test task')
await applicationsPage.openApplicationByTalentName(talentName) await applicationsPage.openApplicationByTalentName(talentName)
applicationsDetailsPage = new ApplicationsDetailsPage(page)
await applicationsDetailsPage.changeState('Offer') await applicationsDetailsPage.changeState('Offer')
}) })
@ -170,28 +137,21 @@ test.describe('Application tests', () => {
const commentText = `Application comment should be stored after reload-${generateId()}` const commentText = `Application comment should be stored after reload-${generateId()}`
const vacancyName = 'Comment stored Vacancy ' + generateId(4) const vacancyName = 'Comment stored Vacancy ' + generateId(4)
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonVacancies() await navigationMenuPage.clickButtonVacancies()
const vacanciesPage = new VacanciesPage(page)
await vacanciesPage.createNewVacancy({ await vacanciesPage.createNewVacancy({
title: vacancyName, title: vacancyName,
description: 'Vacancy description from Edit a Vacancy test', description: 'Vacancy description from Edit a Vacancy test',
location: 'Edit a Vacancy location' location: 'Edit a Vacancy location'
}) })
await navigationMenuPage.clickButtonApplications() await navigationMenuPage.clickButtonApplications()
const applicationsPage = new ApplicationsPage(page)
const talentName = await applicationsPage.createNewApplicationWithNewTalent({ const talentName = await applicationsPage.createNewApplicationWithNewTalent({
vacancy: 'first', vacancy: 'first',
recruiterName: 'first' recruiterName: 'first'
}) })
await applicationsPage.openApplicationByTalentName(talentName) await applicationsPage.openApplicationByTalentName(talentName)
const applicationsDetailsPage = new ApplicationsDetailsPage(page)
const applicationId = await applicationsDetailsPage.getApplicationId() const applicationId = await applicationsDetailsPage.getApplicationId()
await applicationsDetailsPage.addComment(commentText) await applicationsDetailsPage.addComment(commentText)
await applicationsDetailsPage.checkCommentExist(commentText) await applicationsDetailsPage.checkCommentExist(commentText)
await page.reload() await page.reload()
await applicationsDetailsPage.waitApplicationDetailsOpened(applicationId) await applicationsDetailsPage.waitApplicationDetailsOpened(applicationId)
await applicationsDetailsPage.checkCommentExist(commentText) await applicationsDetailsPage.checkCommentExist(commentText)

View File

@ -10,7 +10,14 @@ test.use({
}) })
test.describe('Companies tests', () => { test.describe('Companies tests', () => {
let navigationMenuPage: NavigationMenuPage
let companiesPage: CompaniesPage
let companyDetailsPage: CompanyDetailsPage
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
navigationMenuPage = new NavigationMenuPage(page)
companiesPage = new CompaniesPage(page)
companyDetailsPage = new CompanyDetailsPage(page)
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
}) })
@ -29,14 +36,9 @@ test.describe('Companies tests', () => {
] ]
} }
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonCompanies() await navigationMenuPage.clickButtonCompanies()
const companiesPage = new CompaniesPage(page)
await companiesPage.createNewCompany(newCompany) await companiesPage.createNewCompany(newCompany)
await companiesPage.openCompanyByName(newCompany.name) await companiesPage.openCompanyByName(newCompany.name)
const companyDetailsPage = new CompanyDetailsPage(page)
await companyDetailsPage.checkCompany(newCompany) await companyDetailsPage.checkCompany(newCompany)
}) })
@ -61,14 +63,9 @@ test.describe('Companies tests', () => {
location: 'London' location: 'London'
} }
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonCompanies() await navigationMenuPage.clickButtonCompanies()
const companiesPage = new CompaniesPage(page)
await companiesPage.createNewCompany({ name: createdCompany }) await companiesPage.createNewCompany({ name: createdCompany })
await companiesPage.openCompanyByName(createdCompany) await companiesPage.openCompanyByName(createdCompany)
const companyDetailsPage = new CompanyDetailsPage(page)
await companyDetailsPage.checkCompany({ await companyDetailsPage.checkCompany({
name: createdCompany name: createdCompany
}) })
@ -81,18 +78,11 @@ test.describe('Companies tests', () => {
const deleteCompany: NewCompany = { const deleteCompany: NewCompany = {
name: `Delete Company-${generateId()}` name: `Delete Company-${generateId()}`
} }
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonCompanies() await navigationMenuPage.clickButtonCompanies()
const companiesPage = new CompaniesPage(page)
await companiesPage.createNewCompany(deleteCompany) await companiesPage.createNewCompany(deleteCompany)
await companiesPage.openCompanyByName(deleteCompany.name) await companiesPage.openCompanyByName(deleteCompany.name)
const companyDetailsPage = new CompanyDetailsPage(page)
await companyDetailsPage.checkCompany(deleteCompany) await companyDetailsPage.checkCompany(deleteCompany)
await companyDetailsPage.deleteEntity() await companyDetailsPage.deleteEntity()
await navigationMenuPage.clickButtonCompanies() await navigationMenuPage.clickButtonCompanies()
await companiesPage.checkCompanyNotExist(deleteCompany.name) await companiesPage.checkCompanyNotExist(deleteCompany.name)
}) })

View File

@ -1,40 +1,40 @@
import { test } from '@playwright/test' import { test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils' import { generateId, PlatformSetting, PlatformURI } from '../utils'
import { RecruitingPage } from '../model/recruiting/recruiting-page'
import { CommonRecruitingPage } from '../model/recruiting/common-recruiting-page'
test.use({ test.use({
storageState: PlatformSetting storageState: PlatformSetting
}) })
test.describe('review tests', () => { test.describe('review tests', () => {
let recruitingPage: RecruitingPage
let commonRecruitingPage: CommonRecruitingPage
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
recruitingPage = new RecruitingPage(page)
commonRecruitingPage = new CommonRecruitingPage(page)
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
}) })
test('create-review', async ({ page, context }) => { test('create-review', async ({ page }) => {
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
await page.click('text=Reviews')
await page.click('button:has-text("Review")')
await page.click('[placeholder="Title"]')
const reviewId = 'review-' + generateId() const reviewId = 'review-' + generateId()
await page.fill('[placeholder="Title"]', reviewId) await recruitingPage.clickRecruitApplication()
await recruitingPage.clickOnReviews()
await page.click('button:has-text("Appleseed John")') await recruitingPage.clickOnReviewButton()
await commonRecruitingPage.clickOnTitle()
await page.click('button:has-text("Chen Rosamund")') await commonRecruitingPage.fillTitle(reviewId)
await commonRecruitingPage.clickAppleseedJohn()
await page.press('[placeholder="Search\\.\\.\\."]', 'Escape') await commonRecruitingPage.clickChenRosamund()
await commonRecruitingPage.pressEscapeInSearch()
await page.click('form button :has-text("Talent")') await commonRecruitingPage.clickTalent()
// Click button:has-text("Chen Rosamund") // Click button:has-text("Chen Rosamund")
await page.click('button:has-text("Chen Rosamund")') await commonRecruitingPage.clickChenRosamund()
await commonRecruitingPage.createApplication()
await page.click('button:has-text("Create")') await commonRecruitingPage.selectReviewItem(reviewId)
await page.waitForSelector('form.antiCard', { state: 'detached' }) await commonRecruitingPage.clickTwoMembers()
await commonRecruitingPage.clickAppleseedJohn()
await page.click(`tr:has-text('${reviewId}') td a`) // ADD ASSERTION
await page.click('button:has-text("2 members")')
await page.click('.popup button:has-text("Chen Rosamund")')
await page.press('[placeholder="Search\\.\\.\\."]', 'Escape')
await page.click('button:has-text("Appleseed John")')
}) })
}) })

View File

@ -1,4 +1,4 @@
import { expect, test } from '@playwright/test' import { test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils' import { generateId, PlatformSetting, PlatformURI } from '../utils'
import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page' import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page'
import { TalentsPage } from '../model/recruiting/talents-page' import { TalentsPage } from '../model/recruiting/talents-page'
@ -10,113 +10,74 @@ test.use({
}) })
test.describe('candidate/talents tests', () => { test.describe('candidate/talents tests', () => {
let talentsPage: TalentsPage
let navigationMenuPage: NavigationMenuPage
let talentDetailsPage: TalentDetailsPage
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
talentsPage = new TalentsPage(page)
navigationMenuPage = new NavigationMenuPage(page)
talentDetailsPage = new TalentDetailsPage(page)
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
}) })
test('create-candidate', async ({ page, context }) => { test('create-candidate', async () => {
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.click('text=Talents')
await page.click('button:has-text("New Talent")')
const first = 'Elton-' + generateId(4) const first = 'Elton-' + generateId(4)
const last = 'John-' + generateId(4) const last = 'John-' + generateId(4)
const loc = 'Cupertino' const loc = 'Cupertino'
const email = `ej-${generateId(4)}@test.com` const email = `ej-${generateId(4)}@test.com`
const firstName = page.locator('[placeholder="First name"]') await talentsPage.clickRecruitApplication()
await firstName.click() await talentsPage.clickTalentsTab()
await firstName.fill(first) await talentsPage.clickNewTalent()
await talentsPage.enterFirstName(first)
const lastName = page.locator('[placeholder="Last name"]') await talentsPage.enterLastName(last)
await lastName.click() await talentsPage.enterTitle()
await lastName.fill(last) await talentsPage.enterLocation(loc)
await talentsPage.addSocialLinks()
const title = page.locator('[placeholder="Title"]') await talentsPage.selectEmail()
await title.click() await talentsPage.enterEmail(email)
await title.fill('Super Candidate') await talentsPage.confirmEmail()
await talentsPage.createTalent()
const location = page.locator('[placeholder="Location"]') await talentsPage.verifyTalentDetails(first, last, loc)
await location.click() await talentsPage.verifyEmailInPopup(email)
await location.fill(loc)
await page.locator('[id="presentation\\:string\\:AddSocialLinks"]').click()
await page.locator('.antiPopup').locator('text=Email').click()
const emailInput = page.locator('[placeholder="john\\.appleseed@apple\\.com"]')
await emailInput.fill(email)
await page.locator('#channel-ok.antiButton').click()
await page.locator('.antiCard button:has-text("Create")').click()
await page.waitForSelector('form.antiCard', { state: 'detached' })
await page.click(`text="${last} ${first}"`)
await expect(page.locator(`text=${first}`).first()).toBeVisible()
await expect(page.locator(`text=${last}`).first()).toBeVisible()
await expect(page.locator(`text=${loc}`).first()).toBeVisible()
const panel = page.locator('.popupPanel')
await panel.locator('[id="gmail\\:string\\:Email"]').scrollIntoViewIfNeeded()
await panel.locator('[id="gmail\\:string\\:Email"]').click()
expect(await page.locator('.cover-channel >> input').inputValue()).toEqual(email)
}) })
test('Edit the Talent', async ({ page, context }) => { test('Edit the Talent', async () => {
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonTalents() await navigationMenuPage.clickButtonTalents()
const talentsPage = new TalentsPage(page)
const talentName = await talentsPage.createNewTalent() const talentName = await talentsPage.createNewTalent()
await talentsPage.openTalentByTalentName(talentName) await talentsPage.openTalentByTalentName(talentName)
const talentDetailsPage = new TalentDetailsPage(page)
await talentDetailsPage.addComment('Test Talent Detail 123') await talentDetailsPage.addComment('Test Talent Detail 123')
await talentDetailsPage.checkCommentExist('Test Talent Detail 123') await talentDetailsPage.checkCommentExist('Test Talent Detail 123')
await talentDetailsPage.addAttachments('cat.jpeg') await talentDetailsPage.addAttachments('cat.jpeg')
await talentDetailsPage.addFirstReview('First Talent Review', 'First Talent review description') await talentDetailsPage.addFirstReview('First Talent Review', 'First Talent review description')
const skillTag = `React-${generateId(4)}` const skillTag = `React-${generateId(4)}`
await talentDetailsPage.addSkill(skillTag, 'Description Java from Talent Description page') await talentDetailsPage.addSkill(skillTag, 'Description Java from Talent Description page')
await talentDetailsPage.checkSkill(skillTag) await talentDetailsPage.checkSkill(skillTag)
await talentDetailsPage.addSocialLinks('Phone', '123123213213') await talentDetailsPage.addSocialLinks('Phone', '123123213213')
await talentDetailsPage.checkSocialLinks('Phone', '123123213213') await talentDetailsPage.checkSocialLinks('Phone', '123123213213')
await talentDetailsPage.inputLocation().fill('Awesome Location') await talentDetailsPage.inputLocation().fill('Awesome Location')
const title = `Title-${generateId(4)}` const title = `Title-${generateId(4)}`
await talentDetailsPage.addTitle(title) await talentDetailsPage.addTitle(title)
// ADD ASSERTION
}) })
test('Delete the Talent', async ({ page, context }) => { test('Delete the Talent', async () => {
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonTalents() await navigationMenuPage.clickButtonTalents()
const talentsPage = new TalentsPage(page)
const talentName = await talentsPage.createNewTalent() const talentName = await talentsPage.createNewTalent()
await talentsPage.openTalentByTalentName(talentName) await talentsPage.openTalentByTalentName(talentName)
const talentDetailsPage = new TalentDetailsPage(page)
await talentDetailsPage.inputLocation().fill('Awesome Location') await talentDetailsPage.inputLocation().fill('Awesome Location')
await talentDetailsPage.deleteEntity() await talentDetailsPage.deleteEntity()
await navigationMenuPage.clickButtonTalents() await navigationMenuPage.clickButtonTalents()
await talentsPage.checkTalentNotExist(talentName) await talentsPage.checkTalentNotExist(talentName)
}) })
test('Merge contacts', async ({ page, context }) => { test('Merge contacts', async () => {
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonTalents() await navigationMenuPage.clickButtonTalents()
const talentsPage = new TalentsPage(page)
// talent1 // talent1
const talentNameFirst = await talentsPage.createNewTalent() const talentNameFirst = await talentsPage.createNewTalent()
await talentsPage.openTalentByTalentName(talentNameFirst) await talentsPage.openTalentByTalentName(talentNameFirst)
let talentDetailsPage = new TalentDetailsPage(page)
await talentDetailsPage.inputLocation().fill('Awesome Location Merge1') await talentDetailsPage.inputLocation().fill('Awesome Location Merge1')
const titleTalent1 = 'TitleMerge1' const titleTalent1 = 'TitleMerge1'
await talentDetailsPage.addTitle(titleTalent1) await talentDetailsPage.addTitle(titleTalent1)
@ -129,7 +90,6 @@ test.describe('candidate/talents tests', () => {
await navigationMenuPage.clickButtonTalents() await navigationMenuPage.clickButtonTalents()
const talentNameSecond = await talentsPage.createNewTalent() const talentNameSecond = await talentsPage.createNewTalent()
await talentsPage.openTalentByTalentName(talentNameSecond) await talentsPage.openTalentByTalentName(talentNameSecond)
talentDetailsPage = new TalentDetailsPage(page)
await talentDetailsPage.inputLocation().fill('Awesome Location Merge2') await talentDetailsPage.inputLocation().fill('Awesome Location Merge2')
const titleTalent2 = 'TitleMerge2' const titleTalent2 = 'TitleMerge2'
await talentDetailsPage.addTitle(titleTalent2) await talentDetailsPage.addTitle(titleTalent2)
@ -158,23 +118,16 @@ test.describe('candidate/talents tests', () => {
await talentsPage.openTalentByTalentName(talentNameFirst) await talentsPage.openTalentByTalentName(talentNameFirst)
await talentDetailsPage.checkSocialLinks('Phone', '123123213213') await talentDetailsPage.checkSocialLinks('Phone', '123123213213')
await talentDetailsPage.checkSocialLinks('Email', 'test-merge-2@gmail.com') await talentDetailsPage.checkSocialLinks('Email', 'test-merge-2@gmail.com')
await expect(talentDetailsPage.inputLocation()).toHaveValue('Awesome Location Merge1') await talentDetailsPage.checkMergeContacts('Awesome Location Merge1', titleTalent2, sourceTalent2)
await expect(talentDetailsPage.page.locator('button > span', { hasText: titleTalent2 })).toBeVisible()
await expect(talentDetailsPage.page.locator('button > span', { hasText: sourceTalent2 })).toBeVisible()
}) })
test('Match to vacancy', async ({ page, context }) => { test('Match to vacancy', async () => {
const talentName: TalentName = { const talentName: TalentName = {
firstName: 'Software', firstName: 'Software',
lastName: `Engineer-${generateId(4)}` lastName: `Engineer-${generateId(4)}`
} }
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonTalents() await navigationMenuPage.clickButtonTalents()
const talentsPage = new TalentsPage(page)
await talentsPage.createNewTalentWithName(talentName.firstName, talentName.lastName) await talentsPage.createNewTalentWithName(talentName.firstName, talentName.lastName)
await talentsPage.rightClickAction(talentName, 'Match to vacancy') await talentsPage.rightClickAction(talentName, 'Match to vacancy')
await talentsPage.checkMatchVacancy(`${talentName.lastName} ${talentName.firstName}`, '0') await talentsPage.checkMatchVacancy(`${talentName.lastName} ${talentName.firstName}`, '0')
}) })

View File

@ -1,9 +1,8 @@
import { expect, test } from '@playwright/test' import { test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils' import { generateId, PlatformSetting, PlatformURI } from '../utils'
import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page' import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page'
import { VacanciesPage } from '../model/recruiting/vacancies-page' import { VacanciesPage } from '../model/recruiting/vacancies-page'
import { VacancyDetailsPage } from '../model/recruiting/vacancy-details-page' import { VacancyDetailsPage } from '../model/recruiting/vacancy-details-page'
import { CommonPage } from '../model/common-page'
import { NewVacancy } from '../model/recruiting/types' import { NewVacancy } from '../model/recruiting/types'
test.use({ test.use({
@ -11,50 +10,28 @@ test.use({
}) })
test.describe('Vacancy tests', () => { test.describe('Vacancy tests', () => {
let navigationMenuPage: NavigationMenuPage
let vacanciesPage: VacanciesPage
let vacancyDetailsPage: VacancyDetailsPage
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
navigationMenuPage = new NavigationMenuPage(page)
vacanciesPage = new VacanciesPage(page)
vacancyDetailsPage = new VacancyDetailsPage(page)
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
}) })
test('create-vacancy', async ({ page }) => { test('create-vacancy', async () => {
const vacancyId = 'My vacancy ' + generateId(4) const vacancyId = 'My vacancy ' + generateId(4)
await vacanciesPage.createVacancy(vacancyId)
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click() await vacanciesPage.modifyVacancy(vacancyId)
await vacanciesPage.createApplicationVacencies('Alex')
await page.locator('text=Vacancies').click()
await page.click('button:has-text("Vacancy")')
await page.fill('form [placeholder="Software\\ Engineer"]', vacancyId)
await page.click('form button:has-text("Create")')
await page.waitForSelector('form.antiCard', { state: 'detached' })
await page.click(`tr:has-text("${vacancyId}") > td:nth-child(3) >> .sm-tool-icon`)
// Create Application1
await page.click('button:has-text("Application")')
await page.click('form[id="recruit:string:CreateApplication"] [id="vacancy.talant.selector"]')
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' })
await expect(page.locator('text=APP-').first()).toBeVisible()
await expect(page.locator('text=P. Alex').first()).toBeVisible()
}) })
test('use-kanban', async ({ page }) => { test('use-kanban', async () => {
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click() await vacanciesPage.navigateToSoftwareEngineerVacancies()
await vacanciesPage.selectApplicationsTab()
await page.locator('text=Vacancies').click() await vacanciesPage.verifyApplicantsVisibility()
await page.click('text=Software Engineer')
// await page.click('[name="tooltip-task:string:Kanban"]')
await page.click('.antiSection-header >> text=Applications')
await page.click('.tablist-container div:nth-child(2)')
await expect(page.locator('text=M. Marina').first()).toBeVisible()
await expect(page.locator('text=Multiseed John').first()).toBeVisible()
await expect(page.locator('text=P. Alex').first()).toBeVisible()
})
// test('application-search', async ({ page }) => { // test('application-search', async ({ page }) => {
// TODO: Application search is broken, since indexer now index from child to parent. // TODO: Application search is broken, since indexer now index from child to parent.
@ -78,42 +55,33 @@ test.describe('Vacancy tests', () => {
// await expect(page.locator('text=M. Marina')).toBeVisible() // await expect(page.locator('text=M. Marina')).toBeVisible()
// expect(await page.locator('.antiTable-body__row').count()).toBeGreaterThan(2) // expect(await page.locator('.antiTable-body__row').count()).toBeGreaterThan(2)
// }) // })
})
test('Edit a Vacancy', async ({ page }) => { test('Edit a Vacancy', async () => {
const vacancyName = 'Edit Vacancy ' + generateId(4) const vacancyName = 'Edit Vacancy ' + generateId(4)
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonVacancies() await navigationMenuPage.clickButtonVacancies()
const vacanciesPage = new VacanciesPage(page)
await vacanciesPage.createNewVacancy({ await vacanciesPage.createNewVacancy({
title: vacancyName, title: vacancyName,
description: 'Vacancy description from Edit a Vacancy test', description: 'Vacancy description from Edit a Vacancy test',
location: 'Edit a Vacancy location' location: 'Edit a Vacancy location'
}) })
await vacanciesPage.openVacancyByName(vacancyName) await vacanciesPage.openVacancyByName(vacancyName)
const vacancyDetailsPage = new VacancyDetailsPage(page)
await vacancyDetailsPage.addComment('Test Vacancy Comment 12345') await vacancyDetailsPage.addComment('Test Vacancy Comment 12345')
await vacancyDetailsPage.checkCommentExist('Test Vacancy Comment 12345') await vacancyDetailsPage.checkCommentExist('Test Vacancy Comment 12345')
await vacancyDetailsPage.fillInputDescription('Edit a Vacancy description')
await vacancyDetailsPage.inputDescription().fill('Edit a Vacancy description') await vacancyDetailsPage.checkIfInputDescriptionHasText('Edit a Vacancy description')
await expect(vacancyDetailsPage.inputDescription()).toHaveText('Edit a Vacancy description')
await vacancyDetailsPage.addAttachments('cat.jpeg') await vacancyDetailsPage.addAttachments('cat.jpeg')
await vacancyDetailsPage.addDescription('Vacancy Description left-side menu') await vacancyDetailsPage.addDescription('Vacancy Description left-side menu')
await vacancyDetailsPage.addLocation('Edit Vacancy Location') await vacancyDetailsPage.addLocation('Edit Vacancy Location')
await vacancyDetailsPage.addCompany('Apple') await vacancyDetailsPage.addCompany('Apple')
await vacancyDetailsPage.addDueDateToday() await vacancyDetailsPage.addDueDateToday()
}) })
test('Filter vacancies', async ({ page }) => { test('Filter vacancies', async () => {
// viable when test set of vacancies fits to single page // viable when test set of vacancies fits to single page
const vacancyName = 'Archive Vacancy ' + generateId(5) const vacancyName = 'Archive Vacancy ' + generateId(5)
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonVacancies() await navigationMenuPage.clickButtonVacancies()
const vacanciesPage = new VacanciesPage(page)
await vacanciesPage.createNewVacancy({ await vacanciesPage.createNewVacancy({
title: vacancyName, title: vacancyName,
description: 'Vacancy description from Filter vacancies test', description: 'Vacancy description from Filter vacancies test',
@ -121,29 +89,21 @@ test.describe('Vacancy tests', () => {
}) })
await vacanciesPage.checkVacancyExist(vacancyName, `Created vacancy "${vacancyName}" visible by default.`) await vacanciesPage.checkVacancyExist(vacancyName, `Created vacancy "${vacancyName}" visible by default.`)
await vacanciesPage.archiveVacancyByName(vacancyName) await vacanciesPage.archiveVacancyByName(vacancyName)
await vacanciesPage.checkVacancyNotExist(vacancyName, `Archieved vacancy "${vacancyName}" not visible by default.`) await vacanciesPage.checkVacancyNotExist(vacancyName, `Archieved vacancy "${vacancyName}" not visible by default.`)
await vacanciesPage.showArchivedVacancy() await vacanciesPage.showArchivedVacancy()
await vacanciesPage.checkVacancyExist( await vacanciesPage.checkVacancyExist(
vacancyName, vacancyName,
`Archieved vacancy "${vacancyName}" visible when hide archved off.` `Archieved vacancy "${vacancyName}" visible when hide archved off.`
) )
await vacanciesPage.clickOnHideArchivedVacancies() await vacanciesPage.clickOnHideArchivedVacancies()
await vacanciesPage.checkVacancyNotExist( await vacanciesPage.checkVacancyNotExist(
vacancyName, vacancyName,
`Archieved vacancy "${vacancyName}" not visible when hide archved back on.` `Archieved vacancy "${vacancyName}" not visible when hide archved back on.`
) )
}) })
test('Export vacancies', async ({ page }) => { test('Export vacancies', async () => {
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonVacancies() await navigationMenuPage.clickButtonVacancies()
const vacanciesPage = new VacanciesPage(page)
await vacanciesPage.selectAll() await vacanciesPage.selectAll()
await vacanciesPage.exportVacanciesWithCheck('Software Engineer', 2000) await vacanciesPage.exportVacanciesWithCheck('Software Engineer', 2000)
}) })
@ -155,24 +115,17 @@ test.describe('Vacancy tests', () => {
location: 'Archive a Vacancy location' location: 'Archive a Vacancy location'
} }
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.clickButtonVacancies() await navigationMenuPage.clickButtonVacancies()
const vacanciesPage = new VacanciesPage(page)
await vacanciesPage.createNewVacancy(archiveVacancy) await vacanciesPage.createNewVacancy(archiveVacancy)
await vacanciesPage.openVacancyByName(archiveVacancy.title) await vacanciesPage.openVacancyByName(archiveVacancy.title)
const vacancyDetailsPage = new VacancyDetailsPage(page)
await vacancyDetailsPage.moreActionOn('Archive') await vacancyDetailsPage.moreActionOn('Archive')
await vacancyDetailsPage.pressYesForPopup(page) await vacancyDetailsPage.pressYesForPopup(page)
await vacancyDetailsPage.checkActivityExist('Archived set to Yes') await vacancyDetailsPage.checkActivityExist('Archived set to Yes')
await navigationMenuPage.clickButtonVacancies() await navigationMenuPage.clickButtonVacancies()
await vacanciesPage.checkVacancyNotExist( await vacanciesPage.checkVacancyNotExist(
archiveVacancy.title, archiveVacancy.title,
`Archieved vacancy "${archiveVacancy.title}" visible.` `Archieved vacancy "${archiveVacancy.title}" visible.`
) )
await vacanciesPage.showArchivedVacancy() await vacanciesPage.showArchivedVacancy()
await vacanciesPage.checkVacancyExist( await vacanciesPage.checkVacancyExist(
archiveVacancy.title, archiveVacancy.title,