Skip to content

ensure clean imagify state before tagged smoke scenarios#374

Merged
Mai-Saad merged 4 commits intodevelopfrom
fix/336-update-smoke-tests-to-capture-error-with-3.20.3
Apr 28, 2026
Merged

ensure clean imagify state before tagged smoke scenarios#374
Mai-Saad merged 4 commits intodevelopfrom
fix/336-update-smoke-tests-to-capture-error-with-3.20.3

Conversation

@hanna-meda
Copy link
Copy Markdown
Contributor

Description

Fixes #336
This PR adds a new precondition hook that uninstalls Imagify when present for selected smoke tests.

Type of change

  • New feature (non-breaking change which adds functionality).
  • Bug fix (non-breaking change which fixes an issue).
  • Enhancement (non-breaking change which improves an existing functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as before).
  • Sub-task of #(issue number)
  • Chore
  • Release

Detailed scenario

What was tested

Screenshot 2026-04-16 at 15 06 33

How to test

Run npm run test:smoke with wpr 3.20.3 as new_release. Expected: Smoke tests that install the plugin and visit settings fail, with an error in debug.log.

Affected Features & Quality Assurance Scope

  • Smoke scenarios that install/activate WP Rocket and then visit settings or enable all settings.
  • Hook execution flow for tagged smoke scenarios.

Technical description

Documentation

Added a new tag-scoped Before hook for selected smoke scenarios.
Hook checks whether Imagify is installed and uninstalls it if present.
Scope is limited using tag expression to avoid impacting unrelated scenarios.

New dependencies

None.

Risks

Extra setup time for tagged scenarios if Imagify is installed.
Tag drift if future smoke scenarios need the same precondition but are not tagged.

Mitigations:
Hook is narrowly scoped via tags.

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

N/A

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.).
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a tag-scoped Cucumber Before hook to ensure certain smoke scenarios run with a clean state by removing the Imagify plugin when present, aligning smoke runs with the failure mode described in issue #336 / wp-rocket#7991.

Changes:

  • Added a new Before hook in src/support/hooks.ts scoped to @smoke + @requires-clean-imagify scenarios to uninstall Imagify.
  • Introduced the @requires-clean-imagify tag on selected smoke scenarios/features that need this precondition.
  • Scoped the hook to exclude @imagify-compatibility scenarios.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/support/hooks.ts Adds tag-scoped precondition hook to uninstall Imagify before selected smoke scenarios.
src/features/settings-export-import.feature Tags specific smoke scenarios to require clean Imagify state.
src/features/self-host-google-fonts.feature Tags feature to require clean Imagify state during smoke run.
src/features/roll-back.feature Tags feature to require clean Imagify state during smoke run.
src/features/enable-all-features.feature Tags feature to require clean Imagify state during smoke run.
src/features/delete-plugin.feature Tags one scenario to require clean Imagify state during smoke run.
src/features/broken-links.feature Tags feature to require clean Imagify state during smoke run.

Comment thread src/support/hooks.ts Outdated
Comment thread src/support/hooks.ts Outdated
Comment thread src/support/hooks.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a tag-scoped Cucumber precondition to ensure Imagify is uninstalled before specific smoke scenarios, improving smoke-test reliability for cases where Imagify’s presence can trigger WP Rocket debug.log errors (per #336 / wp-rocket#7991).

Changes:

  • Added a Before hook scoped to @smoke + @requires-clean-imagify (excluding @imagify-compatibility) that uninstalls Imagify.
  • Tagged selected smoke scenarios/features with @requires-clean-imagify to opt into the new precondition.
  • Expanded coverage of “clean Imagify state” across multiple smoke paths (settings visits, enable-all, rollback, broken links, export/import).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/support/hooks.ts Adds a tag-scoped Before hook that uninstalls Imagify for selected smoke scenarios.
src/features/settings-export-import.feature Tags two scenarios to require a clean Imagify state.
src/features/self-host-google-fonts.feature Tags the smoke feature to require a clean Imagify state.
src/features/roll-back.feature Tags the smoke feature to require a clean Imagify state.
src/features/enable-all-features.feature Tags the smoke feature to require a clean Imagify state.
src/features/delete-plugin.feature Tags the “installed and activated” scenario to require a clean Imagify state.
src/features/broken-links.feature Tags the smoke feature to require a clean Imagify state.

Comment thread src/support/hooks.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a tag-scoped Cucumber Before hook to ensure a clean environment (Imagify uninstalled) for selected smoke scenarios, so smoke runs can better surface WP Rocket debug.log errors like the one described in #336 / wp-rocket#7991.

Changes:

  • Added a new Before hook scoped to @requires-clean-imagify scenarios to uninstall Imagify (while excluding @imagify-compatibility).
  • Tagged selected smoke scenarios/features with @requires-clean-imagify so the precondition runs only where needed.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/support/hooks.ts Adds the tag-scoped precondition hook to uninstall Imagify for selected scenarios.
src/features/settings-export-import.feature Tags two scenarios to enforce a clean Imagify state before running them.
src/features/self-host-google-fonts.feature Tags the smoke feature to enforce a clean Imagify state.
src/features/roll-back.feature Tags the smoke feature to enforce a clean Imagify state.
src/features/enable-all-features.feature Tags the smoke feature to enforce a clean Imagify state.
src/features/delete-plugin.feature Tags the “installed and activated” scenario to enforce a clean Imagify state.
src/features/broken-links.feature Tags the smoke feature to enforce a clean Imagify state.

Comment thread src/support/hooks.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread src/support/hooks.ts
* Before each scenario tagged with @requires-clean-imagify, except those also tagged with
* @imagify-compatibility, ensures Imagify is not installed.
*/
Before({ tags: '@requires-clean-imagify and not @imagify-compatibility' }, async function (this: ICustomWorld): Promise<void> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we need this run before smoke test , why not just use @smoke instead of @requires-clean-imagify?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mai-Saad, I used requires-clean-imagify so this hook can be reused beyond smoke. It is currently applied only in smoke, but the precondition itself is not smoke-specific.

@hanna-meda
Copy link
Copy Markdown
Contributor Author

Smoke results with 3.21.1 as new release (all green):
Screenshot 2026-04-23 at 16 32 55

@Mai-Saad

@Mai-Saad
Copy link
Copy Markdown
Contributor

image

@Mai-Saad Mai-Saad merged commit c06d470 into develop Apr 28, 2026
2 checks passed
@Mai-Saad Mai-Saad deleted the fix/336-update-smoke-tests-to-capture-error-with-3.20.3 branch April 28, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update test to capture https://github.com/wp-media/wp-rocket/issues/7991

4 participants