Skip to content

Commit

Permalink
Run playwright tests in CI
Browse files Browse the repository at this point in the history
#10337

Change-Id: I4d431777333eb4c516071630379f1e6ed87e1850
  • Loading branch information
planger committed Feb 11, 2022
1 parent f05fb11 commit c6be714
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Playwright Tests

on:
push:
branches:
- master
workflow_dispatch:
pull_request:
branches:
- master
schedule:
- cron: "0 4 * * *" # Runs every day at 4am: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule

jobs:
build-and-test-playwright:
name: ubuntu-18.04, Node.js 16.x

runs-on: ubuntu-18.04
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js "16.x"
uses: actions/setup-node@v1
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"

- name: Use Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Build
shell: bash
run: |
yarn --skip-integrity-check --network-timeout 100000
yarn browser build
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Test (playwright)
uses: GabrielBB/xvfb-action@v1
with:
run: yarn test:playwright
26 changes: 26 additions & 0 deletions examples/playwright/configs/playwright.ci.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/********************************************************************************
* Copyright (C) 2022 EclipseSource and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import { PlaywrightTestConfig } from '@playwright/test';
import baseConfig from './playwright.config';

const ciConfig: PlaywrightTestConfig = {
...baseConfig,
workers: 1,
retries: 1
};

export default ciConfig;
1 change: 1 addition & 0 deletions examples/playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"lint": "eslint -c ./.eslintrc.js --ext .ts ./src ./tests",
"lint:fix": "eslint -c ./.eslintrc.js --ext .ts ./src ./tests --fix",
"ui-tests": "yarn && playwright test --config=./configs/playwright.config.ts",
"ui-tests-ci": "yarn && playwright test --config=./configs/playwright.ci.config.ts",
"ui-tests-headful": "yarn && playwright test --config=./configs/playwright.headful.config.ts",
"ui-tests-report-generate": "allure generate ./allure-results --clean -o allure-results/allure-report",
"ui-tests-report": "yarn ui-tests-report-generate && allure open allure-results/allure-report"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"rebuild:clean": "rimraf .browser_modules",
"test": "yarn -s test:theia && yarn -s electron test && yarn -s browser test",
"test:theia": "lerna run --scope \"@theia/!(example-)*\" test --stream --concurrency=1",
"test:playwright": "concurrently --success first -c gray,blue -k -n theia,playwright \"yarn browser start\" \"yarn -s --cwd examples/playwright ui-tests-ci\"",
"watch": "concurrently --kill-others -n tsc,browser,electron -c red,yellow,blue \"tsc -b -w --preserveWatchOutput\" \"yarn -s --cwd examples/browser watch:bundle\" \"yarn -s --cwd examples/electron watch:bundle\"",
"watch:compile": "concurrently --kill-others -n cleanup,tsc -c magenta,red \"ts-clean dev-packages/* packages/* -w\" \"tsc -b -w --preserveWatchOutput\"",
"performance:startup": "yarn -s performance:startup:browser && yarn -s performance:startup:electron",
Expand Down

0 comments on commit c6be714

Please sign in to comment.