19 lines
563 B
TypeScript
19 lines
563 B
TypeScript
import { Page } from '@playwright/test';
|
|
import { BasePage } from './BasePage';
|
|
import { getPageConfig } from '../config/test-pages';
|
|
|
|
export class ProductsPage extends BasePage {
|
|
constructor(page: Page, config?) {
|
|
const pageConfig = getPageConfig('products');
|
|
super(page, pageConfig.url, config);
|
|
}
|
|
|
|
async getProductCount(): Promise<number> {
|
|
return await this.page.locator('.product-card').count();
|
|
}
|
|
|
|
async getProductTitle(index: number): Promise<string> {
|
|
return await this.getText(`.product-card:nth-child(${index + 1}) h3`);
|
|
}
|
|
}
|