Skip to content

Build/Test Tools: Make the WordPress installation E2E test repeatable - #13377

Open
devsupportlogicrays wants to merge 1 commit into
WordPress:trunkfrom
devsupportlogicrays:fix/65982-install-e2e-repeatable
Open

Build/Test Tools: Make the WordPress installation E2E test repeatable#13377
devsupportlogicrays wants to merge 1 commit into
WordPress:trunkfrom
devsupportlogicrays:fix/65982-install-e2e-repeatable

Conversation

@devsupportlogicrays

@devsupportlogicrays devsupportlogicrays commented Sep 3, 2026

Copy link
Copy Markdown

Description

tests/e2e/specs/install.test.js rewrites $table_prefix to wp_e2e_ so WordPress enters the install wizard, but it never dropped the tables that install creates. After the first green run, leftover wp_e2e_* tables make every later run treat the site as already installed, so the test never reaches /wp-admin/install.php.

This change:

  • Extracts table cleanup into a dropTestInstallTables() helper that drops the standard single-site tables under TEST_TABLE_PREFIX via wp eval / $wpdb (avoids shelling out to the mysql client).
  • Runs that helper before the prefix swap in beforeEach and again in afterEach teardown, so stale tables cannot short-circuit the wizard on the first attempt.
  • Exits non-zero when any $wpdb->query() returns false, so failed cleanup cannot leave the suite green.
  • Retries page.goto('/') with expect(...).toPass() so navigation itself retries after the host-side wp-config.php rewrite (Docker bind-mount lag).
  • Also fixes the missing semicolon after .check() in the install form fill.

This builds on the approach discussed in #13302 and incorporates the review feedback there (helper extraction, cleanup before the prefix change, and failing on false query results).

Testing Instructions

  1. Ensure the local env is running (npm run env:start).
  2. Optionally leave stale tables behind once:
    npm run test:e2e -- tests/e2e/specs/install.test.js
    
  3. Run the same file again (and a third time). All runs should pass and land on install.php without manual DROP TABLE cleanup.
  4. To confirm cleanup failure handling, temporarily break a table name in TEST_INSTALL_TABLES and confirm the helper exits non-zero.

Trac ticket: https://core.trac.wordpress.org/ticket/65982


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Drop leftover wp_e2e_* tables before and after the install suite, fail
hard if cleanup queries return false, and retry navigation after the
wp-config prefix swap so consecutive runs reach install.php reliably.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @ahirgithub.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

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.

2 participants