Adding Playwright tests to MageOS compatible with Hyva theme & Luma checkout#209
Adding Playwright tests to MageOS compatible with Hyva theme & Luma checkout#209digitalrisedorset wants to merge 0 commit intoelgentos:mainfrom
Conversation
tests/checkout.spec.ts
Outdated
| if(await addressField.isVisible()) { | ||
| if(!addressAlreadyAdded){ | ||
| // Address field is visible and addressalreadyAdded is not true, so we need to add an address to the account. | ||
| const accountPage = new AccountPage(page); |
There was a problem hiding this comment.
The luma checkout does not have the same UX as hyva checkout and that is why this part is removed
tests/checkout.spec.ts
Outdated
| * @and the code should be visible in the cart | ||
| * @and a discount should be applied to the product | ||
| */ | ||
| test('Add_coupon_code_in_checkout',{ tag: ['@checkout', '@coupon-code', '@cold']}, async ({page, browserName}) => { |
There was a problem hiding this comment.
ditto, the UX for the checkout in Luma is different to Hyva so I simplified the checkout tests
tests/config/slugs.json
Outdated
| "categoryPage": { | ||
| "categorySlug": "/women.html", | ||
| "subcategorySlug" : "/gear/fitness-equipment.html" | ||
| "categorySlug": "/men/tops-men.html", |
There was a problem hiding this comment.
I used these categories as they have the correct layered navigation whilst women category does not
| ) | ||
|
|
||
| test( | ||
| 'Footer_switch_currency', |
There was a problem hiding this comment.
currency switcher is not in place when MageOS is setup with single store and sample data
| this.page.getByText(outcomeMarker.adminGeneral.activeFiltersText).first(), | ||
| "There are active filters." | ||
| ).toBeVisible(); | ||
| // await expect( |
There was a problem hiding this comment.
this active filter is not in MageOS admin so I commented this for now
tests/poms/frontend/footer.page.ts
Outdated
|
|
||
| async goToFooterElement () { | ||
| await this.page.getByText(UIReference.footerPage.currencyLabel).scrollIntoViewIfNeeded(); | ||
| await this.page.getByText('Newsletter').scrollIntoViewIfNeeded(); |
There was a problem hiding this comment.
Since there is no currency, I added a fallback on newsletter. I have not created a label at this point as I anticipate a better suggestion may come later from peer reviews
|
@digitalrisedorset thank you for your contribution! As mentioned during the weekly MageOS meeting, unfortunately not all of your suggested changes can be implemented. I would like to implement your suggestion for the category page - I missed that they had differences, that's very well spotted on your part! As a resolution for this PR: if you could update the PR so it only keeps the category page changes, I can accept it! |
|
@shayfaber I created a new PR #222. This new PR only includes the category changes. I believe this is what you think is acceptable to merge in your work. Thank you for this update. |
This PR updates the test suite so it runs in MageOS environments using the Hyvä theme, while remaining compatible with the agreed Luma-based checkout.
The goal is to deliver a playwright test suite for MageOS + Hyvä users today
What Changed
1. Hyvä compatibility
Some Hyvä-rendered elements currently lack accessibility attributes that the test suite reasonably expects.
Where this occurs, selectors were adjusted to target existing, stable DOM elements.
These changes are temporary and not presented as best practice.
The correct long-term solution is to fix accessibility at the theme or MageOS level, after which tests should revert to accessibility-first selectors.
2. Checkout testing constraints
We previously agreed that: Checkout tests should target Luma, as the Hyvä checkout is not open source.
Longer term, tests should support multiple checkout implementations.
I explored splitting tests into:
a base (theme-agnostic) test set
a checkout-specific test set
However, the current elgentos test bootstrap does not allow this level of modularity without deeper refactoring.
As a result:
A single test repository is retained
Base tests and Luma checkout tests coexist