Skip to content

Commit

Permalink
@pages/FO/classic/myAccount/myWishlists : Set the property `wishlis…
Browse files Browse the repository at this point in the history
…tListItem` as public
  • Loading branch information
Progi1984 committed Jul 10, 2024
1 parent 002ca30 commit 7deecd5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/interfaces/FO/myAccount/myWishlists/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {Page} from '@playwright/test';

export interface FoMyWishlistsPageInterface extends FOBasePagePageInterface {
readonly pageTitle: string;
readonly wishlistListItemNthTitle: (nth: number) => string;

countWishlists(page: Page): Promise<number>;
getWishlistName(page: Page, nth: number): Promise<string>;
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/FO/myAccount/myWishlists/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import type {Page} from '@playwright/test';

export interface FoMyWishlistsViewPageInterface extends FOBasePagePageInterface {
readonly messageSuccessfullyRemoved: string;
readonly productListEmpty: string;
readonly productList: string;

countProducts(page: Page): Promise<number>;
getProductAttribute(page: Page, nth: number, attribute: string): Promise<string|null>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {type FoMyWishlistsPageInterface} from '@interfaces/FO/myAccount/myWishlists';
import FOBasePage from '@pages/FO/FOBasePage';
import {default as foClassicMyWishlistsViewPage} from '@versions/develop/pages/FO/classic/myAccount/myWishlists/view';
import type {Page} from 'playwright';

/**
Expand All @@ -20,7 +21,7 @@ class MyWishlistsPage extends FOBasePage implements FoMyWishlistsPageInterface {

private readonly wishlistListItemNthLink: (nth: number) => string;

private readonly wishlistListItemNthTitle: (nth: number) => string;
public readonly wishlistListItemNthTitle: (nth: number) => string;

/**
* @constructs
Expand Down Expand Up @@ -70,6 +71,10 @@ class MyWishlistsPage extends FOBasePage implements FoMyWishlistsPageInterface {
*/
async goToWishlistPage(page: Page, nth: number): Promise<void> {
await page.locator(this.wishlistListItemNthLink(nth)).click();

if (await this.elementNotVisible(page, foClassicMyWishlistsViewPage.productListEmpty, 3000)) {
await this.elementVisible(page, foClassicMyWishlistsViewPage.productListEmpty, 3000)
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import type {Page} from 'playwright';
* @class
* @extends FOBasePage
*/
class WishlistPage extends FOBasePage implements FoMyWishlistsViewPageInterface {
class WishlistViewPage extends FOBasePage implements FoMyWishlistsViewPageInterface {
public readonly messageSuccessfullyRemoved: string;

private readonly headerTitle: string;

private readonly productList: string;
public readonly productListEmpty: string;

public readonly productList: string;

private readonly productListItem: string;

Expand Down Expand Up @@ -47,6 +49,7 @@ class WishlistPage extends FOBasePage implements FoMyWishlistsViewPageInterface

// Selectors
this.headerTitle = '#content-wrapper h1';
this.productListEmpty = '.wishlist-list-empty';
this.productList = '.wishlist-products-list';
this.productListItem = `${this.productList} .wishlist-products-item`;
this.productListItemNth = (nth: number) => `${this.productListItem}:nth-child(${nth})`;
Expand Down Expand Up @@ -191,4 +194,5 @@ class WishlistPage extends FOBasePage implements FoMyWishlistsViewPageInterface
}
}

module.exports = new WishlistPage();
export default new WishlistViewPage();
module.exports = new WishlistViewPage();

0 comments on commit 7deecd5

Please sign in to comment.