Test the behaviour and not the logic within the navigation test
- Dominant language
- PHP
- Stars
- 3.4k
- Forks
- 1.2k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 433
Description
Related test: {{tests/acceptance/tests/Categories/NavigateThroughStorefrontMenu.spec.ts}}
*Problem:*
Currently, in the corresponding test, we check 3 times the logic of the DOM ({{
{noformat}const breadcrumbNavigationItemTagName = await mainCategoryLocators.breadcrumbNavigationItem.evaluate((el) =>
el.tagName.toLowerCase()
);
await ShopCustomer.expects(breadcrumbNavigationItemTagName).toBe('span');{noformat}
*Solution:*
We could explicitly click on the element to check whether it is “actionable”. According to StackOverflow, you could use the {{trial}} [option|https://playwright.dev/docs/api/class-locator#locator-click-option-trial] in the click handler.
Or create a custom function and box it (see last comment here): [https://github.com/microsoft/playwright/issues/32291|https://github.com/microsoft/playwright/issues/32291|smart-link]
Docs: [https://github.com/microsoft/playwright/pull/6246|https://github.com/microsoft/playwright/pull/6246|smart-link]
Contributor guide
Assessment
This issue has not been assessed yet.