Skip to content

Adding Playwright tests to MageOS compatible with Hyva theme & Luma checkout#209

Closed
digitalrisedorset wants to merge 0 commit intoelgentos:mainfrom
digitalrisedorset:main
Closed

Adding Playwright tests to MageOS compatible with Hyva theme & Luma checkout#209
digitalrisedorset wants to merge 0 commit intoelgentos:mainfrom
digitalrisedorset:main

Conversation

@digitalrisedorset
Copy link
Copy Markdown

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

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);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The luma checkout does not have the same UX as hyva checkout and that is why this part is removed

* @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}) => {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto, the UX for the checkout in Luma is different to Hyva so I simplified the checkout tests

"categoryPage": {
"categorySlug": "/women.html",
"subcategorySlug" : "/gear/fitness-equipment.html"
"categorySlug": "/men/tops-men.html",
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used these categories as they have the correct layered navigation whilst women category does not

)

test(
'Footer_switch_currency',
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this active filter is not in MageOS admin so I commented this for now


async goToFooterElement () {
await this.page.getByText(UIReference.footerPage.currencyLabel).scrollIntoViewIfNeeded();
await this.page.getByText('Newsletter').scrollIntoViewIfNeeded();
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 digitalrisedorset changed the title Create a Adding Playwright tests to MageOS compatible with Hyva theme & Luma checkout Jan 27, 2026
@shayfaber
Copy link
Copy Markdown
Collaborator

@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!

@digitalrisedorset
Copy link
Copy Markdown
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants