Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #163 Step to delete WPR failing in smoke test #164

Merged
merged 3 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/support/steps/delete-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,13 @@ When('I delete plugin', async function (this: ICustomWorld) {
}

// Delete WPR.
await this.page.locator( '#delete-wp-rocket' ).click();

await this.utils.removeWprViaUi();
});

/**
* 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();
Expand Down
8 changes: 4 additions & 4 deletions utils/page-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand All @@ -592,10 +596,6 @@ export class PageUtils {
* @return {Promise<void>} Promise that resolves after the uninstallation process is complete.
*/
public removeWprViaUi = async (): Promise<void> => {
// Start the process to remove wp-rocket.
await this.visitPage('wp-admin');
await this.auth();
Khadreal marked this conversation as resolved.
Show resolved Hide resolved

// Confirm Dialog Box.
this.page.on('dialog', async(dialog) => {
expect(dialog.type()).toContain('confirm');
Expand Down
Loading