Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 67x 67x 67x 67x 67x 67x 67x 67x 67x 67x 67x 67x 67x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 11x 11x 1x 1x 1x 1x 1x 4x 4x 1x 1x 1x 1x 1x 8x 8x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 26x 26x 1x 1x 1x | // @ts-check
const { expect } = require('@playwright/test');
/**
* HeaderComponent handles top navigation links and logo interactions.
*/
class HeaderComponent {
/**
* @param {import('@playwright/test').Page} page
*/
constructor(page) {
this.page = page;
// Locators
this.header = page.locator('#header');
this.logo = page.locator('.logo img');
this.homeLink = page.locator('.shop-menu a[href="/"]');
this.productsLink = page.locator('.shop-menu a[href="/products"]');
this.cartLink = page.locator('.shop-menu a[href="/view_cart"]');
this.signupLoginLink = page.locator('.shop-menu a[href="/login"]');
this.testCasesLink = page.locator('.shop-menu a[href="/test_cases"]');
this.apiTestingLink = page.locator('.shop-menu a[href="/api_list"]');
this.contactUsLink = page.locator('.shop-menu a[href="/contact_us"]');
}
/**
* Clicks on the 'Test Cases' navbar button.
*/
async clickTestCases() {
await this.testCasesLink.click();
}
/**
* Clicks on 'Home' navbar button.
*/
async clickHome() {
await this.homeLink.click();
}
/**
* Clicks on 'Products' navbar button.
*/
async clickProducts() {
await this.productsLink.click();
}
/**
* Clicks on 'Cart' navbar button.
*/
async clickCart() {
await this.cartLink.click();
}
/**
* Clicks on 'Signup / Login' navbar button.
*/
async clickSignupLogin() {
await this.signupLoginLink.click();
}
/**
* Clicks on 'Contact us' navbar button.
*/
async clickContactUs() {
await this.contactUsLink.click();
}
/**
* Verifies logo is visible.
*/
async verifyLogoVisible() {
await expect(this.logo).toBeVisible();
}
}
module.exports = { HeaderComponent };
|