-
Notifications
You must be signed in to change notification settings - Fork 67
Migrate e2e tests to WordPress Playground #3740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fbe8560
3369efd
a9c4f34
bf2273d
dfc6a50
307ccb5
c926050
7f41664
0717962
9e3d019
7335816
df16038
f4967ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| name: E2E Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ master, develop ] | ||
| pull_request: | ||
| branches: [ master, develop ] | ||
|
|
||
| # One run per PR or branch. A new push cancels the previous run. | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: lts/* | ||
| cache: npm | ||
| cache-dependency-path: package-lock.json | ||
| - name: Build Stackable Free Plugin | ||
| run: | | ||
| npm ci --legacy-peer-deps | ||
| npm run build:e2e | ||
| - name: Archive plugin build | ||
| run: tar --exclude=./node_modules --exclude=./.git -czf /tmp/stackable-e2e-build.tar.gz . | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: stackable-e2e-build | ||
| path: /tmp/stackable-e2e-build.tar.gz | ||
| retention-days: 1 | ||
|
|
||
| test: | ||
| needs: build | ||
| timeout-minutes: 60 | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| # stackable-playwright-matrix-start | ||
| - php_version: '8.5' | ||
| wp_version: '7.0' | ||
| - php_version: '7.4' | ||
| wp_version: '6.8' | ||
| # stackable-playwright-matrix-end | ||
| name: Free e2e PHP ${{ matrix.php_version }} WP ${{ matrix.wp_version }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: lts/* | ||
| cache: npm | ||
| cache-dependency-path: package-lock.json | ||
| - name: Restore plugin build | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: stackable-e2e-build | ||
| - name: Extract plugin build | ||
| run: tar -xzf stackable-e2e-build.tar.gz | ||
| - name: Install dependencies | ||
| run: npm ci --legacy-peer-deps | ||
| - name: Set the version suffix for the output | ||
| run: echo VERSION_SUFFIX=${GITHUB_REF_NAME//\//-} >> $GITHUB_ENV | ||
| - name: Cache Playwright Browsers | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.cache/ms-playwright | ||
| key: ${{ runner.os }}-playwright-${{ hashFiles('package-lock.json') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-playwright- | ||
| - name: Install Playwright Browsers | ||
| timeout-minutes: 15 | ||
| run: | | ||
| for attempt in 1 2 3; do | ||
| npx playwright install chromium --with-deps && exit 0 | ||
| echo "Playwright install failed on attempt $attempt" | ||
| sleep $((attempt * 30)) | ||
| done | ||
| exit 1 | ||
| - name: Run free Playwright e2e suite | ||
| id: run-playwright-tests | ||
| env: | ||
| WP_PHP_VERSION: ${{ matrix.php_version }} | ||
| WP_VERSION: ${{ matrix.wp_version }} | ||
| run: npm run test:e2e | ||
| - uses: actions/upload-artifact@v4 | ||
| if: ${{ !cancelled() && steps.run-playwright-tests.outcome == 'failure' }} | ||
| id: artifact-upload-step | ||
| with: | ||
| name: playwright-report-php_${{ matrix.php_version }}-wp_${{ matrix.wp_version }}-${{ env.VERSION_SUFFIX }} | ||
| path: playwright-report/ | ||
| overwrite: true | ||
| retention-days: 30 | ||
| - uses: markpatterson27/markdown-to-output@v1 | ||
| id: mto | ||
| if: ${{ !cancelled() && steps.run-playwright-tests.outcome == 'failure' }} | ||
| with: | ||
| filepath: ./playwright-stk/errors.md | ||
| - name: Add test results to summary | ||
| if: ${{ !cancelled() && steps.run-playwright-tests.outcome == 'failure' }} | ||
| run: | | ||
| echo "${{ steps.mto.outputs.body }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "Report: [playwright-report-php_${{ matrix.php_version }}-wp_${{ matrix.wp_version }}-${{ env.VERSION_SUFFIX }}.zip](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.artifact-upload-step.outputs.artifact-id }})" >> $GITHUB_STEP_SUMMARY | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,8 +59,11 @@ Do not apply GitHub changes (close, comment, relabel) during issue triage withou | |
|
|
||
| ### Testing | ||
|
|
||
| - Unit / Jest: `npm test` (and related `test:*` scripts in `package.json`). | ||
| - Playwright e2e: see [`e2e/readme.md`](./e2e/readme.md) (`npm test` / `npm run test:debug` with `.env` configured). | ||
| - Unit / Jest: `npm run test:scripts` / `npm run test-old` (and related coverage scripts). | ||
| - Playwright e2e (WordPress Playground, no Docker): see [`e2e/readme.md`](./e2e/readme.md) | ||
| (`npm run build:e2e` then `npm run test:e2e` / `npm run test:debug`). | ||
| Premium: `npm run build:e2e:premium` then `npm run test:e2e:premium` with | ||
| `pro__premium_only/` present. | ||
|
Comment on lines
+65
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Keep the Premium instruction on one physical line. Lines 65-66 split one sentence across two lines. As per coding guidelines, "When writing or substantially editing long Markdown files, put each full sentence on its own line." 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| - Lint: `npm run lint` / `lint-js` / `lint-css` as appropriate for touched files. | ||
|
|
||
| ### Quality gate | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const TOP_LEVEL_BLOCKS: string[] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /** | ||
| * Inserter-facing Stackable blocks for catalog smokes. | ||
| * Child-only types are omitted; parent templates already include them. | ||
| * stackable/design-library is a picker, not saved content. | ||
| * | ||
| * Keep in sync with inserter-facing stackable blocks in src/block/<name>/block.json | ||
| * (parent unset, not stk-type child-only). New top-level blocks must be added here. | ||
| */ | ||
| const TOP_LEVEL_BLOCKS = [ | ||
| 'stackable/accordion', | ||
| 'stackable/blockquote', | ||
| 'stackable/button-group', | ||
| 'stackable/call-to-action', | ||
| 'stackable/card', | ||
| 'stackable/carousel', | ||
| 'stackable/columns', | ||
| 'stackable/count-up', | ||
| 'stackable/countdown', | ||
| 'stackable/divider', | ||
| 'stackable/expand', | ||
| 'stackable/feature', | ||
| 'stackable/feature-grid', | ||
| 'stackable/heading', | ||
| 'stackable/hero', | ||
| 'stackable/horizontal-scroller', | ||
| 'stackable/icon', | ||
| 'stackable/icon-box', | ||
| 'stackable/icon-label', | ||
| 'stackable/icon-list', | ||
| 'stackable/image', | ||
| 'stackable/image-box', | ||
| 'stackable/map', | ||
| 'stackable/notification', | ||
| 'stackable/number-box', | ||
| 'stackable/posts', | ||
| 'stackable/price', | ||
| 'stackable/pricing-box', | ||
| 'stackable/progress-bar', | ||
| 'stackable/progress-circle', | ||
| 'stackable/separator', | ||
| 'stackable/spacer', | ||
| 'stackable/subtitle', | ||
| 'stackable/table-of-contents', | ||
| 'stackable/tabs', | ||
| 'stackable/team-member', | ||
| 'stackable/testimonial', | ||
| 'stackable/text', | ||
| 'stackable/timeline', | ||
| 'stackable/video-popup', | ||
| ] | ||
|
|
||
| module.exports = { | ||
| TOP_LEVEL_BLOCKS, | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
Set explicit least-privilege permissions.
This workflow uses repository-default
GITHUB_TOKENpermissions.Set workflow-level permissions to
contents: read.Add another permission only when a step requires it.
Proposed change
on: push: branches: [ master, develop ] pull_request: branches: [ master, develop ] +permissions: + contents: read + jobs:🤖 Prompt for AI Agents
Source: Linters/SAST tools