GithubHelp home page GithubHelp logo

playwright-community / playwright-jest-examples Goto Github PK

View Code? Open in Web Editor NEW
98.0 3.0 45.0 179 KB

Demonstrates the usage of Playwright (cross-browser automation library in Node.js) in combination with Jest on GitHub Actions to test various setups.

Home Page: https://playwright.tech

License: MIT License

JavaScript 27.11% TypeScript 41.00% HTML 12.82% CSS 19.08%
jest playwright typescript expect testing e2e

playwright-jest-examples's Introduction

playwright-jest-examples's People

Contributors

mxschmitt avatar ocavue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

playwright-jest-examples's Issues

Unable to run examples

Downloaded the repo, done an npm install, and ran npm run tests... get the following error message...

Executing task: npm run test <

[email protected] test C:\sandbox\playwright-jest-examples\basic-ts
jest

C:\sandbox\playwright-jest-examples\basic-ts\node_modules\jest-playwright-preset\node_modules\uuid\dist\esm-browser\index.js:1
export { default as v1 } from './v1.js';
^^^^^^

SyntaxError: Unexpected token 'export'
at wrapSafe (internal/modules/cjs/loader.js:1043:16)
at Module._compile (internal/modules/cjs/loader.js:1091:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
at Module.load (internal/modules/cjs/loader.js:976:32)
at Function.Module._load (internal/modules/cjs/loader.js:884:14)
at Module.require (internal/modules/cjs/loader.js:1016:19)
at require (internal/modules/cjs/helpers.js:69:18)
at Object. (C:\sandbox\playwright-jest-examples\basic-ts\node_modules\jest-playwright-preset\lib\coverage.js:26:27)
at Module._compile (internal/modules/cjs/loader.js:1121:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)

Test Suites: 0 of 4 total
Tests: 0 total
Snapshots: 0 total
Time: 0 snpm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: jest
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\arshadsurti\AppData\Roaming\npm-cache_logs\2020-07-15T09_35_22_271Z-debug.log
The terminal process terminated with exit code: 1

CRA example

What do you think about creating an example with usage of create-react-app? I can make PR)

React sample is not working

A sample from folder 'create-react-app' is not working.

I've checked it out, ran 'yarn', then tried to launch it by pressing play button near 'describe' in Webstorm.

image

Unable to run the create-react-app-coverage example

I'm testing the create-react-app-coverage and when I run npm run test, react-scripts throws an error:

The react-scripts package provided by Create React App requires a dependency:

  "jest": "26.6.0"

Don't try to install it manually: your package manager does it automatically.
However, a different version of jest was detected higher up in the tree

Here is how I run this command:

+ codespace ➜ /tmp $ git clone https://github.com/playwright-community/playwright-jest-examples.git
Cloning into 'playwright-jest-examples'...
remote: Enumerating objects: 79, done.
remote: Counting objects: 100% (79/79), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 287 (delta 46), reused 57 (delta 41), pack-reused 208
Receiving objects: 100% (287/287), 165.36 KiB | 776.00 KiB/s, done.
Resolving deltas: 100% (150/150), done.
codespace ➜ /tmp $ cd playwright-jest-examples
+ codespace ➜ /tmp/playwright-jest-examples (master) $ git log --oneline -n 1
9979025 (HEAD -> master, origin/master, origin/HEAD) chore: bump Playwright to 1.9.0 (#20)
+ codespace ➜ /tmp/playwright-jest-examples (master) $ node --version
v14.15.1
+ codespace ➜ /tmp/playwright-jest-examples (master) $ npm --version
6.14.8
+ codespace ➜ /tmp/playwright-jest-examples (master) $ cd create-react-app-coverage/
+ codespace ➜ /tmp/playwright-jest-examples/create-react-app-coverage (master) $ npm install 
added 1907 packages from 832 contributors and audited 1912 packages in 30.189s

137 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

+ codespace ➜ /tmp/playwright-jest-examples/create-react-app-coverage (master) $ npm run test

 > [email protected] test /tmp/playwright-jest-examples/create-react-app-coverage
 > jest -c jest.config.js && nyc report --reporter=lcovonly


Jest dev-server output:
[Jest Process Manager] 
 > [email protected] start /tmp/playwright-jest-examples/create-react-app-coverage
 > react-app-rewired start


There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.

The react-scripts package provided by Create React App requires a dependency:

  "jest": "26.6.0"

Don't try to install it manually: your package manager does it automatically.
However, a different version of jest was detected higher up in the tree:

  /tmp/playwright-jest-examples/create-react-app-coverage/node_modules/jest (version: 26.6.3) 

Manually installing incompatible versions is known to cause hard-to-debug issues.

If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.

To fix the dependency tree, try following the steps below in the exact order:

  1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
  2. Delete node_modules in your project folder.
  3. Remove "jest" from dependencies and/or devDependencies in the package.json file in your project folder.
  4. Run npm install or yarn, depending on the package manager you use.

In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:

  5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
     This may help because npm has known issues with package hoisting which may get resolved in future versions.

  6. Check if /tmp/playwright-jest-examples/create-react-app-coverage/node_modules/jest is outside your project directory.
     For example, you might have accidentally installed something in your home folder.

  7. Try running npm ls jest in your project folder.
     This will tell you which other package (apart from the expected react-scripts) installed jest.

If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.

P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-app-rewired start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/codespace/.npm/_logs/2021-03-21T15_21_06_446Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `jest -c jest.config.js && nyc report --reporter=lcovonly`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/codespace/.npm/_logs/2021-03-21T15_21_06_486Z-debug.log
+ codespace ➜ /tmp/playwright-jest-examples/create-react-app-coverage (master) $ 

Provided example does not record videos

Provided example of recording videos with playwrignt-jest does not record videos.

Note:

  • I haven't changed anything in this project.
  • Just git cloned it, run yarn and yarn test

Attaching screenshots to prove that videos are not recorded if tests fail and if tests pass (videos folder hasn't been even created):
Screen Shot 2021-05-24 at 1 33 34 PM
Screen Shot 2021-05-24 at 1 33 00 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.