Skip to content
This repository was archived by the owner on Oct 17, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion basic-ts/jest-playwright.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://github.com/playwright-community/jest-playwright/#configuration
module.exports = {
browsers: ["chromium", "firefox", "webkit"],
launchBrowserApp: {
launchOptions: {
headless: true
}
}
12 changes: 6 additions & 6 deletions basic-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"test": "jest"
},
"devDependencies": {
"@types/jest": "^25.2.3",
"@types/node": "^14.0.5",
"@types/jest": "^26.0.0",
"@types/node": "^14.0.13",
"jest": "^26.0.1",
"jest-playwright-preset": "^0.2.2",
"playwright": "^1.0.2",
"ts-jest": "^26.0.0",
"typescript": "^3.9.3"
"jest-playwright-preset": "^1.0.0",
"playwright": "^1.1.1",
"ts-jest": "^26.1.1",
"typescript": "^3.9.5"
},
"dependencies": {}
}
2 changes: 1 addition & 1 deletion basic/jest-playwright.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://github.com/playwright-community/jest-playwright/#configuration
module.exports = {
browsers: ["chromium", "firefox", "webkit"],
launchBrowserApp: {
launchOptions: {
headless: true
}
}
4 changes: 2 additions & 2 deletions basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
},
"devDependencies": {
"jest": "^26.0.1",
"jest-playwright-preset": "^0.2.2",
"playwright": "^1.0.2"
"jest-playwright-preset": "^1.0.0",
"playwright": "^1.1.1"
},
"dependencies": {}
}
2 changes: 0 additions & 2 deletions create-react-app-coverage/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


# Jest create-react-app Playwright example with coverage

[![Coverage Status](https://coveralls.io/repos/github/playwright-community/playwright-jest-examples/badge.svg)](https://coveralls.io/github/playwright-community/playwright-jest-examples)
Expand Down
23 changes: 0 additions & 23 deletions create-react-app-coverage/after.js

This file was deleted.

7 changes: 4 additions & 3 deletions create-react-app-coverage/jest-playwright.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// https://github.com/playwright-community/jest-playwright/#configuration
module.exports = {
browsers: ['chromium', 'firefox', 'webkit'],
server: {
serverOptions: {
command: `BROWSER=none npm start`,
port: 3000,
launchTimeout: 10000,
debug: true,
},
launchBrowserApp: {
launchOptions: {
headless: true
}
},
collectCoverage: true
}
6 changes: 3 additions & 3 deletions create-react-app-coverage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@
"babel-plugin-istanbul": "^6.0.0",
"customize-cra": "^1.0.0",
"jest": "^26.0.1",
"jest-playwright-preset": "^0.2.5",
"jest-playwright-preset": "^1.0.0",
"nyc": "^15.1.0",
"playwright": "^1.1.1",
"react": "^16.13.1",
"react-app-rewired": "^2.1.6",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1",
"ts-jest": "^26.1.0",
"ts-jest": "^26.1.1",
"typescript": "^3.9.5"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "rm -rf .pw-cov && jest -c jest.config.js && node after.js && nyc report --reporter=lcovonly",
"test": "jest -c jest.config.js && nyc report --reporter=lcovonly",
"eject": "react-scripts eject"
},
"eslintConfig": {
Expand Down
19 changes: 1 addition & 18 deletions create-react-app-coverage/src/App.test.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
import fs from "fs";
import { promisify } from 'util'
import path from "path";

const fsWriteFile = promisify(fs.writeFile);

const COV_DIR = ".pw-cov"

beforeAll(async () => {
if (!fs.existsSync(COV_DIR)) {
fs.mkdirSync(COV_DIR)
}
})

beforeEach(async () => {
await page.goto('http://localhost:3000')
})

afterEach(async () => {
const coverage = await page.evaluate(`window.__coverage__`)
if (coverage) {
await fsWriteFile(path.join(COV_DIR, `${new Date().getTime()}.json`), JSON.stringify(coverage))
}
await jestPlaywright.saveCoverage(page)
})

test('use Turquoise as a default background color', async () => {
Expand Down
4 changes: 2 additions & 2 deletions create-react-app/jest-playwright.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// https://github.com/playwright-community/jest-playwright/#configuration
module.exports = {
browsers: ['chromium', 'firefox', 'webkit'],
server: {
serverOptions: {
command: `npm start`,
port: 3000,
launchTimeout: 10000,
debug: true,
},
launchBrowserApp: {
launchOptions: {
headless: true
}
}
4 changes: 2 additions & 2 deletions create-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"@types/react-dom": "^16.9.8",
"jest": "^26.0.1",
"jest-image-snapshot": "^4.0.2",
"jest-playwright-preset": "^0.2.5",
"jest-playwright-preset": "^1.0.0",
"playwright": "^1.1.1",
"playwright-core": "npm:playwright-chromium@>=1.1.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1",
"ts-jest": "^26.1.0",
"ts-jest": "^26.1.1",
"typescript": "^3.9.5"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playwright-video/jest-playwright.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://github.com/playwright-community/jest-playwright/#configuration
module.exports = {
browsers: ["chromium"],
launchBrowserApp: {
launchOptions: {
headless: true
}
}
8 changes: 4 additions & 4 deletions playwright-video/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"test": "jest"
},
"devDependencies": {
"ffmpeg-static": "^4.2.2",
"@ffmpeg-installer/ffmpeg": "^1.0.20",
"jest": "^26.0.1",
"jest-playwright-preset": "^0.2.2",
"playwright": "^1.0.2",
"playwright-video": "^1.0.2"
"jest-playwright-preset": "^1.0.0",
"playwright": "^1.1.1",
"playwright-video": "^2.2.0"
}
}