Skip to content

Add Playwright e2e test for Cloudinary setup wizard#1171

Draft
PatelUtkarsh wants to merge 3 commits intocloudinary:developfrom
PatelUtkarsh:feature/wizard-e2e
Draft

Add Playwright e2e test for Cloudinary setup wizard#1171
PatelUtkarsh wants to merge 3 commits intocloudinary:developfrom
PatelUtkarsh:feature/wizard-e2e

Conversation

@PatelUtkarsh
Copy link
Copy Markdown
Contributor

@PatelUtkarsh PatelUtkarsh commented May 7, 2026

Summary

  • Adds a Playwright e2e spec (tests/e2e/wizard-setup.spec.js) with three tests covering the setup wizard: invalid credentials are rejected and Next stays disabled; valid credentials walk all four tabs to completion; a completed wizard does not reappear on subsequent visits.
  • Adds a small helper module (tests/e2e/utils/wizard.js) that resets the Cloudinary connection between tests via direct docker exec against the *-tests-cli-1 container (working around the known npx wp-env run cli IPv6 timeout on macOS).
  • Plumbs CLOUDINARY_E2E_URL through the existing e2e GitHub Actions job.

Why a dedicated env var

The variable is intentionally named CLOUDINARY_E2E_URL, not CLOUDINARY_URL, so it cannot collide with the Cloudinary SDK convention or with anything a developer might define in .wp-env.override.json for local dev. Defining CLOUDINARY_URL (or CLOUDINARY_CONNECTION_STRING) as a PHP constant makes the plugin treat the connection as already-configured and hides the wizard's connection input — which makes this spec impossible to run. The README documents this explicitly.

Local credential delivery

Two paths, in order of precedence:

  1. Shell export: export CLOUDINARY_E2E_URL='cloudinary://...'
  2. Project-root .env file (gitignored). .env.example is included as a template; Playwright loads it via dotenv at startup.

CI

The e2e job in .github/workflows/ci.yml now passes CLOUDINARY_E2E_URL from a repository secret of the same name.

Action required before merging: add the CLOUDINARY_E2E_URL repository secret in Settings → Secrets and variables → Actions, with a dedicated test Cloudinary account (never production credentials). Without it, the e2e job will fail at the wizard test with a clear "must be set" error.

Test Plan

Locally verified:

  • Full e2e suite (npm run test:e2e) — 7/7 green (hello-world 2 + plugin 2 + wizard-setup 3)
  • Wizard suite re-run 3x consecutively — stable, no flakes
  • npm run lint:js -- tests/e2e/ — clean
  • .env-only path works (no shell var)
  • Shell export takes precedence over .env

Reviewer verification:

  • Confirm CLOUDINARY_E2E_URL repository secret is set
  • CI e2e job passes on this PR

@PatelUtkarsh PatelUtkarsh force-pushed the feature/wizard-e2e branch from 9e653a5 to 18a4474 Compare May 7, 2026 11:44
Covers the three behaviours users care about: invalid credentials are
rejected and Next stays disabled; valid credentials walk the wizard
through all four tabs to completion; and a completed wizard does not
reappear on subsequent visits to the plugin page.

Connection credentials are read from CLOUDINARY_E2E_URL (deliberately
distinct from the SDK's CLOUDINARY_URL convention) which can be
provided via shell export or a gitignored .env file. The test cannot
use a PHP-side connection constant because the plugin then hides the
wizard's connection input.
The wizard setup spec needs a real Cloudinary connection string at
runtime. Plumb it through from the repository secret of the same name.
@PatelUtkarsh PatelUtkarsh force-pushed the feature/wizard-e2e branch from 18a4474 to 22df49b Compare May 7, 2026 11:49
@PatelUtkarsh PatelUtkarsh changed the title Add Playwright e2e test for Cloudinary setup wizard (WPP-1201) Add Playwright e2e test for Cloudinary setup wizard May 7, 2026
Copy link
Copy Markdown
Collaborator

@gabrielcld2 gabrielcld2 left a comment

Choose a reason for hiding this comment

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

A small suggestion but otherwise it all looks good so far.

Comment thread tests/e2e/wizard-setup.spec.js Outdated
wizardWrap: '.cld-wizard',
};

test.describe( 'Cloudinary wizard setup (WPP-1201)', () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nitpick: This is the internal ticket number. Perhaps it's better not having these within the public repo as it's internal context only.

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.

Done in 450afc6.

We can squash merge and update commit message or I can update commit message to remove internal ticket and force push.

Remove WPP-1201 ticket reference from test.describe() to avoid
exposing internal project context in public repository.
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