Skip to content
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

Add basic insertion E2E tests. #81

Merged
merged 9 commits into from
Dec 21, 2023
Merged

Add basic insertion E2E tests. #81

merged 9 commits into from
Dec 21, 2023

Conversation

ryanwelcher
Copy link
Collaborator

@ryanwelcher ryanwelcher commented Dec 21, 2023

This PR adds basic E2E tests for each block to be sure that they are correctly inserted into the block editor.

Closes: #78.

Testing

  • Run wp-env start in the root directory of the project
  • Run the tests with npm run test:e2e

If you run into issues, you may need to have pnpm install the devDependencies using pnpm install -D

@juanmaguitar
Copy link
Collaborator

juanmaguitar commented Dec 21, 2023

I'm getting this error after following the instructions

⬢  block-development-examples  feature/add-e2e-tests ⦾ npm run test:e2e:debug

> block-development-examples@1.0.0 test:e2e:debug
> wp-scripts test-playwright --debug


Running 23 tests using 1 worker

  ✘  1 [chromium] › insertion.spec.js:36:7 › Block added to block editor › block-development-examples/counter-alpine-99def1 (41ms)


  1) [chromium] › insertion.spec.js:36:7 › Block added to block editor › block-development-examples/counter-alpine-99def1

    Error: browserType.launch: Executable doesn't exist at /Users/juanmanuelgarrido/Library/Caches/ms-playwright/chromium-1091/chrome-mac/Chromium.app/Contents/MacOS/Chromium
    ╔═════════════════════════════════════════════════════════════════════════╗
    ║ Looks like Playwright Test or Playwright was just installed or updated. ║
    ║ Please run the following command to download new browsers:              ║
    ║                                                                         ║
    ║     npx playwright install                                              ║
    ║                                                                         ║
    ║ <3 Playwright Team                                                      ║
    ╚═════════════════════════════════════════════════════════════════════════╝




    attachment #1: trace (application/zip) ─────────────────────────────────────────────────────────
    artifacts/test-results/insertion-Block-added-to-block-editor-block-development-examples-counter-alpine-99def1-chromium/trace.zip
    Usage:

        npx playwright show-trace artifacts/test-results/insertion-Block-added-to-block-editor-block-development-examples-counter-alpine-99def1-chromium/trace.zip

    ────────────────────────────────────────────────────────────────────────────────────────────────

Testing stopped early after 1 maximum allowed failures.
  1 failed
    [chromium] › insertion.spec.js:36:7 › Block added to block editor › block-development-examples/counter-alpine-99def1
  22 did not run

If I do npx playwright install I get

⬢  block-development-examples  feature/add-e2e-tests ⦾  npx playwright install
sh: playwright: command not found

@juanmaguitar
Copy link
Collaborator

juanmaguitar commented Dec 21, 2023

Running npx playwright@latest install did the trick.
The tests work and pass now for me ✅

@ryanwelcher ryanwelcher merged commit eeecf9a into trunk Dec 21, 2023
3 checks passed
@ryanwelcher ryanwelcher deleted the feature/add-e2e-tests branch December 21, 2023 15:05
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.

Add E2E tests for blocks.
2 participants