Skip to content

Commit e279e38

Browse files
committed
START-4 add playwright
1 parent e2fb2d5 commit e279e38

File tree

21 files changed

+1493
-3873
lines changed

21 files changed

+1493
-3873
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ jobs:
3333
- uses: actions/setup-node@v4
3434
- name: Install Dependencies
3535
run: npm ci
36-
env:
37-
# skip installing cypress since it isn't needed for just building
38-
# This decreases the deploy time quite a bit
39-
CYPRESS_INSTALL_BINARY: 0
4036
- uses: concord-consortium/s3-deploy-action@v1
4137
id: s3-deploy
4238
with:

.github/workflows/playwright.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Playwright Tests
2+
on:
3+
push:
4+
branches: [ main, master ]
5+
pull_request:
6+
jobs:
7+
test:
8+
timeout-minutes: 60
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: lts/*
15+
- name: Install dependencies
16+
run: npm ci
17+
- name: Install Playwright Browsers
18+
run: npx playwright install --with-deps chromium
19+
- name: Run Playwright tests
20+
run: npx playwright test
21+
env:
22+
PLAYWRIGHT_CI: "true"
23+
- name: Upload coverage to Codecov
24+
uses: codecov/codecov-action@v5
25+
with:
26+
flags: playwright
27+
token: ${{ secrets.CODECOV_TOKEN }}
28+
- uses: concord-consortium/s3-deploy-action/deploy-path@v1
29+
if: always()
30+
id: s3-deploy-path
31+
- name: Upload Playwright Report
32+
if: always()
33+
run: aws s3 sync ./playwright-report s3://models-resources/codap-plugin-starter-project/playwright-report/${{ steps.s3-deploy-path.outputs.deployPath }} --delete --cache-control "no-cache, max-age=0"
34+
env:
35+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
36+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
37+
38+
# This report summary action only works when it is run during a pull_request event. It uses
39+
# the info from the event to figure out what PR to add/update the comment on. At some point
40+
# it might be useful to update this action to support push events for branches attached to
41+
# PRs. That can be handled by this approach:
42+
# https://github.com/bcgov/action-get-pr/blob/main/action.yml
43+
- uses: daun/playwright-report-summary@v3
44+
if: always()
45+
with:
46+
report-file: results.json
47+
report-url: https://models-resources.concord.org/codap-plugin-starter-project/playwright-report/${{ steps.s3-deploy-path.outputs.deployPath }}/

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
# testing
55
/coverage
6-
cypress/screenshots/
6+
/playwright-report
7+
/test-results
78

89
# production
910
/build

codecov.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ignore:
2+
# We don't care about the coverage of the imported codap files
3+
- "src/codap"
4+
fixes:
5+
# In the coverage generated by Playwright testing the plugin embedded
6+
# in CODAP a `codap-plugin-starter-project/` prefix is added to all of the paths.
7+
# the line below strips that prefix off so Codecov can match the
8+
# coverage info with the files in this repository.
9+
- "codap-plugin-starter-project/::"

cypress.config.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

cypress/e2e/workspace.test.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

cypress/support/e2e.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

cypress/support/elements/app-elements.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

cypress/tsconfig.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ import typescriptEslint, { configs as tsConfigs } from "typescript-eslint";
1313
import js from "@eslint/js";
1414
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
1515
import { flatConfigs as importPluginConfig } from "eslint-plugin-import";
16-
import pluginCypress from "eslint-plugin-cypress/flat";
16+
import playwright from "eslint-plugin-playwright";
1717

18-
// This helper `config()` function replaces the basic [] used by
18+
// This helper `config()` function replaces the basic [] used by
1919
// eslint normally:
2020
// https://typescript-eslint.io/packages/typescript-eslint#config
2121
export default typescriptEslint.config(
2222
{
2323
name: "ignore dist and node_modules",
24-
ignores: ["dist/", "node_modules/", ".vscode/", "old.*"]
24+
ignores: ["dist/", "node_modules/", ".vscode/", "old.*"]
2525
},
2626
js.configs.recommended,
2727
tsConfigs.recommended,
@@ -84,8 +84,8 @@ export default typescriptEslint.config(
8484
"eqeqeq": ["error", "smart"],
8585
"@eslint-community/eslint-comments/no-unused-disable": "off", // enabled in eslint.build.config.mjs
8686
// Note: this has caused slowdowns in large projects
87-
"import/no-cycle": "warn",
88-
// Note: this has caused problems with overridden or aliased dependencies
87+
"import/no-cycle": "warn",
88+
// Note: this has caused problems with overridden or aliased dependencies
8989
// like the Concord mobx-state-tree override
9090
"import/no-extraneous-dependencies": "warn",
9191
"import/no-useless-path-segments": "warn",
@@ -99,7 +99,7 @@ export default typescriptEslint.config(
9999
"no-tabs": "error",
100100
"no-unneeded-ternary": "error",
101101
// there is a recommended typescript rule for this too, so this might be redundant
102-
"no-unused-expressions": ["error", { allowShortCircuit: true }],
102+
"no-unused-expressions": ["error", { allowShortCircuit: true }],
103103
"no-unused-vars": "off", // superseded by @typescript-eslint/no-unused-vars
104104
"no-useless-call": "error",
105105
"no-useless-concat": "error",
@@ -128,10 +128,10 @@ export default typescriptEslint.config(
128128
},
129129
// The projectService is required to use the @typescript-eslint/prefer-optional-chain rule
130130
// The projectService does not work well with files that aren't configured by a tsconfig.json
131-
// file, so we only apply it to the files in src and cypress.
131+
// file, so we only apply it to the files in src and playwright.
132132
{
133-
name: "rules only for project and cypress typescript files",
134-
files: ["src/**/*.ts", "src/**/*.tsx", "cypress/**/*.ts", "cypress/**/*.tsx"],
133+
name: "rules only for project and playwright typescript files",
134+
files: ["src/**/*.ts", "src/**/*.tsx", "playwright/**/*.ts", "playwright/**/*.tsx"],
135135
languageOptions: {
136136
parserOptions: {
137137
projectService: true,
@@ -163,40 +163,35 @@ export default typescriptEslint.config(
163163
"jest/no-done-callback": "off"
164164
}
165165
},
166-
{
167-
name: "rules specific to Cypress tests",
168-
files: ["cypress/**"],
169-
extends: [
170-
pluginCypress.configs.recommended
171-
],
166+
{
167+
...playwright.configs["flat/recommended"],
168+
name: "rules specific to Playwright tests",
169+
files: ["playwright/**"],
172170
rules: {
173-
"@typescript-eslint/no-require-imports": "off",
174-
"@typescript-eslint/no-non-null-assertion": "off",
175-
"@typescript-eslint/no-var-requires": "off",
176-
"cypress/no-unnecessary-waiting": "off"
171+
...playwright.configs["flat/recommended"].rules
177172
}
178173
},
179174
{
180175
name: "json files",
181176
files: ["**/*.json"],
182177
...json.configs.recommended
183178
},
184-
{
179+
{
185180
name: "eslint configs",
186181
files: ["eslint.*.mjs"],
187182
languageOptions: {
188183
globals: {
189184
...globals.node
190-
},
185+
},
191186
},
192-
},
187+
},
193188
{
194189
name: "webpack configs",
195190
files: ["webpack.config.js"],
196191
languageOptions: {
197192
globals: {
198193
...globals.node
199-
},
194+
},
200195
},
201196
rules: {
202197
"@typescript-eslint/no-require-imports": "off",
@@ -210,7 +205,7 @@ export default typescriptEslint.config(
210205
languageOptions: {
211206
globals: {
212207
...globals.node
213-
},
208+
},
214209
},
215210
rules: {
216211
"@typescript-eslint/no-require-imports": "off",

0 commit comments

Comments
 (0)