Skip to content

Commit

Permalink
Add playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
anselmbradford committed Jul 11, 2023
1 parent ba99ae8 commit 30ede10
Show file tree
Hide file tree
Showing 266 changed files with 658 additions and 2,711 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
playwright-report/

# Front-End #
#############
Expand Down
45 changes: 45 additions & 0 deletions .sauce/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apiVersion: v1alpha
kind: playwright
sauce:
region: us-west-1
concurrency: 3 # Controls how many suites are executed at the same time.
metadata:
tags:
- design-system-playwright
docker:
# Affects how test files are transferred to the docker container when using the docker mode.
fileTransfer: copy # Choose between mount|copy.
playwright:
version: package.json # See https://docs.saucelabs.com/dev/cli/saucectl/#supported-frameworks-and-browsers for a list of supported versions.
configFile: playwright.config.ts # See https://docs.saucelabs.com/dev/testrunner-toolkit/configuration/playwright#configuration-examples for a list of supported configuration files.
# Controls what files are available in the context of a test run (unless explicitly excluded by .sauceignore).
rootDir: ./
suites:
- name: 'Firefox Win'
platformName: 'Windows 11'
screenResolution: '1440x900'
testMatch: ['.*.js']
params:
browserName: 'firefox'
project: 'firefox' # Runs the project that's defined in `playwright.config.js`
- name: 'Chromium Mac'
platformName: 'macOS 12'
screenResolution: '1440x900'
testMatch: ['.*.js']
params:
browserName: 'chromium'
project: 'chromium'
- name: 'Webkit Win'
platformName: 'Windows 11'
screenResolution: '1440x900'
testMatch: ['.*.js']
params:
browserName: 'webkit'
project: 'webkit'
# Controls what artifacts to fetch when the suite on Sauce Cloud has finished.
# artifacts:
# download:
# when: always
# match:
# - console.log
# directory: ./artifacts/
15 changes: 15 additions & 0 deletions .sauceignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file instructs saucectl to not package any files mentioned here.
.git/
.github/
.DS_Store
.hg/
.vscode/
.idea/
.gitignore
.hgignore
.gitlab-ci.yml
.npmrc
*.gif
# Remove this to have node_modules uploaded with code
node_modules/

1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default {
moduleNameMapper: {
'\\.(svg)$': '<rootDir>/test/unit-test/mocks/fileMock.js',
},
modulePathIgnorePatterns: ['<rootDir>/test/browser'],
testEnvironmentOptions: {
url: 'http://localhost',
},
Expand Down
Binary file not shown.
Binary file removed npm-packages-offline-cache/@jest-schemas-28.1.3.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/@jest-types-28.1.3.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/@types-diff-5.0.3.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/@types-ejs-3.1.2.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/@types-inquirer-8.2.6.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/@types-keyv-3.1.4.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/@types-mocha-10.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/@types-node-18.16.19.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/@types-through-0.0.30.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/@types-tmp-0.2.3.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/@types-which-1.3.2.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/@wdio-cli-7.26.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/@wdio-config-7.26.0.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/@wdio-logger-7.26.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/@wdio-logger-8.11.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/@wdio-repl-7.26.0.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/@wdio-runner-7.26.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/@wdio-types-7.26.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/@wdio-utils-7.26.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/ansi-colors-4.1.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/ansi-regex-2.1.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/ansi-styles-2.2.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/archive-type-4.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/async-exit-hook-2.0.1.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/bl-1.2.3.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/browser-stdout-1.3.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/buffer-alloc-1.2.0.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/buffer-fill-1.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/cac-3.0.4.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/camelcase-3.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/camelcase-keys-3.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/capital-case-1.0.4.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/chalk-1.1.3.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/chalk-5.3.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/change-case-4.1.2.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/chokidar-3.5.3.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/chromedriver-113.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/clone-response-1.0.2.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/clone-response-1.0.3.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/constant-case-3.0.4.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/cross-spawn-4.0.2.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/css-value-0.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/debug-4.3.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/decamelize-4.0.0.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/decompress-4.2.1.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/decompress-tar-4.1.1.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/devtools-7.26.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/diff-5.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/diff-5.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/diff-sequences-28.1.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/download-8.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/duplexer3-0.1.5.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/easy-table-1.2.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/edge-paths-2.2.1.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/expect-28.1.3.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/ext-list-2.2.2.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/ext-name-5.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/fast-deep-equal-2.0.1.tgz
Binary file not shown.
Binary file added npm-packages-offline-cache/fast-fifo-1.3.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/file-type-11.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/file-type-3.9.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/file-type-4.4.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/file-type-5.2.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/file-type-6.2.0.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/filenamify-3.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/filter-obj-1.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/find-up-1.1.2.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/from2-2.3.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/gaze-1.1.3.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/get-stream-2.3.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/get-stream-3.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/get-stream-4.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/glob-7.1.7.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/glob-7.2.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/globule-1.3.4.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/got-11.8.6.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/got-8.3.2.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/has-ansi-2.0.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/hash.js-1.1.7.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/header-case-2.0.4.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/http2-wrapper-1.0.3.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/indent-string-3.2.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/inquirer-8.2.4.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/into-stream-3.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/ip-regex-4.3.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/is-binary-path-2.1.0.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/is-object-1.0.2.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/is-stream-1.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/is-url-1.2.4.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/is-utf8-0.2.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/is2-2.0.9.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/isurl-1.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/jest-diff-28.1.3.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/jest-get-type-28.0.2.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/jest-util-28.1.3.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/json-buffer-3.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/json-buffer-3.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/keyv-3.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/keyv-4.5.2.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/ky-0.30.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/load-json-file-1.1.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/lodash.isobject-3.0.2.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/lodash.zip-4.2.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/loglevel-1.8.1.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/lowercase-keys-1.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/lowercase-keys-1.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/lowercase-keys-2.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/lru-cache-4.1.5.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/make-dir-1.3.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/mimic-response-1.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/mimic-response-3.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/minimalistic-assert-1.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/minimatch-3.0.8.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/minimatch-5.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/mocha-10.2.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/nanoid-3.3.3.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/normalize-url-2.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/normalize-url-6.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/p-cancelable-0.4.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/p-cancelable-2.1.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/p-event-2.3.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/p-is-promise-1.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/p-iteration-1.1.8.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/p-timeout-2.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/parse-json-2.2.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/parse-ms-2.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/path-case-3.0.4.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/path-exists-2.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/path-type-1.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/pinkie-2.0.4.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/pinkie-promise-2.0.1.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/prepend-http-2.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/pretty-format-28.1.3.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/pretty-ms-7.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/pseudomap-1.0.2.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/query-string-5.1.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/query-string-7.1.3.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/read-pkg-1.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/read-pkg-up-1.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/readdirp-3.6.0.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/resolve-alpn-1.2.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/responselike-1.0.2.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/responselike-2.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/resq-1.11.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/rgb2hex-0.2.5.tgz
Binary file not shown.
Binary file added npm-packages-offline-cache/saucectl-0.151.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/saucelabs-7.2.2.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/seek-bzip-1.0.6.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/sentence-case-3.0.4.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/snake-case-3.0.4.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/sort-keys-1.1.2.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/split-on-first-1.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/split2-4.2.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/stream-buffers-3.0.2.tgz
Binary file not shown.
Binary file added npm-packages-offline-cache/streamx-2.15.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/strip-ansi-3.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/strip-bom-2.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/strip-dirs-2.1.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/strip-outer-1.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/suffix-0.1.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/supports-color-2.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/tar-stream-1.6.2.tgz
Binary file not shown.
Binary file added npm-packages-offline-cache/tar-stream-3.1.6.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/tcp-port-used-1.0.2.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/timed-out-4.0.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/to-buffer-1.1.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/trim-repeated-1.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/tunnel-0.0.6.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/ua-parser-js-1.0.35.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/upper-case-2.0.2.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/url-parse-lax-3.0.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/url-to-options-1.0.1.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/webdriver-7.26.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/webdriverio-7.26.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/workerpool-6.2.1.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/ws-8.5.0.tgz
Binary file not shown.
Binary file removed npm-packages-offline-cache/yallist-2.1.2.tgz
Binary file not shown.
Binary file not shown.
Binary file removed npm-packages-offline-cache/yarn-install-1.0.0.tgz
Binary file not shown.
13 changes: 4 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"serve-netlify": "netlify-cms-proxy-server",
"start": "yarn compile-dev && concurrently --kill-others \"yarn serve-netlify\" \"yarn serve-jekyll\" \"yarn compile-dev --watch\"",
"jest": "yarn node --experimental-vm-modules $(yarn bin jest)",
"test:browser": "wdio run ./wdio.config.cjs",
"test:browser:cloud": ": ${SAUCE_USERNAME?\"You need to define SAUCE_USERNAME and SAUCE_ACCESS_KEY env variables \"} && wdio run ./wdio.config.sauce.cjs"
"test:browser": "npx playwright test",
"test:browser:cloud": ": ${SAUCE_USERNAME?\"You need to define SAUCE_USERNAME and SAUCE_ACCESS_KEY env variables \"} && saucectl run --region us-west-1"
},
"browserslist": "> 0.5%, last 2 versions, Firefox ESR, not dead, ie >= 11",
"dependencies": {
Expand All @@ -64,14 +64,9 @@
"@babel/preset-env": "7.22.7",
"@babel/preset-react": "7.22.5",
"@lhci/cli": "0.12.0",
"@wdio/cli": "7.26.0",
"@wdio/local-runner": "7.26.0",
"@wdio/mocha-framework": "7.26.0",
"@wdio/sauce-service": "7.26.0",
"@wdio/spec-reporter": "7.26.0",
"@playwright/test": "1.36.0",
"autoprefixer": "10.4.14",
"babel-loader": "9.1.3",
"chromedriver": "113.0.0",
"concurrently": "8.2.0",
"css-loader": "6.8.1",
"cssnano": "6.0.1",
Expand All @@ -98,13 +93,13 @@
"postcss-loader": "7.3.3",
"prettier": "2.8.8",
"prop-types": "15.8.1",
"saucectl": "0.151.1",
"stylelint": "15.10.1",
"stylelint-config-prettier": "9.0.5",
"stylelint-config-recommended-less": "1.0.4",
"svg-inline-loader": "0.8.2",
"svgo": "3.0.2",
"terser-webpack-plugin": "5.3.9",
"wdio-chromedriver-service": "8.1.1",
"webpack": "5.88.1",
"webpack-cli": "5.1.4"
},
Expand Down
90 changes: 90 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { defineConfig, devices } from '@playwright/test';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './test/browser',
/* Maximum time one test can run for. */
timeout: 30 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 5000,
},
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://localhost:4000/design-system/',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { channel: 'chrome' },
// },
],

/* Folder for test artifacts such as screenshots, videos, traces, etc. */
// outputDir: 'test-results/',

/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// port: 3000,
// },
});
27 changes: 27 additions & 0 deletions test/browser/docs/interstitial.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { test, expect } from '@playwright/test';

test.describe('CMS interstitial page with editing instructions', () => {
test.describe('Editing a component page', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/design-system/components/banner-notification');
const editButton = await page.locator('#edit-page');
await expect(editButton).toBeVisible();
await editButton.click();
});

test("should show the interstitial if the user hasn't seen it before", async ({
page,
}) => {
await expect(page).toHaveTitle(
'Updating this website - CFPB Design System'
);
});

test.skip('should not show the interstitial if the user has already seen it', async ({
page,
}) => {
await expect(page.locator('button:text("Delete entry")')).toBeVisible();
await expect(page).toHaveTitle('Content Manager');
});
});
});
108 changes: 108 additions & 0 deletions test/browser/docs/netlify-cms.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import { test, expect } from '@playwright/test';

test.describe('Netlify CMS', () => {
const WAIT_FOR_DISPLAY_TIMEOUT = 60000;

test.describe('Editing the homepage', () => {
test.beforeEach(async ({ page }) => {
await page.goto(
'/design-system/admin/#/collections/special-pages/entries/home'
);
//await browser.pause(300);
const loginButton = await page.getByRole('button', { name: /Login/i });
// Wait for page to load netlify configuration and show the login button.
await expect(loginButton).toBeVisible();
await loginButton.click();
});

test('should allow the user to log in', async ({ page }) => {
const editorContainer = await page.locator('text=Page title');
// Wait for page to load netlify editor.
await expect(editorContainer).toBeVisible({
timeout: WAIT_FOR_DISPLAY_TIMEOUT,
});
});

test('should properly render a preview of a page', async ({ page }) => {
// The homepage's body field
const pageBodyField = await page.locator('#nc-root #description-field-2');
await expect(pageBodyField).toBeVisible({
timeout: WAIT_FOR_DISPLAY_TIMEOUT,
});
await pageBodyField.fill('');
await page.keyboard.press('Meta+A');
await page.keyboard.press('Backspace');
await pageBodyField.type('fun');
// The preview pane is an iframe
const previewPane = await page
.frameLocator('iframe#preview-pane')
.locator('body');
await expect(previewPane).toContainText('fun');
});
});

test.describe('Editing a component page', () => {
test.beforeEach(async ({ page }) => {
await page.reload();
await page.goto(
'/design-system/admin/#/collections/pages/entries/buttons'
);
// Make the browser a little wider than normal to prevent the "show details" tabs
// from triggering their mobile media queries
await page.setViewportSize({ width: 1850, height: 800 });
const loginButton = await page.getByRole('button', { name: /Login/i });
// Wait for page to load netlify configuration and show the login button.
await expect(loginButton).toBeVisible();
await loginButton.click();
});

test('should properly render a preview of a component page', async ({
page,
}) => {
// The button page's title field
const pageTitleField = await page.locator('#nc-root #title-field-1');
await expect(pageTitleField).toBeVisible({
timeout: WAIT_FOR_DISPLAY_TIMEOUT,
});
await pageTitleField.fill('');
await pageTitleField.type('best');
// The preview pane is an iframe
const previewPane = await page
.frameLocator('iframe#preview-pane')
.locator('body');
await expect(previewPane).toContainText('best');
});

test('should support switching between the various "show details" tabs', async ({
page,
}) => {
await page.setViewportSize({ width: 2000, height: 2000 });
// Wait for the editor to load
const editorContainer = await page.locator('text=Page title');
await expect(editorContainer).toBeVisible({
timeout: WAIT_FOR_DISPLAY_TIMEOUT,
});
// The preview pane is an iframe
const detailsButton = await page
.frameLocator('iframe#preview-pane')
.getByRole('button', { name: 'Show details' })
.first();
//const detailsButton = await page.locator('button=Show details');
await detailsButton.click();
//const implementationButton = await page.getByRole('link', {
// name: 'Implementation',
//});
const implementationButton = await page
.frameLocator('iframe#preview-pane')
.getByRole('link', { name: 'Implementation' })
.first();
await implementationButton.click();
// Move one level up the DOM tree
const implementationButtonParent = await page
.frameLocator('iframe#preview-pane')
.locator('li.m-tabs_list-item-selected')
.first();
await expect(implementationButtonParent).toContainText('Implementation');
});
});
});
Loading

0 comments on commit 30ede10

Please sign in to comment.