Skip to content

Commit

Permalink
Make the value entering of the billing state field in e2e test compat…
Browse files Browse the repository at this point in the history
…ible with WC < 9.2.
  • Loading branch information
eason9487 committed Aug 15, 2024
1 parent fe41b5b commit a4d6d00
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 a4d6d00

Please sign in to comment.