diff --git a/packages/js/e2e-utils/changelog/fix-33172-setup-wizard-click-button-loading-state b/packages/js/e2e-utils/changelog/fix-33172-setup-wizard-click-button-loading-state new file mode 100644 index 00000000000..5e3e2a946d2 --- /dev/null +++ b/packages/js/e2e-utils/changelog/fix-33172-setup-wizard-click-button-loading-state @@ -0,0 +1,4 @@ +Significance: patch +Type: add + +Add tests to check usage button loading state diff --git a/packages/js/e2e-utils/src/components.js b/packages/js/e2e-utils/src/components.js index a2d5852fc63..02f795ddddb 100644 --- a/packages/js/e2e-utils/src/components.js +++ b/packages/js/e2e-utils/src/components.js @@ -129,6 +129,12 @@ const completeOnboardingWizard = async () => { expect( continueButtons ).toHaveLength( 1 ); await continueButtons[ 0 ].click(); + await expect( page ).toMatchElement( + '.woocommerce-usage-modal__actions button.is-secondary.is-busy' + ); + await expect( page ).not.toMatchElement( + '.woocommerce-usage-modal__actions button.is-primary:disabled' + ); } await page.waitForNavigation( { waitUntil: 'networkidle0' } ); diff --git a/plugins/woocommerce-admin/client/profile-wizard/steps/usage-modal.js b/plugins/woocommerce-admin/client/profile-wizard/steps/usage-modal.js index 2af08a9728c..b6facf75395 100644 --- a/plugins/woocommerce-admin/client/profile-wizard/steps/usage-modal.js +++ b/plugins/woocommerce-admin/client/profile-wizard/steps/usage-modal.js @@ -17,6 +17,7 @@ class UsageModal extends Component { this.state = { isLoadingScripts: false, isRequestStarted: false, + selectedAction: null, }; } @@ -131,7 +132,7 @@ class UsageModal extends Component { acceptActionText = __( 'Yes, count me in!', 'woocommerce' ), } = this.props; - const { isRequestStarted } = this.state; + const { isRequestStarted, selectedAction } = this.state; const isBusy = isRequestStarted && isRequesting; return ( @@ -148,19 +149,23 @@ class UsageModal extends Component {