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 14, 2024
1 parent 11e35ce commit 50cbf3d
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 @@ -126,7 +126,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 50cbf3d

Please sign in to comment.