Repository navigation
feat: add shared fetch-cdn-scenario action for Core and Pro [ED-26391] - #71
Merged
Svitlana-Dykun merged 12 commits intoNov 26, 2026
Merged
Conversation
Creates a reusable composite action that consolidates the CDN campaign promotion test infrastructure previously duplicated in Core and Pro. Provides: - Fetch script with retry, timeout, and --allow-failure (from Pro) - Mock CDN mu-plugin for intercepting HTTP requests - Shared no-promotion fixture files This eliminates duplication between elementor/elementor#38251 and elementor/elementor-pro#7989 and uses Pro's more robust implementation (timeout, retry, atomic swap) as the baseline. Ref: ED-26391 Co-authored-by: Svitlana-Dykun <Svitlana-Dykun@users.noreply.github.com>
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
Co-authored-by: Cursor <cursoragent@cursor.com>
4 of 21 tasks
…aign value [ED-26391] - Mock packages/v1/promotions.json and free-to-pro-upsell.json, which Core requests on every editor load, also with Pro, so live campaigns no longer leak into tests. - active-campaign: add a Pro-only and an everyone What's New card, and a distinct sidebar link for the free, essential, essential-oct2023 and expired tiers, so tests with Pro can prove the mock answered. - Let every fetch settle before the staging directory is removed. - Update the README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…6391] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ync [ED-26391] Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…391] Co-authored-by: Cursor <cursoragent@cursor.com>
The active-campaign scenario has no screenshots any more, so the tests check the image URL only and the fixtures hold JSON only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
davseve
approved these changes
Nov 26, 2026
Svitlana-Dykun
deleted the
cursor/shared-cdn-test-infra-ed-26391-2158
branch
November 26, 2026 13:54
Svitlana-Dykun
added a commit
to elementor/elementor
that referenced
this pull request
Nov 27, 2026
## PR Checklist - [x] The commit message follows our guidelines: https://github.com/elementor/elementor/blob/master/.github/CONTRIBUTING.md ## PR Type - [ ] Bugfix - [ ] Feature - [ ] Code style update (formatting, local variables) - [ ] Refactoring (no functional changes, no api changes) - [ ] Build related changes - [x] CI related changes - [ ] Documentation content changes - [x] Other... Please describe: Playwright e2e tests ## Summary This PR can be summarized in the following changelog entry: * Internal: Add CDN campaign promotion tests ## Visual proof #skip_proof Playwright tests only, no user-facing change. ## Description Follows #38248 and uses the shared `elementor/elementor-editor-github-actions/actions/fetch-cdn-scenario` action (elementor/elementor-editor-github-actions#71). Tests that Core renders CDN promotions accurately when a campaign is active and falls back to Core defaults when inactive. **How it works** * PR CI runs `fetch-cdn-scenario` with `fetch-live: false` and `allow-failure: true`, installing the shared `mock-editor-assets-cdn.php` mu-plugin and copying the deterministic `no-promotion` and `active-campaign` fixtures. PR CI does not call `assets.elementor.com`. * `mock-editor-assets-cdn.php` selects the scenario from the `e2e_cdn_scenario` cookie. The rest of the suite stays on `no-promotion` (#38248). Campaign requests skip the shared `wp_options` CDN cache so they never leak into parallel tests. * Scheduled runs fetch the live CDN and set `E2E_CDN_SCENARIO=live`, which adds `live` to the campaign scenarios, so a broken live campaign is reported within a day. PR runs stay offline. * Local runs and pre-campaign checks use `npm run test:playwright:setup-cdn`, which downloads the shared fixtures and fetches the live CDN with the action's own script. **Coverage (free user, Core only)** Run for both `active-campaign` and `no-promotion`: * Plugins page row action - label and link * Admin menu Upgrade item - label and redirect target * Conversion banner - title, CTA text and link * Dashboard pointer - title, text, CTA (hidden without a campaign) * Editor widgets panel sticky footer - message, button text and link * Theme Builder promotion header button - text and link * V4 promotions and widget upsell images - `elementor.config.v4Promotions` and `elementorPromotionsData` Campaign content (`active-campaign`, plus `E2E_CDN_SCENARIO` when set): * What's New card - title, description, CTA link for Free users, and Pro-only cards hidden * Home screen sidebar banner - image and link (free variant) Pro variants are covered in elementor/elementor-pro#7989. ## Test instructions * `npm run wp-playground` (sets up CDN fixtures first) * `WP_CLI_TARGET=playground npx playwright test tests/playwright/sanity/modules/promotions/campaign` ## Quality assurance - [x] I have tested this code to the best of my abilities - [ ] I have added unittests to verify the code works as intended - [ ] Docs have been added / updated (for bug fixes / features) Ref: [ED-26391](https://elementor.atlassian.net/browse/ED-26391) [ED-26391]: https://elementor.atlassian.net/browse/ED-26391?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ ### Campaign screenshots - `no-promotion` and `active-campaign` have no screenshots. The tests check them through the DOM. In `active-campaign` the tests answer the CDN image requests from the fixture, so these runs do not depend on the live CDN. - A real campaign (`live`, or staging with `cdn_source`) keeps one baseline for every approved content: `campaign-<placement>-<fingerprint>.png`. The fingerprint is a hash of the CDN data that the placement shows. It ignores `lastUpdated` and the staging host, so a look approved on staging stays approved after the launch. - The run picks the baseline whose fingerprint matches the current CDN content. - If that baseline exists, the screenshot is compared with it. - If it does not exist, the test fails with "not approved" and attaches the screenshot for review. - Because approvals add up, the looks before, during and after a campaign can all be approved ahead of time. The nightly run stays green when the CDN switches. ### Nightly live CDN check - The `Playwright` workflow has its own schedule for this, which runs `live @promotions` against the production CDN every night at 04:30 UTC. - A failure is posted to the test automation results channel, the same channel as the other nightly results. "not approved" in the report means new CDN content: check the attached screenshots and approve them as described below. - The full nightly suite no longer checks the live CDN, so a CDN change does not fail it and is not reported twice. ### Approving the next campaign 1. Open the campaign PR in editor-assets. It deploys to `https://assets.stg.elementor.red`. 2. Run Playwright (Core: `Playwright`, Pro: `Playwright - Custom Core`) with `tag=@promotions` and `cdn_source=https://assets.stg.elementor.red`. Placements with new content fail with "not approved" and attach their screenshots. 3. Check the screenshots in the report. 4. Create a branch from `main` and run **Update Playwright Snapshots** on it with `test_grep=live @promotions`, the same `cdn_source` and `update_mode=changed`. Check that the workflow pushed a `test: update playwright snapshots` commit, then open a PR and merge it. - An approval run (`cdn_scenario=live` or `cdn_source`) fails on any test error and commits nothing. Missing baselines are written in update mode, so a failure there is real: the CDN was not fetched, or a text or link is wrong. Other snapshot updates still continue on errors. - A `cdn_source` without any of the CDN files fails the fetch ("check the source"). A source that misses some of them falls back to the default scenario for those, but every test checks that its files were fetched. 5. Do the same for the PR that ends the campaign, so the look after it is approved too. 6. Once in a while, delete the baselines of campaigns that are over. ### Campaign launch checklist Between campaigns, only the mocks check how a campaign is shown, so the staging run before the launch is the one that tries the real campaign with the current code. Before the launch: - [ ] The campaign PR in editor-assets is deployed to `https://assets.stg.elementor.red`. - [ ] Core and Pro Playwright runs with `cdn_source=https://assets.stg.elementor.red` (steps 1–3 above). Every failure other than "not approved" is a real problem: fix it before the launch. - [ ] The screenshots of every placement show the campaign as designed, for every license tier in Pro. - [ ] The campaign look is approved in Core and Pro (step 4), and the snapshot PRs are merged before the launch. - [ ] The look after the campaign is approved too (step 5), so its end does not fail the nightly run. - [ ] A new placement or a new CDN file in the campaign has a test, and the `active-campaign` fixture in `fetch-cdn-scenario` covers it. - [ ] A changed JSON format is copied to the `active-campaign` and `no-promotion` fixtures in `fetch-cdn-scenario`. After the launch: - [ ] The next nightly run (04:30 UTC) is green in Core and Pro. A failure is posted to the test automation results channel. - [ ] After the campaign ends, the nightly run stays green. "Not approved" means the after look was not approved: check it and approve it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Svitlana-Dykun <Svitlana-Dykun@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Creates a reusable composite action (
actions/fetch-cdn-scenario) that consolidates the CDN campaign promotion test infrastructure shared by elementor/elementor#38251, elementor/elementor-pro#7989, and elementor/elementor-pro#7992.Requested by reviewer
@davseveon:What's Included
Fetch script (
fetch-cdn-scenario.mjs)assets.elementor.com,assets.stg.elementor.red)--allow-failureflag to continue when CDN is unreachablelivescenarioMock CDN mu-plugin (
mock-editor-assets-cdn.php)assets.elementor.comfor.jsonfixtures insideeditor-assets-cdn/(validated withrealpath)e2e_cdn_scenariocookie with fallback tono-promotionpackages/v1/promotions.json), and free-to-pro upsellShared fixtures (
fixtures/no-promotion/,fixtures/active-campaign/)no-promotionscenario andactive-campaignscenario (including sidebar SVG fixtures) used by both Core and Pro Playwright testsAction Inputs
output-dircdn-sourcehttps://assets.stg.elementor.red) or local directory. Empty meanshttps://assets.elementor.comhttps://assets.elementor.comallow-failurefalsemu-plugins-dir''copy-fixturesno-promotionandactive-campaignfixtures to the parent ofoutput-dirtruefetch-liveoutput-dir. Set tofalseon PR CI to stay offlinetrueJira
Ref: ED-26391
✨ PR Description
1. Problem & Context
Implements a shared test infrastructure for CDN campaign promotions (ED-26391) to eliminate duplication between Core and Pro. It allows testing against live, staging, or mocked CDN data to ensure marketing campaigns don't break the editor.
2. What Changed (Where)
fetch-cdn-scenario.mjsmock-editor-assets-cdn.phpaction.ymlfixtures/no-promotionandactive-campaignJSON scenarios for stable E2E testing.README.md3. How It Works
The GitHub Action calls
fetch-cdn-scenario.mjsto download specific JSON paths from a source into a staging directory, swapping it toliveonly upon total success. Themock-editor-assets-cdn.phpplugin then interceptsassets.elementor.comHTTP requests, serving files from the specified scenario directory (determined by thee2e_cdn_scenariocookie) or falling back to the default scenario.4. Risks
CDN_PATHSandELEMENTOR_E2E_CDN_CACHE_OPTIONS.no-promotionandactive-campaignfixtures may diverge from actual CDN structures over time.Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how