Start waiting for response before click

This commit is contained in:
Rodel Calasagsag 2023-10-11 20:37:36 +08:00
parent 90d7f160d5
commit c3a65eefaa
1 changed files with 4 additions and 3 deletions

View File

@ -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 } )