Skip to content

Commit

Permalink
chore: updated config
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Oct 23, 2024
1 parent 41f5013 commit 416a7fd
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
54 changes: 54 additions & 0 deletions page-objects/project/projectListPage.ts
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();
}
}

7 changes: 7 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ const workers = process.env.WORKERS ? Number(process.env.WORKERS) : (process.env
const retries = process.env.CI ? 2 : 0;
const storageState = process.env.STORAGE_STATE || '.auth/state.json';

console.info('Running tests with the following configuration:');
console.info(`HEADLESS: ${headless}`);
console.info(`TIMEOUT: ${timeout}`);
console.info(`WORKERS: ${workers}`);
console.info(`RETRIES: ${retries}`);
console.info(`STORAGE_STATE: ${storageState}`);

/**
* See https://playwright.dev/docs/test-configuration.
*/
Expand Down

0 comments on commit 416a7fd

Please sign in to comment.