From c3a65eefaa5a8ae1131819015d4c186081337916 Mon Sep 17 00:00:00 2001 From: Rodel Calasagsag Date: Wed, 11 Oct 2023 20:37:36 +0800 Subject: [PATCH] Start waiting for response before click --- .../tests/api-core-tests/ci-release.global-setup.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/woocommerce/tests/api-core-tests/ci-release.global-setup.js b/plugins/woocommerce/tests/api-core-tests/ci-release.global-setup.js index 696dcf0933a..39d24191fc3 100644 --- a/plugins/woocommerce/tests/api-core-tests/ci-release.global-setup.js +++ b/plugins/woocommerce/tests/api-core-tests/ci-release.global-setup.js @@ -63,10 +63,11 @@ test( `Setup remote test site`, async ( { page, request } ) => { await page.goto( '/wp-admin/plugin-install.php' ); await page.getByRole( 'button', { name: Upload_Plugin } ).click(); await page.getByLabel( Plugin_zip_file ).setInputFiles( zipPath ); + const uploadPromise = page.waitForResponse( + '/wp-admin/update.php?action=upload-plugin' + ); await page.getByRole( 'button', { name: Install_Now } ).click(); - const uploadResponse = await page.waitForResponse( - '**/wp-admin/update.php?action=upload-plugin' - );; + const uploadResponse = await uploadPromise; expect( uploadResponse.ok() ).toBeTruthy(); await expect( page.getByRole( 'link', { name: Activate_Plugin } )