From 4ed6dd232515f2fa58770b08c6f8251b5e4551d5 Mon Sep 17 00:00:00 2001 From: Opeyemi Ibrahim Date: Thu, 24 Oct 2024 10:52:49 +0100 Subject: [PATCH 1/3] Modify delete plugin method, remove auth from method -- :close #163 --- src/support/steps/delete-plugin.ts | 3 ++- utils/page-utils.ts | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/support/steps/delete-plugin.ts b/src/support/steps/delete-plugin.ts index 9ca3718..74aaa63 100644 --- a/src/support/steps/delete-plugin.ts +++ b/src/support/steps/delete-plugin.ts @@ -30,8 +30,9 @@ When('I delete plugin', async function (this: ICustomWorld) { } // Delete WPR. - await this.page.locator( '#delete-wp-rocket' ).click(); + //await this.page.locator( '#delete-wp-rocket' ).click(); + await this.utils.removeWprViaUi(); }); /** diff --git a/utils/page-utils.ts b/utils/page-utils.ts index 8efd13f..6c58eb6 100644 --- a/utils/page-utils.ts +++ b/utils/page-utils.ts @@ -594,7 +594,6 @@ export class PageUtils { public removeWprViaUi = async (): Promise => { // Start the process to remove wp-rocket. await this.visitPage('wp-admin'); - await this.auth(); // Confirm Dialog Box. this.page.on('dialog', async(dialog) => { From 1a6f4a7bc187f144649be090eb5a035e7374648e Mon Sep 17 00:00:00 2001 From: Opeyemi Ibrahim Date: Mon, 28 Oct 2024 10:17:42 +0100 Subject: [PATCH 2/3] PR reviews --- utils/page-utils.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/page-utils.ts b/utils/page-utils.ts index 6c58eb6..1c97d3f 100644 --- a/utils/page-utils.ts +++ b/utils/page-utils.ts @@ -582,6 +582,10 @@ export class PageUtils { // Remove WP Rocket from UI if on local run is explicitly parsed. if ( process.env.npm_config_env !== undefined && process.env.npm_config_env === 'local' ) { + // Start the process to remove wp-rocket. + await this.visitPage('wp-admin'); + await this.auth(); + await this.removeWprViaUi(); } } @@ -592,9 +596,6 @@ export class PageUtils { * @return {Promise} Promise that resolves after the uninstallation process is complete. */ public removeWprViaUi = async (): Promise => { - // Start the process to remove wp-rocket. - await this.visitPage('wp-admin'); - // Confirm Dialog Box. this.page.on('dialog', async(dialog) => { expect(dialog.type()).toContain('confirm'); From 99624d42857802bc5642ee3c34b8b7169e646e15 Mon Sep 17 00:00:00 2001 From: Michael Lee Date: Mon, 28 Oct 2024 11:28:24 +0100 Subject: [PATCH 3/3] Removed useless action and checks --- src/support/steps/delete-plugin.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/support/steps/delete-plugin.ts b/src/support/steps/delete-plugin.ts index 74aaa63..d9a7229 100644 --- a/src/support/steps/delete-plugin.ts +++ b/src/support/steps/delete-plugin.ts @@ -30,8 +30,6 @@ When('I delete plugin', async function (this: ICustomWorld) { } // Delete WPR. - //await this.page.locator( '#delete-wp-rocket' ).click(); - await this.utils.removeWprViaUi(); }); @@ -39,12 +37,6 @@ When('I delete plugin', async function (this: ICustomWorld) { * Executes the step to assert successful deletion of the WP Rocket plugin. */ Then('plugin should delete successfully', async function (this: ICustomWorld) { - - if (await this.page.getByRole('button', { name: 'Yes, delete these files and data' }).isVisible()) { - await this.page.getByRole('button', { name: 'Yes, delete these files and data' }).click(); - await expect(this.page.locator('#activate-wp-rocket')).toBeHidden(); - return; - } // Assert that WPR is deleted successfully await this.page.waitForSelector('#wp-rocket-deleted'); await expect(this.page.locator('#wp-rocket-deleted')).toBeVisible();