Skip to content

Auto e2e improvement #11

Open
Open

Description

@Mai-Saad
  • Currently, auto e2e generates the new_release from the latest dev, will be great to generate previous_stable from trunk as well
  • Update WP to the latest version before running tests
  • Every week or less, delete all the passed reports

Activity

  1. Miraeld commented on Dec 5, 2025

    @Miraeld

    Nothing to do with wp-rocket-e2e repo,
    But everything has to be done in https://github.com/wp-media/auto-e2e

    1. Dual plugin generation (lines 57-60, 135-141, 425-439, 476-488): Add configuration for previous_stable.zip alongside new_release.zip. The script should now generate two versions of each plugin per cycle - one from the develop branch (new_release) and one from the trunk branch (previous_stable). This requires adding new config properties for the previous stable zip names, updating the cloneOrUpdatePlugin() method to accept a branch parameter, modifying moveZipToPlugin() to accept a custom target name, and updating configureForTestSuite() to set the previousStableZip property. The main cycle in runCycle() needs to be restructured to generate both zips sequentially with a git clean -fdx between them to prevent build artifact contamination.

    2. WordPress update before tests (lines 68-69, 241-253, 486): Add a config flag UPDATE_WORDPRESS and create a new updateWordPress() method that runs npx wp-env start --update to update WordPress to the latest version before running tests. This should be called in the cycle after updating the E2E repo but before running tests. If the update fails, it should log the error but not stop the test execution.

    3. Smart test results cleanup (lines 307-362): Modify the deleteOldTestResults() method to only delete passed test results older than 7 days while keeping failed results indefinitely. This requires checking each old result directory for a cucumber-report.json file, calling analyzeCucumberReport() to determine if tests passed or failed, and only deleting directories where all tests passed. The cleanup should log how many passed vs failed reports were processed.

    Error handling improvements needed:

    • Lines 489-499: Add null check for resultTimestamp before attempting to analyze the cucumber report to prevent null pointer exceptions when no test results are saved
    • Line 195: Change error message from hardcoded "No WP Rocket ZIP file found" to use this.pluginName for proper plugin-agnostic messaging
    • Lines 135-141: Add git checkout <branch> before git reset --hard origin/<branch> to ensure the repository is actually on the correct branch when updating existing clones
    • Lines 476-488: Add git clean -fdx between generating the two plugin versions to remove build artifacts and prevent contamination

    Configuration changes:

    • Add WP_ROCKET_PREVIOUS_STABLE_ZIP and BACKWPUP_PREVIOUS_STABLE_ZIP constants to specify the output filenames for trunk-based builds
    • Add UPDATE_WORDPRESS: true flag to enable/disable WordPress updates (can be set to false via environment variable if needed)
    • Keep 7-day retention for passed reports (changed from 4 days for all reports)
  2. Mai-Saad commented on Sep 20, 2026

    @Mai-Saad
    ContributorAuthor

    Note

    Generated by the AI delivery pipeline (grooming-agent · claude-sonnet-5).

    Grooming Plan — Issue #11

    Approach: Implement all changes inside auto-e2e.js only, per @Miraeld's note. Full spec at .TemporaryItems/Issues/auto-e2e/issues/11-spec.md.

    Effort: L · Risk: MEDIUM · Complexity: HIGH

    Key decisions / findings from re-reading the current code and the live wp-rocket-e2e repo:

    1. Confirmed wp-media/wp-rocket and wp-media/backwpup-pro both have live trunk and develop branches — dual-build as scoped is safe to implement.
    2. wp-rocket-e2e gained a new PluginBuilder/APVM build system (utils/plugin-builder.ts, added 2026-07-07 — after this issue's comment) that already knows about previous_stable.zip / new_release.zip filenames for WP Rocket, triggered via E2E_WPR_PREV_REF / E2E_WPR_NEW_REF env vars in its own BeforeAll hook. Since auto-e2e.js won't set those env vars, there's no runtime collision — but it's worth the team's awareness that two independent systems now target the same filenames.
    3. Needs a decision before implementation starts: the issue's literal suggestion for WP update (npx wp-env start --update) starts a local Docker WordPress environment. This repo has no .wp-env.json anywhere, and the actual test target is a remote, SSH-accessible server (already used by getSiteVersions() via runRemoteWpCli()). Recommendation: implement updateWordPress() using the existing runRemoteWpCli('core update') helper instead — same non-fatal-on-failure behavior, but it actually reaches the system under test. See "Implementation Options" in the spec for both options side by side.
    4. Minor, non-blocking: wp-rocket-e2e's new PluginBuilder does not define a "previous stable" build for BackWPUp, and no BackWPUp feature currently tests upgrades. The issue still explicitly asks for BACKWPUP_PREVIOUS_STABLE_ZIP; recommend implementing it anyway for parity/forward-compatibility (cheap), but flagging that it's currently unconsumed.

    Test plan: No test framework/CI exists in this repo (no package.json); verification is a manual smoke test on a live dedicated test server (full details in the spec's "Smoke test scenario" section) — run one full cycle and confirm both zips are built from the correct branches, WP update runs (or fails non-fatally) before tests, and cleanup only deletes passed results older than 7 days.

    PR Splitting Plan (effort = L)

    Slice Scope Deliverable
    PR 1 zipPlugin() error message, cloneOrUpdatePlugin() checkout-before-reset fix, runCycle() null-deref guard on resultTimestamp/reportAnalysis 3 low-risk error-handling fixes, independently mergeable
    PR 2 deleteOldTestResults() rewrite Smart cleanup: only delete passed results older than 7 days, keep failed indefinitely
    PR 3 UPDATE_WORDPRESS config + updateWordPress() method + wiring into runCycle() WordPress auto-update before tests, non-fatal on failure
    PR 4 CONFIG additions, cloneOrUpdatePlugin(branch) parameterization, cleanCloneDir(), moveZipToPlugin(zipPath, targetName), configureForTestSuite(), full runCycle() restructuring, README update Dual plugin generation (new_release from develop + previous_stable from trunk) — largest/riskiest slice, ships last

    Team: please confirm (a) whether to proceed with 4 separate PRs as above, and (b) the WP-update mechanism decision (Option 2B recommended) before implementation starts.

  3. Mai-Saad commented on Sep 20, 2026

    @Mai-Saad
    ContributorAuthor

    Note

    Generated by the AI delivery pipeline (orchestrator · Claude Sonnet 5).

    PR: #21 | Status: READY FOR REVIEW

    Stage Result Notes
    Grooming ✅ effort: L, risk: MEDIUM
    Challenger ✅ Approved no MUST_HAVE findings
    Implementation ✅ branch: enhancement/11-auto-e2e-improvement
    DOD L2 ⚠️ WARN no CI/test suite exists in this repo (pre-existing, not introduced by this PR)
    Lead Review ✅ PASS details on PR #21
    CI N/A no CI configured in this repo
    QA ✅ PASS details on PR #21; 1 real regression found and fixed before merge (Datator commit-hash tracking)
    Follow-up tickets #22 zipPlugin() ambiguous file-selection, exposure doubled by this PR — 2 other cosmetic nice-to-haves discarded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions