openmct/.circleci/config.yml
John Hill 02c2fb5655
Implement e2e functional smoke testing and visual regression testing with playwright (#4456)
* First example of playwright

* Move config

* set junit output

* fix config and update version

* staged changes

* new files

* update to remote dir

* remove remote

* smoke

* Update smoke.spec.js

* Add eslint for playwright

* Add dependabot rule for playwright

* Add adhoc GHA for playwright

* Update tests and fix eslint

* move playwright eslint config to e2e dir

* Add to circle config

* store artifacts

* wrong location for storing artifacts

* slash?

* build before start

* increase timeouts in circle

* remove duplicate build step

* timeout values

* add retries

* reduce retries

* add percy emblem

* added percy

* Adds GHA for adhoc trigger and baseline visual

* Bump and Rev dependabot separte from karma

* update e2e label for additional pr logic

* Ignore playwright changes for codeql

* Update documentation

* Add ability to run all tests on pr label

* eof

* yamlamlaml

* issue instead of pull api

* archive results and include a link in the PR comment

* log context and attempt string concat

* concat fix

* add success/failure options

* add alure reporting

* lock playwright image

Co-authored-by: unlikelyzero <jchill2@gmail.com>
2021-11-29 16:34:47 -08:00

149 lines
4.3 KiB
YAML

version: 2.1
executors:
linux:
docker:
- image: mcr.microsoft.com/playwright:focal
orbs:
node: circleci/node@4.5.1
browser-tools: circleci/browser-tools@1.1.3
jobs:
npm-audit:
executor: linux
steps:
- checkout
- node/install:
install-npm: true
node-version: lts/fermium
- run: npm install
- run: npm audit --audit-level=low
test:
parameters:
node-version:
type: string
browser:
type: string
executor: linux
steps:
- checkout
- restore_cache:
key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}
- node/install:
install-npm: false
node-version: << parameters.node-version >>
- run: npm install
- when:
condition:
equal: [ "FirefoxESR", <<parameters.browser>> ]
steps:
- browser-tools/install-firefox:
version: "91.2.0esr" #https://archive.mozilla.org/pub/firefox/releases/
- when:
condition:
equal: [ "FirefoxHeadless", <<parameters.browser>> ]
steps:
- browser-tools/install-firefox
- when:
condition:
equal: [ "ChromeHeadless", <<parameters.browser>> ]
steps:
- browser-tools/install-chrome:
replace-existing: false
- save_cache:
key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}
paths:
- ~/.npm
- ~/.cache
- node_modules
- ~/Library/Caches/ms-playwright
- when:
condition:
equal: [ "", <<parameters.browser>> ] #Only run linting when browsers are not running to save time
steps:
- run: npm run lint
- when:
condition: << parameters.browser >> #Truthy evaluation to only run when browser is specified
steps:
- run: npm run test:coverage -- --browsers=<<parameters.browser>>
- store_test_results:
path: dist/reports/tests/
- store_artifacts:
path: dist/reports/
e2e:
parameters:
node-version:
type: string
suite:
type: string
executor: linux
environment:
NODE_ENV: development # Needed if playwright is in `devDependencies`
steps:
- checkout
- restore_cache:
key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}
- node/install:
install-npm: false
node-version: << parameters.node-version >>
- run: npm install
- save_cache:
key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}
paths:
- ~/.npm
- ~/.cache
- node_modules
- ~/Library/Caches/ms-playwright
- run: npm run test:e2e:<<parameters.suite>>
- store_test_results:
path: test-results/results.xml
- store_artifacts:
path: test-results
workflows:
matrix-tests:
jobs:
- test:
post-steps:
- run:
command:
curl -Os https://uploader.codecov.io/latest/linux/codecov;chmod +x codecov;./codecov
name: node10-chrome
node-version: lts/dubnium
browser: ChromeHeadless
- test:
name: node12-build-lint
node-version: lts/erbium
browser: "" #Skip unit tests
- test:
name: node14-build-lint
node-version: lts/fermium
browser: "" #Skip unit tests
- e2e:
name: e2e-smoke
node-version: lts/fermium
suite: ci
nightly:
jobs:
- test:
name: node10-chrome-nightly
node-version: lts/dubnium
browser: ChromeHeadless
- test:
name: node12-firefoxESR-nightly
node-version: lts/erbium
browser: FirefoxESR
- test:
name: node14-firefox-nightly
node-version: lts/fermium
browser: FirefoxHeadless
- npm-audit
- e2e:
name: e2e-full
node-version: lts/fermium
suite: full
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master