Skip to content

Commit

Permalink
fixes the issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vrknetha committed Dec 8, 2024
1 parent e7e2903 commit 7cf58bb
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 124 deletions.
66 changes: 37 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,47 @@ name: CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.49.0-jammy
image: mcr.microsoft.com/playwright:v1.40.1-jammy
options: --ipc=host
runs-on: ubuntu-latest


steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Lint
run: npm run lint

- name: Run tests
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" npm test
env:
CI: true
DEBUG: pw:api,pw:webserver

- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Lint
run: npm run lint

- name: Run tests
run: npm test
env:
CI: true
DEBUG: pw:api,pw:webserver

- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: |
playwright-report/
test-results/
retention-days: 30
34 changes: 24 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,50 @@ on:

jobs:
publish:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.49.0-jammy
image: mcr.microsoft.com/playwright:v1.40.1-jammy
options: --ipc=host
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Node.js for NPM
uses: actions/setup-node@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Lint
run: npm run lint

- name: Test
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" npm test
run: npm test
env:
CI: true
DEBUG: pw:api,pw:webserver

- name: Publish
run: npm publish
- name: Publish to NPM
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: |
playwright-report/
test-results/
retention-days: 30
34 changes: 0 additions & 34 deletions Dockerfile

This file was deleted.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"build": "tsc",
"test": "playwright test",
"test:report": "playwright show-report",
"test:docker": "docker build -t playwright-clipboard-tests . && docker run --rm playwright-clipboard-tests",
"prepare": "npm run build",
"lint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\"",
"lint:fix": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" --fix",
"lint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" \"playwright.config.ts\"",
"lint:fix": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" \"playwright.config.ts\" --fix",
"format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
"serve": "http-server -p 8080",
"preversion": "npm run lint && npm test",
Expand Down Expand Up @@ -49,7 +48,7 @@
"LICENSE"
],
"engines": {
"node": ">=18.0.0"
"node": ">=20.0.0"
},
"repository": {
"type": "git",
Expand Down
31 changes: 20 additions & 11 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ export default defineConfig({
testDir: './tests',
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: 1,
reporter: 'html',
reporter: 'list',
timeout: 120000,
expect: {
timeout: 30000,
Expand All @@ -16,7 +14,7 @@ export default defineConfig({
trace: 'on-first-retry',
actionTimeout: 30000,
navigationTimeout: 30000,
headless: true
headless: true,
},
webServer: {
command: 'npm run serve',
Expand All @@ -31,25 +29,36 @@ export default defineConfig({
name: 'chromium',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1280, height: 720 },
permissions: ['clipboard-read', 'clipboard-write'],
viewport: { width: 1280, height: 720 }
},
},
{
name: 'firefox',
use: {
...devices['Desktop Firefox'],
permissions: ['clipboard-read', 'clipboard-write'],
viewport: { width: 1280, height: 720 }
viewport: { width: 1280, height: 720 },
launchOptions: {
firefoxUserPrefs: {
'dom.events.testing.asyncClipboard': true,
'dom.events.asyncClipboard.readText': true,
'dom.events.asyncClipboard.clipboardItem': true,
'dom.events.asyncClipboard.writeText': true,
'permissions.default.clipboard-read': 1,
'permissions.default.clipboard-write': 1,
},
},
},
},
{
name: 'webkit',
use: {
...devices['Desktop Safari'],
permissions: ['clipboard-read', 'clipboard-write'],
viewport: { width: 1280, height: 720 }
viewport: { width: 1280, height: 720 },
launchOptions: {
args: ['--enable-clipboard-read', '--enable-clipboard-write'],
},
},
}
},
],
});
});
Loading

0 comments on commit 7cf58bb

Please sign in to comment.