diff --git a/tests/e2e/specs/upe-split/shopper/shopper-deferred-intent-creation-upe-enabled.spec.js b/tests/e2e/specs/upe-split/shopper/shopper-deferred-intent-creation-upe-enabled.spec.js index 5a97053217e..47dded81fa3 100644 --- a/tests/e2e/specs/upe-split/shopper/shopper-deferred-intent-creation-upe-enabled.spec.js +++ b/tests/e2e/specs/upe-split/shopper/shopper-deferred-intent-creation-upe-enabled.spec.js @@ -132,7 +132,7 @@ describe( 'Enabled UPE with deferred intent creation', () => { describe( 'My Account', () => { let timeAdded; - it( 'should add the card as a new payment method', async () => { + it( 'should add the card as a new payment method and set it as default payment method', async () => { await shopperWCP.goToPaymentMethods(); await shopperWCP.addNewPaymentMethod( 'basic', card ); @@ -147,6 +147,11 @@ describe( 'Enabled UPE with deferred intent creation', () => { await expect( page ).toMatch( `${ card.expires.month }/${ card.expires.year }` ); + await shopperWCP.setDefaultPaymentMethod( card.label ); + // Verify that the card was set as default + await expect( page ).toMatch( + 'This payment method was successfully set as your default.' + ); } ); it( 'should be able set card as default', async () => { diff --git a/tests/e2e/utils/flows.js b/tests/e2e/utils/flows.js index f8f23c72dec..aa18cd328a7 100644 --- a/tests/e2e/utils/flows.js +++ b/tests/e2e/utils/flows.js @@ -129,8 +129,11 @@ export const shopperWCP = { await expect( page ).toClick( 'label', { text: label } ); }, - setDefaultPaymentMethod: async () => { - await expect( page ).toClick( '.button.default' ); + setDefaultPaymentMethod: async ( label ) => { + const [ paymentMethodRow ] = await page.$x( + `//tr[contains(., '${ label }')]` + ); + await expect( paymentMethodRow ).toClick( '.button.default' ); await page.waitForNavigation( { waitUntil: 'networkidle0' } ); },