feat: initial setup
This commit is contained in:
Родитель
1e22b21241
Коммит
133323800b
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"env": {
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"globals": {
|
||||
"Atomics": "readonly",
|
||||
"SharedArrayBuffer": "readonly"
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
},
|
||||
"rules": {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
name: "tests"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- 'releases/*'
|
||||
|
||||
jobs:
|
||||
test-linux:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-node@v1
|
||||
- uses: ./
|
||||
- name: Run Playwright
|
||||
run: cd sample && npm install && node index.js
|
||||
|
||||
test-mac:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-node@v1
|
||||
- uses: ./
|
||||
- name: Run Playwright
|
||||
run: cd sample && npm install && node index.js
|
||||
|
||||
test-win:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-node@v1
|
||||
- uses: ./
|
||||
- name: Run Playwright
|
||||
run: cd sample && npm install && node index.js
|
|
@ -1,104 +1,5 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
node_modules
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
yarn-error.log
|
||||
.vscode
|
||||
|
|
19
README.md
19
README.md
|
@ -1,5 +1,22 @@
|
|||
# Playwright GitHub Action
|
||||
|
||||
# Contributing
|
||||
Set up your GitHub Actions runner to run Playwright tests.
|
||||
|
||||
## Usage
|
||||
|
||||
```yml
|
||||
jobs:
|
||||
e2e-tests:
|
||||
runs-on: ubuntu-latest # or macos-latest, windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
- uses: microsoft/playwright-github-action@v1
|
||||
- name: Install dependencies and run tests
|
||||
run: npm install && npm test
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
||||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
name: 'Playwright'
|
||||
description: 'Run Playwright tests on GitHub Actions'
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'dist/index.js'
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,33 @@
|
|||
const core = require('@actions/core');
|
||||
const { exec } = require('@actions/exec');
|
||||
const os = require('os');
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
if (os.platform() === 'linux') {
|
||||
exec('sudo', ['apt-get', 'update']);
|
||||
// For Chromium
|
||||
exec('sudo', ['apt-get', 'install', 'libgbm-dev']);
|
||||
// For WebKit
|
||||
exec('sudo', ['apt-get', 'install', 'libwoff1',
|
||||
'libopus0',
|
||||
'libwebp6',
|
||||
'libwebpdemux2',
|
||||
'libenchant1c2a',
|
||||
'libgudev-1.0-0',
|
||||
'libsecret-1-0',
|
||||
'libhyphen0',
|
||||
'libgdk-pixbuf2.0-0',
|
||||
'libegl1',
|
||||
'libgles2',
|
||||
'libevent-2.1-6',
|
||||
'libnotify4',
|
||||
'libxslt1.1']);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "playwright-github-action",
|
||||
"version": "0.1.0",
|
||||
"description": "Run Playwright tests on GitHub Actions",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"lint": "eslint index.js",
|
||||
"package": "ncc build index.js -o dist",
|
||||
"test": "eslint index.js && jest"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/microsoft/playwright-github-action.git"
|
||||
},
|
||||
"author": "Microsoft",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/microsoft/playwright-github-action/issues"
|
||||
},
|
||||
"homepage": "https://github.com/microsoft/playwright-github-action#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.1.1",
|
||||
"@actions/exec": "^1.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@zeit/ncc": "^0.20.5",
|
||||
"eslint": "^6.3.0",
|
||||
"jest": "^24.9.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
//@ts-check
|
||||
const playwright = require("playwright");
|
||||
|
||||
async function run(browserType) {
|
||||
const browser = await playwright[browserType].launch();
|
||||
const page = await browser.newPage();
|
||||
await page.goto('http://example.com');
|
||||
console.log(browserType, await page.evaluate(() => ({
|
||||
width: document.documentElement.clientWidth,
|
||||
clientHeight: document.documentElement.clientHeight
|
||||
})));
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
(async () => {
|
||||
await run('chromium');
|
||||
await run('webkit');
|
||||
await run('firefox');
|
||||
})();
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "sample",
|
||||
"dependencies": {
|
||||
"playwright": "^0.12.1"
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче