Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PoC] Run parallel E2E tests #2641

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/e2e.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@ There are two ways two run the e2e tests, either in terminal or in browser:

E2E Test files are located under the `/teste2e` directory.

### (Experimental) Run tests in parallel

> Note: currently on experimental mode. Use it only for local development to
> speed up your tests run.

> You need to have Docker running in order to make this parallel testing

You can run parallel tests using the [sorry-cypress](https://docs.sorry-cypress.dev/)
alternative, instead of regular Cypress in order to avoid using Cypress
Dashboard, which requires an account and other KYC stuff. Fortunately, this
alternative wraps cypress into one docker image and opens it for usage.

**Parallel tests will only work with Mocked APIs tests suites**

1. Setup your sorry-cypress docker image: `yarn && yarn test:e2e:parallel:setup`
2. Run the application on development mode: `yarn start`
3. Open a new terminal windows (yes, plural) and run `yarn cy:run:parallel` on
each.

## How to write E2E tests

E2E tests are created to simulate **user** behavior among the application. This
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@
"test": "react-app-rewired test --env=jsdom",
"up": "docker-compose up --abort-on-container-exit --exit-code-from e2e",
"cy:run": "cd teste2e && yarn && cypress run",
"cy:run:parallel": "cd teste2e && yarn && CYPRESS_API_URL='http://localhost:1234/' cy2 run --parallel --record --key e2e-politeiagui --ci-build-id politeiagui",
"cy:open": "cd teste2e && yarn && cypress open",
"test:e2e:run": "START_SERVER_AND_TEST_INSECURE=1 start-server-and-test 'yarn start' https-get://localhost:3000 cy:run",
"test:e2e:browser": "START_SERVER_AND_TEST_INSECURE=1 start-server-and-test 'yarn start' https-get://localhost:3000 cy:open",
"test:e2e:parallel:setup": "docker run -d -p 1234:1234 agoldis/sorry-cypress-director",
"eject": "react-app-rewired eject",
"prettify": "prettier --write 'src/**/*.{js,jsx,css,json}'",
"prettify:diff": "prettier --list-different 'src/**/*.{js,jsx,css,json}'",
Expand All @@ -84,6 +86,7 @@
"@testing-library/cypress": "^7.0.3",
"connect": "^3.7.0",
"connect-api-mocker": "^1.7.0",
"cy2": "^1.3.0",
"cypress": "^7.0.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
Expand Down
41 changes: 39 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2448,6 +2448,11 @@ argparse@^1.0.7:
dependencies:
sprintf-js "~1.0.2"

argparse@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==

aria-query@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc"
Expand Down Expand Up @@ -3733,7 +3738,7 @@ comma-separated-tokens@^1.0.0:
resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz#632b80b6117867a158f1080ad498b2fbe7e3f5ea"
integrity sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==

commander@^2.11.0, commander@^2.19.0, commander@^2.20.0:
commander@^2.11.0, commander@^2.19.0, commander@^2.20.0, commander@^2.9.0:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
Expand Down Expand Up @@ -4328,6 +4333,15 @@ csstype@^3.0.2:
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.8.tgz#d2266a792729fb227cd216fb572f43728e1ad340"
integrity sha512-jXKhWqXPmlUeoQnF/EhTtTl4C9SnrxSH/jZUih3jmO6lBKr99rP3/+FmrMj4EFpOXzMtXHAZkd3x0E6h6Fgflw==

cy2@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/cy2/-/cy2-1.3.0.tgz#b01e731e6bef5c053602088e71be45411188a974"
integrity sha512-VE0YOGw9LmQHnmND1RrtJ/BJaCNCCGeOF8C4FUcV5OgS8G2zZytND3TC1TKuwEuFM/br17KIfgheql/rNRfv3g==
dependencies:
debug "^4.3.2"
js-yaml "^4.0.0"
npm-which "^3.0.1"

cyclist@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
Expand Down Expand Up @@ -7870,6 +7884,13 @@ js-yaml@^3.13.1:
argparse "^1.0.7"
esprima "^4.0.0"

js-yaml@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
dependencies:
argparse "^2.0.1"

jsbn@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
Expand Down Expand Up @@ -9296,6 +9317,13 @@ normalize.css@^8.0.1:
resolved "https://registry.yarnpkg.com/normalize.css/-/normalize.css-8.0.1.tgz#9b98a208738b9cc2634caacbc42d131c97487bf3"
integrity sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg==

npm-path@^2.0.2:
version "2.0.4"
resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.4.tgz#c641347a5ff9d6a09e4d9bce5580c4f505278e64"
integrity sha512-IFsj0R9C7ZdR5cP+ET342q77uSRdtWOlWpih5eC+lu29tIDbNEgDbzgVJ5UFvYHWhxDZ5TFkJafFioO0pPQjCw==
dependencies:
which "^1.2.10"

npm-run-path@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
Expand All @@ -9310,6 +9338,15 @@ npm-run-path@^4.0.0:
dependencies:
path-key "^3.0.0"

npm-which@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/npm-which/-/npm-which-3.0.1.tgz#9225f26ec3a285c209cae67c3b11a6b4ab7140aa"
integrity sha1-kiXybsOihcIJyuZ8OxGmtKtxQKo=
dependencies:
commander "^2.9.0"
npm-path "^2.0.2"
which "^1.2.10"

nth-check@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.2.tgz#b2bd295c37e3dd58a3bf0700376663ba4d9cf05c"
Expand Down Expand Up @@ -13830,7 +13867,7 @@ which-module@^2.0.0:
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=

[email protected], which@^1.2.9, which@^1.3.0, which@^1.3.1:
[email protected], which@^1.2.10, which@^1.2.9, which@^1.3.0, which@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==
Expand Down