Comments (8)
This is the whole repository, I'm trying to migrate from Puppeteer to Playwright:
https://github.com/popperjs/popper-core/tree/test/playwright
You can find the Jest configuration in the .config
folder.
from jest-playwright.
@FezVrasta thank you!
from jest-playwright.
@FezVrasta I just made repo for example configuration. I suppose you need to define jest preset.
- You can add it to your
package.json
:
"jest": {
"preset": "jest-playwright-preset"
},
- Or you can do it with
jest.config.js
file:
module.exports = {
preset: "jest-playwright-preset"
}
I suppose it should be placed in README
from jest-playwright.
That's what I have done.
If I manually apply the globalSetup
, globalTeardown
and testEnvironment
Jest configuration properties it works though...
My config looks like this:
module.exports = {
preset: 'jest-playwright-preset',
testMatch: ['<rootDir>/src/**/*.test.js', '<rootDir>/tests/**/*.test.js'],
globals: {
__DEV__: true,
},
// globalSetup: 'jest-environment-puppeteer/setup',
// globalTeardown: 'jest-environment-puppeteer/teardown',
// testEnvironment: 'jest-environment-jsdom-fourteen',
setupFilesAfterEnv: ['<rootDir>/tests/setupTests.js'],
reporters: ['default', require.resolve('../tests/image-reporter.js')],
setupFiles: ['dotenv/config'],
modulePathIgnorePatterns: ['tests/visual/dist'],
};
If I replace "preset"
with:
testEnvironment: 'jest-playwright-preset',
globalSetup: 'jest-playwright-preset/setup',
globalTeardown: 'jest-playwright-preset/teardown',
then it works correctly
from jest-playwright.
@FezVrasta it's difficult to say what is going wrong without whole configuration. I can only suppose that some of other options can override jest-playwright-preset
. I'll try to dive into this issue to search possible problems.
from jest-playwright.
@FezVrasta I suppose this is because you define testEnvironment:
https://github.com/popperjs/popper-core/blob/fe24beeb92da1bb9573d2e6929940220008c263b/.config/jest.config.js#L6
And jest-playwright-preset
like jest-puppeteer
use it under hood.
I think this info should be added in README
from jest-playwright.
No that's not it, you can safely remove testEnvironment
globalSetup
and globalTeardown
and add back preset
and you will still reproduce the issue.
Also, I define test-environment
with a jsdoc comment on each test that requires Playwright, so that would take precedence in any case. (and in fact it does, and manually specifying globalSetup
and globalTeardown
everything works)
The problem is with globalSetup
and globalTeardown
from jest-playwright.
for others that stumble upon this issue... i had to comment out
testEnvironment: "node", // comment this line out
the jest --init
created this setting by default for the jest.config.js
it generated.
from jest-playwright.
Related Issues (20)
- [Question] Access to the displayName: 'edge' from the test file HOT 1
- "useDefaultBrowserType" property leads to "no tests were found"
- Provides the method for getting the `baseURL` HOT 1
- Support playwright v1.15.0 HOT 1
- Add strictness option to config HOT 1
- jestPlaywright is not defined HOT 3
- Unable to switch to inner frame in playwright HOT 1
- Question: history.pushState instead of full page load? HOT 2
- RevoGrid Problem HOT 1
- Not Able to Use jest-playwright-preset in Playwright Docker Container HOT 5
- Got the error >>TypeError: this[(intermediate value)(intermediate value)(intermediate value)] is not a function HOT 3
- Support Jest 28 HOT 1
- how to specify record starting point HOT 2
- Test suites fail to lauch after upgrading playwright to 1.23.0 version HOT 4
- ReferenceError: page is not defined after upgrading to version 2.0.0 and jest 28.1.3 HOT 1
- TypeScript Build Failure: global.d.ts(233,5): error TS2709: Cannot use namespace 'JestConfig' as a type. HOT 3
- Support Jest 29 HOT 2
- [Question/Help] Record video for firefox
- Support Playwright Android Integration
- Support disabling animations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jest-playwright.