Skip to content

Commit

Permalink
Merge pull request #2528 from woocommerce/dev/compat-e2e-billing-stat…
Browse files Browse the repository at this point in the history
…e-input

Make the value entering of the billing state field in e2e test compatible with WC < 9.2
  • Loading branch information
eason9487 authored Aug 15, 2024
2 parents fe41b5b + a4d6d00 commit 5af0314
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/e2e/utils/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,17 @@ export async function checkout( page ) {
.fill( user.addressfirstline );
await page.getByLabel( 'City' ).fill( user.city );
await page.getByLabel( 'ZIP Code' ).fill( user.postcode );
await page.locator( '#billing-state' ).selectOption( user.statename );

const stateField = page.getByRole( 'combobox', { name: /State$/ } );
const stateFieldTagName = await stateField.evaluate(
( element ) => element.tagName
);
if ( stateFieldTagName === 'SELECT' ) {
stateField.selectOption( user.statename );
} else {
// compatibility-code "WC < 9.2"
stateField.fill( user.statename );
}
}

//TODO: See if there's an alternative method to click the button without relying on waitForTimeout.
Expand Down

0 comments on commit 5af0314

Please sign in to comment.