adyen-examples/adyen-testing-suite

Unify test to only support Adyen-Web Dropin 5.33.x or higher when clicking on button

Closed this issue · 1 comments

Description
In Adyen-Web Dropin 5.33.x or higher (Adyen/adyen-web#1868), we added a role "radio" to the buttons (and removed the aria-label). To make the changes backwards compatible with earlier versions we had to modify the tests to cover both cases.

const radioButton = await page.getByRole('radio', { name: 'Credit or debit card' });
    if (await radioButton.count() === 0) {
        // Click normal button for < Adyen-Web 5.32.x or lower
        await page.getByRole('button', { name: 'Credit or debit card' }).click();
    }
    else {
        // Click radio button for > Adyen-Web 5.33.x or higher
        await radioButton.click();
    }

Once we've upgraded all samples to 5.33.x or higher, we can remove these checks:

https://github.com/adyen-examples/adyen-testing-suite/blob/main/tests/subscription/dropin-card.spec.js#L20-L27
https://github.com/adyen-examples/adyen-testing-suite/blob/main/tests/checkout/dropin-card.spec.js#L20-L27

Food for thought:
This means that those who use the E2E playwright framework and use the getByRole('button', ...) function to test their drop-in integration will have to change it to getByRole('radio', ...)

Closed in #40