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

Running e2e tests on Windows without Docker #10459

Closed
mnelson4 opened this issue Oct 9, 2018 · 6 comments
Closed

Running e2e tests on Windows without Docker #10459

mnelson4 opened this issue Oct 9, 2018 · 6 comments
Labels
[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Comments

@mnelson4
Copy link

mnelson4 commented Oct 9, 2018

Describe the bug
I am unable to run Gutenberg's end-to-end tests (using Jest and Puppeteer) successfully in a Windows-based dev environment called Laragon (similar to XAMPP). I have node and npm installed fine.
On https://wordpress.org/gutenberg/handbook/reference/testing-overview/#end-to-end-testing, I set the environment variables WP_BASE_URl, WP_ADMIN and WP_PASSWORD to those of a site hosted locally. Then when I run npm run test-e2e it runs for a bit, but then gives me the following error:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gutenberg@3.9.0 pretest-e2e: concurrently "./bin/reset-e2e-tests.sh" "npm run build" npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gutenberg@3.9.0 pretest-e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I believe it's because pretest-e2e runs concurrently \"./bin/reset-e2e-tests.sh\" \"npm run build\", where ./bin/reset-e2e-tests.sh is a bash file specifically designed for the Docker setup (see https://github.com/WordPress/gutenberg/blob/master/package.json#L183). It reports that Docker isn't setup and fails. It's right, but it should still work because I have a different setup.
If I change that script to instead just be npm run build the tests run ok.

To Reproduce
Steps to reproduce the behavior:

  1. Setup a WordPress local site using something besides Docker, like XAMPP or vagrant.
  2. Set the environment variables WP_BASE_URl, WP_ADMIN and WP_PASSWORD in your command prompt, then run npm run test-e2e from within the gutenberg's base folder.

Expected behavior
I would expect it to work to run the tests, without need any code modifications.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 7
  • Browser n/a
  • Version n/a

Additional context

  • Please add the version of Gutenberg you are using in the description.
  • To report a security issue, please visit the WordPress HackerOne program: https://hackerone.com/wordpress.
@Soean Soean added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Oct 9, 2018
@youknowriad
Copy link
Contributor

I think you can do wp-scripts test-e2e --config test/e2e/jest.config.json to run the tests without requiring the pre test script. Let me know if it works for you.

@mnelson4
Copy link
Author

thanks for chiming in @youknowriad, but I when I run wp-scripts test-e2e --config test/e2e/jest.config.json from the gutenberg plugin's root folder (on Gutenberg master branch, updated just now), I just see

'wp-scripts' is not recognized as an internal or external command,
operable program or batch file.

I'm not sure what setup I need to do to make that work (sorry, I'm a node newb).

But as I understand it, package.json's script test-e2e runs wp-scripts test-e2e --config test/e2e/jest.config.json, so I would think npm run test-e2e is equivalent. And that's the command I originally used (see above) that was giving me an error. (FYI npm run test-e2e still gives me the same error and still has the same fix as I originally reported.)

@youknowriad
Copy link
Contributor

Actually, it's npx wp-scripts test-e2e --config test/e2e/jest.config.json. Sorry I forgot npx. And the command npm run test-e2e is not strictly equivalent because this command will also run the "pre" command which assumes docker.

@mnelson4
Copy link
Author

oh yeah npx wp-scripts test-e2e --config test/e2e/jest.config.json works. Thanks. I wasn't aware of npx at all!
If anyone else has this issue, it might be good to mention that in the docs. But if it's just me, then ya the docs are probably fine as-is.

@youknowriad
Copy link
Contributor

Actually, there's an issue about docs for these commands... #8319

@mnelson4
Copy link
Author

👍 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
Projects
None yet
Development

No branches or pull requests

3 participants