From 4dcc7d8bf80dcd660e0e999ca84794ef61627d41 Mon Sep 17 00:00:00 2001 From: Guilherme Pressutto Date: Tue, 6 Feb 2024 14:30:53 -0300 Subject: [PATCH] Make state optional when filling address with e2e-util (#44090) Co-authored-by: Francesco --- packages/js/e2e-utils/src/flows/shopper.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/js/e2e-utils/src/flows/shopper.js b/packages/js/e2e-utils/src/flows/shopper.js index 45bbc41e89e..a0ac2d8b09e 100644 --- a/packages/js/e2e-utils/src/flows/shopper.js +++ b/packages/js/e2e-utils/src/flows/shopper.js @@ -150,10 +150,12 @@ const shopper = { '#billing_city', customerBillingDetails.city ); - await expect( page ).toSelect( - '#billing_state', - customerBillingDetails.state - ); + if ( customerBillingDetails.state ) { + await expect( page ).toSelect( + '#billing_state', + customerBillingDetails.state + ); + } await expect( page ).toFill( '#billing_postcode', customerBillingDetails.postcode @@ -197,10 +199,12 @@ const shopper = { '#shipping_city', customerShippingDetails.city ); - await expect( page ).toSelect( - '#shipping_state', - customerShippingDetails.state - ); + if ( customerShippingDetails.state ) { + await expect( page ).toSelect( + '#shipping_state', + customerShippingDetails.state + ); + } await expect( page ).toFill( '#shipping_postcode', customerShippingDetails.postcode