Skip to content

Commit f89ac22

Browse files
authored
Merge pull request #287 from Progi1984/foBasePage
`FOBasePage` : Fixed `clickOnBreadCrumbLink` method
2 parents 56ec0f3 + d7c1264 commit f89ac22

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pages/FO/FOBasePage.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class FOBasePage extends CommonPage implements FOBasePagePageInte
2222

2323
private readonly breadCrumb: string;
2424

25-
private readonly breadCrumbLink: (link: string) => string;
25+
private readonly breadCrumbLink: (attributeSel: string, link: string) => string;
2626

2727
private readonly cartProductsCount: string;
2828

@@ -164,7 +164,7 @@ export default class FOBasePage extends CommonPage implements FOBasePagePageInte
164164
this.desktopLogo = '#_desktop_logo';
165165
this.desktopLogoLink = `${this.desktopLogo} a`;
166166
this.breadCrumb = '#wrapper nav';
167-
this.breadCrumbLink = (link) => `${this.breadCrumb} a[href*=${link}]`;
167+
this.breadCrumbLink = (attributeSel: string, link: string) => `${this.breadCrumb} a[href${attributeSel}="${link}"]`;
168168
this.cartProductsCount = '#_desktop_cart .cart-products-count';
169169
this.cartLink = '#_desktop_cart a';
170170
this.userInfoLink = '#_desktop_user_info';
@@ -307,7 +307,7 @@ export default class FOBasePage extends CommonPage implements FOBasePagePageInte
307307
async clickOnBreadCrumbLink(page: Page, link: string): Promise<void> {
308308
const currentUrl: string = page.url();
309309

310-
await page.locator(this.breadCrumbLink(link)).first().click();
310+
await page.locator(this.breadCrumbLink(link === '/' ? '$' : '*', link)).first().click();
311311
await page.waitForURL((url: URL): boolean => url.toString() !== currentUrl, {waitUntil: 'networkidle'});
312312
}
313313

0 commit comments

Comments
 (0)