-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import ListLayoutPage from '@/page-objects/layout/listLayoutPage'; | ||
|
||
export class ProjectListPage extends ListLayoutPage { | ||
protected path = '/#/projects'; | ||
|
||
// Locators | ||
private createProjectButton = '#add-btn'; | ||
private projectNameColumn = 'td.name'; | ||
private projectSpidersColumn = 'td.spiders'; | ||
private projectDescriptionColumn = 'td:nth-child(3)'; | ||
private deleteButton = '.delete-btn'; | ||
|
||
async navigate() { | ||
await super.navigate(); | ||
await this.page.goto(this.path); | ||
await this.waitForPageLoad(); | ||
} | ||
|
||
async waitForPageLoad() { | ||
await this.page.waitForSelector(this.listContainer); | ||
} | ||
|
||
async clickCreateProject() { | ||
await this.page.click(this.createProjectButton); | ||
} | ||
|
||
async searchProject(searchTerm: string) { | ||
await this.page.fill(this.searchInput, searchTerm); | ||
} | ||
|
||
async getProjectCount(): Promise<number> { | ||
return await this.page.locator(this.tableRows).count(); | ||
} | ||
|
||
async getProjectData(rowIndex: number): Promise<{ name: string; spiders: string; description: string }> { | ||
const row = this.page.locator(this.tableRows).nth(rowIndex); | ||
return { | ||
name: await row.locator(this.projectNameColumn).innerText(), | ||
spiders: await row.locator(this.projectSpidersColumn).innerText(), | ||
description: await row.locator(this.projectDescriptionColumn).innerText(), | ||
}; | ||
} | ||
|
||
async viewProject(rowIndex: number) { | ||
const row = this.page.locator(this.tableRows).nth(rowIndex); | ||
await row.locator(this.viewButton).click(); | ||
} | ||
|
||
async deleteProject(rowIndex: number) { | ||
const row = this.page.locator(this.tableRows).nth(rowIndex); | ||
await row.locator(this.deleteButton).click(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters