Skip to content

Commit

Permalink
Checkout e2e: Only try to click edit payment method button if clickin…
Browse files Browse the repository at this point in the history
…g payment method fails (#85590)
  • Loading branch information
sirbrillig authored and pull[bot] committed Aug 23, 2024
1 parent 63b749c commit 8380863
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/calypso-e2e/src/lib/pages/cart-checkout-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,13 @@ export class CartCheckoutPage {
// the "Edit" button on the payment method step. There are cases where
// the step will not be collapsed, however, so this will only trigger
// if the edit button is visible.
if ( await this.page.isVisible( selectors.editPaymentStep ) ) {
const selector = this.page.locator( selectors.existingCreditCard( cardHolderName ) ).first();
try {
await selector.click();
} catch ( error ) {
await this.page.click( selectors.editPaymentStep );
await selector.click();
}
const selector = this.page.locator( selectors.existingCreditCard( cardHolderName ) ).first();

await selector.click();
}

/**
Expand Down

0 comments on commit 8380863

Please sign in to comment.