Skip to content

Commit

Permalink
Run e2e tests in both Chrome and Electron (#5359)
Browse files Browse the repository at this point in the history
* Update circle.yml to run e2e tests in chrome + electron

* WIP: create multiple tests per browser, but utilizing the same base snapshot

- create a dynamic test title with browser appended
- use a base named snapshot without the browser name appended
- patch snap-shot-it not to rethrow twice unnecessarily which ends up
throwing the wrong error

* Add e2e.coffee to stop-only ignore

* Convert existing x-browser e2e tests to use e2e.it

* update snapshots

* really add e2e to stop-only skip

* Replace screenshot dimensions in all tests, run only in process.env.BROWSER

* add e2e.it to more tests that should be x-browser

* update snapshots

* PEMDAS

* default e2e browser -> electron

Run afterEaches when skipping testo

Recurse upwards with runAfterEach

stop promise chains

* Revert "default e2e browser -> electron"

This reverts commit 3104f99.

* Undo

* [email protected]

* Remove snap-shot-it patch

* Change e2e snapshot to use allowSharedSnapshot

* Add keepScreenshotDimensions to screenshot specs

* update snapshots

* fix snapshotit

* keepScreenshotDimensions: true -> sanitizeScreenshotDimensions: false

* Fix screenshot snapshots

* reduce snapshot noise

* rm 0_simple_spec

* deabstract circle.yml command

* fix circle.yml

* reduce snapshot noise

* clean up 6_visit_spec snapshot

* use allowSharedSnapshot: true in 5_spec_isolation

* Fix 5_screenshots, 2_form_submissions

* Normalize screenshot sizes in 5_spec_isolation snapshot

* Add sanitizeScreenshotDimensions only to non-e2e-project tests
Add --window-size=1280,720 --kiosk to chrome args

* update snapshots

* Use e2e.it for chrome/electron-specific tests

* handle logic for skipping tests when default browsers do not match specified browser

- implement e2e.it.skip to match mocha’s it.skip
- allow turning off dynamic test generation


Co-authored-by: Brian Mann <[email protected]>
  • Loading branch information
flotwig and brian-mann committed Oct 17, 2019
1 parent 868dc83 commit 561bd21
Show file tree
Hide file tree
Showing 75 changed files with 720 additions and 1,071 deletions.
220 changes: 139 additions & 81 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ executors:
PLATFORM: mac

commands:
run-e2e-tests:
parameters:
browser:
description: browser shortname to target
type: string
chunk:
description: e2e test chunk number
type: integer
steps:
- attach_workspace:
at: ~/
- run:
command: npm run test-e2e -- --chunk << parameters.chunk >> --browser << parameters.browser >>
working_directory: packages/server
- store_test_results:
path: /tmp/cypress
- store-npm-logs

store-npm-logs:
description: Saves any NPM debug logs as artifacts in case there is a problem
steps:
Expand Down Expand Up @@ -331,101 +349,117 @@ jobs:
path: /tmp/artifacts
- store-npm-logs

"server-e2e-tests-1":
"server-e2e-tests-chrome-1":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
command: npm run test-e2e -- --chunk 1
working_directory: packages/server
- store_test_results:
path: /tmp/cypress
- store-npm-logs
- run-e2e-tests:
browser: chrome
chunk: 1

"server-e2e-tests-2":
"server-e2e-tests-chrome-2":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
command: npm run test-e2e -- --chunk 2
working_directory: packages/server
- store_test_results:
path: /tmp/cypress
- store-npm-logs
- run-e2e-tests:
browser: chrome
chunk: 2

"server-e2e-tests-3":
"server-e2e-tests-chrome-3":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
command: npm run test-e2e -- --chunk 3
working_directory: packages/server
- store_test_results:
path: /tmp/cypress
- run-e2e-tests:
browser: chrome
chunk: 3

"server-e2e-tests-chrome-4":
<<: *defaults
steps:
- run-e2e-tests:
browser: chrome
chunk: 4

"server-e2e-tests-4":
"server-e2e-tests-chrome-5":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
command: npm run test-e2e -- --chunk 4
working_directory: packages/server
- store_test_results:
path: /tmp/cypress
- store-npm-logs
- run-e2e-tests:
browser: chrome
chunk: 5

"server-e2e-tests-5":
"server-e2e-tests-chrome-6":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
command: npm run test-e2e -- --chunk 5
working_directory: packages/server
- store_test_results:
path: /tmp/cypress
- store-npm-logs
- run-e2e-tests:
browser: chrome
chunk: 6

"server-e2e-tests-6":
"server-e2e-tests-chrome-7":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
command: npm run test-e2e -- --chunk 6
working_directory: packages/server
- store_test_results:
path: /tmp/cypress
- store-npm-logs
- run-e2e-tests:
browser: chrome
chunk: 7

"server-e2e-tests-7":
"server-e2e-tests-chrome-8":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
command: npm run test-e2e -- --chunk 7
working_directory: packages/server
- store_test_results:
path: /tmp/cypress
- store-npm-logs
- run-e2e-tests:
browser: chrome
chunk: 8

"server-e2e-tests-8":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
command: npm run test-e2e -- --chunk 8
working_directory: packages/server
- store_test_results:
path: /tmp/cypress
- store-npm-logs
"server-e2e-tests-electron-1":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 1

"server-e2e-tests-electron-2":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 2

"server-e2e-tests-electron-3":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 3

"server-e2e-tests-electron-4":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 4

"server-e2e-tests-electron-5":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 5

"server-e2e-tests-electron-6":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 6

"server-e2e-tests-electron-7":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 7

"server-e2e-tests-electron-8":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 8

"driver-integration-tests-chrome":
<<: *defaults
Expand Down Expand Up @@ -829,28 +863,52 @@ linux-workflow: &linux-workflow
- server-performance-tests:
requires:
- build
- server-e2e-tests-1:
- server-e2e-tests-chrome-1:
requires:
- build
- server-e2e-tests-chrome-2:
requires:
- build
- server-e2e-tests-chrome-3:
requires:
- build
- server-e2e-tests-chrome-4:
requires:
- build
- server-e2e-tests-chrome-5:
requires:
- build
- server-e2e-tests-chrome-6:
requires:
- build
- server-e2e-tests-chrome-7:
requires:
- build
- server-e2e-tests-chrome-8:
requires:
- build
- server-e2e-tests-electron-1:
requires:
- build
- server-e2e-tests-2:
- server-e2e-tests-electron-2:
requires:
- build
- server-e2e-tests-3:
- server-e2e-tests-electron-3:
requires:
- build
- server-e2e-tests-4:
- server-e2e-tests-electron-4:
requires:
- build
- server-e2e-tests-5:
- server-e2e-tests-electron-5:
requires:
- build
- server-e2e-tests-6:
- server-e2e-tests-electron-6:
requires:
- build
- server-e2e-tests-7:
- server-e2e-tests-electron-7:
requires:
- build
- server-e2e-tests-8:
- server-e2e-tests-electron-8:
requires:
- build
- driver-integration-tests-chrome:
Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"proxyquire": "2.1.0",
"shelljs": "0.8.3",
"sinon": "7.2.2",
"snap-shot-it": "7.8.0",
"snap-shot-it": "7.9.0",
"spawn-mock": "1.0.0",
"strip-ansi": "4.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"set-next-ci-version": "node ./scripts/binary.js setNextVersion",
"prestart": "npm run check-deps-pre",
"start": "node ./cli/bin/cypress open --dev --global",
"stop-only": "npx stop-only --skip .cy,.publish,.projects,node_modules,dist,dist-test,fixtures,lib,bower_components,spec_helper.coffee",
"stop-only": "npx stop-only --skip .cy,.publish,.projects,node_modules,dist,dist-test,fixtures,lib,bower_components --exclude e2e.coffee",
"stop-only-all": "npm run stop-only -- --folder packages",
"test": "echo '⚠️ This root monorepo is only for local development and new contributions. There are no tests.'",
"test-debug-package": "node ./scripts/test-debug-package.js",
Expand Down Expand Up @@ -152,7 +152,7 @@
"shelljs": "0.8.3",
"shx": "0.3.2",
"sinon": "7.3.2",
"snap-shot-it": "7.8.0",
"snap-shot-it": "7.9.0",
"stop-only": "3.0.1",
"strip-ansi": "4.0.0",
"terminal-banner": "1.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/server/__snapshots__/1_base_url_spec.coffee.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exports['e2e baseUrl https passes 1'] = `
exports['e2e baseUrl / https / passes'] = `
====================================================================================================
Expand Down Expand Up @@ -59,7 +59,7 @@ exports['e2e baseUrl https passes 1'] = `
`

exports['e2e baseUrl http passes 1'] = `
exports['e2e baseUrl / http / passes'] = `
====================================================================================================
Expand Down
Loading

4 comments on commit 561bd21

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 561bd21 Oct 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/linux-x64/circle-develop-561bd21cda05cf1f9027172b9b6b61c4c82a9a52-166839/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.0/circle-develop-561bd21cda05cf1f9027172b9b6b61c4c82a9a52-166837/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 561bd21 Oct 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/win32-ia32/appveyor-develop-561bd21cda05cf1f9027172b9b6b61c4c82a9a52-28166956/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.0/win32-ia32/appveyor-develop-561bd21cda05cf1f9027172b9b6b61c4c82a9a52-28166956/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 561bd21 Oct 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/win32-x64/appveyor-develop-561bd21cda05cf1f9027172b9b6b61c4c82a9a52-28166956/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.0/win32-x64/appveyor-develop-561bd21cda05cf1f9027172b9b6b61c4c82a9a52-28166956/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 561bd21 Oct 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/darwin-x64/circle-develop-561bd21cda05cf1f9027172b9b6b61c4c82a9a52-166845/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.0/circle-develop-561bd21cda05cf1f9027172b9b6b61c4c82a9a52-166846/cypress.tgz

Please sign in to comment.