1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-30 13:58:08 +00:00

create playwright

This commit is contained in:
Nebel 2024-10-24 21:31:42 +09:00
parent 876d84fb75
commit ffe2af2621
Signed by: nebel
GPG key ID: 79807D08C6EF6460
6 changed files with 138 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
node_modules/
dist/
test-results/
.next/
.env

View file

@ -0,0 +1,21 @@
import { expect, test } from "@playwright/test";
test("first", async ({ page }) => {
// @ts-ignore
await page.goto(`file:///${__dirname}/test.html`);
// playwright test --browser=chromium : pass
// playwright test --browser=firefox : pass
// playwright test --browser=webkit : fail (return `1\n`)
expect(await page.innerText("first-test")).toBe(`1`);
});
test("second", async ({ page }) => {
// @ts-ignore
await page.goto(`file:///${__dirname}/test.html`);
// playwright test --browser=chromium : pass
// playwright test --browser=firefox : pass
// playwright test --browser=webkit : fail (return `2\n`)
expect(await page.innerText("second-test")).toBe(`2`);
});

75
playwright/package-lock.json generated Normal file
View file

@ -0,0 +1,75 @@
{
"name": "playwright",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"devDependencies": {
"@playwright/test": "^1.48.1"
}
},
"node_modules/@playwright/test": {
"version": "1.48.1",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.48.1.tgz",
"integrity": "sha512-s9RtWoxkOLmRJdw3oFvhFbs9OJS0BzrLUc8Hf6l2UdCNd1rqeEyD4BhCJkvzeEoD1FsK4mirsWwGerhVmYKtZg==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"playwright": "1.48.1"
},
"bin": {
"playwright": "cli.js"
},
"engines": {
"node": ">=18"
}
},
"node_modules/fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/playwright": {
"version": "1.48.1",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.48.1.tgz",
"integrity": "sha512-j8CiHW/V6HxmbntOfyB4+T/uk08tBy6ph0MpBXwuoofkSnLmlfdYNNkFTYD6ofzzlSqLA1fwH4vwvVFvJgLN0w==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"playwright-core": "1.48.1"
},
"bin": {
"playwright": "cli.js"
},
"engines": {
"node": ">=18"
},
"optionalDependencies": {
"fsevents": "2.3.2"
}
},
"node_modules/playwright-core": {
"version": "1.48.1",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.48.1.tgz",
"integrity": "sha512-Yw/t4VAFX/bBr1OzwCuOMZkY1Cnb4z/doAFSwf4huqAGWmf9eMNjmK7NiOljCdLmxeRYcGPPmcDgU0zOlzP0YA==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"playwright-core": "cli.js"
},
"engines": {
"node": ">=18"
}
}
}
}

8
playwright/package.json Normal file
View file

@ -0,0 +1,8 @@
{
"scripts": {
"test": "playwright test"
},
"devDependencies": {
"@playwright/test": "^1.48.1"
}
}

View file

@ -0,0 +1,18 @@
import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
projects: [
{
name: "chromium",
use: devices["Desktop Chrome"],
},
{
name: "firefox",
use: devices["Desktop Firefox"],
},
{
name: "webkit",
use: devices["Desktop Safari"],
},
],
});

15
playwright/test.html Normal file
View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<first-test><div>1</div></first-test>
<second-test>
<div>2</div>
<div></div>
</second-test>
</body>
</html>