Skip to content

Commit

Permalink
Adds additional e2e tests and fixes existing ones (#641)
Browse files Browse the repository at this point in the history
* Fix changed image paths

* Adds tests for news

* Add alert test

* Add webform tests

* Add quickexit tests

* Fix publication test

* Add GTM test

* Re add sitemap test

* Add url test step

* Improve authenticated content test

* Update step definition to refer to node instead of page

* Working E2E tests

Working auth content test

Update circle CI to test this PR

disable chromeWebSecurity

Fix webform test

Fix auth content tests

fix quickexit

skip webform to diagnose timeout

Add circle step to run nightly on actual domain

use chrome browser and bump ram in CI

Add node 12 browser container

Remove browsers image and comment out failing alert test

fix news test

skip failing step in content preview test

fix publication test

update auth content yaml

Fix quickexit step

Use chrome instead of electron

Use form submit buttons to submit

fix preview content feature

Improve content preview test

Add a bit extra wait for CI

Fix news listing step

Add step to use preview link

remove  current url check

Use UUID for preview

Add waits in webform submission

More waits

more fixes

Better timeout handling on anchorlink test

Add grant test

Add nid for auth content and content preview

Add wait to content preview test

Add test for site section alert

Add wait for page navigation in anchorlink test

* Change alert title

* Add extra cleanup spec for alerts

* Extend timeout on preview redirect

* fix space in url

* Add tests into new project scaffolding

* Add tests into new project scaffolding

* Update packages/create-ripple-app/generators/updates/22.0.0/saofile.js

bump version in update script

Co-Authored-By: Tim Yao <[email protected]>

* Add siteid variable to smoke tests

* Use /user/login route to workaround BE issue

* Add scripts-prepend-node-path=true to fix yarn issue yarnpkg/yarn#6617

* Fix test regressions

* Fix conflicting nodeids for alerts

* use admin account for auth content

* extend wait for demolandingpage

* skip preview

* force select

* Add 2x parallelism

* Remove step that creates auth content taxonomy

* Fix content preview test

* remove quickexit cleanup

* Add a visit to homepage to warm cache before test

* Update CRA fixtures

Co-authored-by: Tim Yao <[email protected]>
  • Loading branch information
dylankelly and tim-yao authored Mar 29, 2020
1 parent f747a25 commit 0b21409
Show file tree
Hide file tree
Showing 161 changed files with 4,999 additions and 1,188 deletions.
89 changes: 62 additions & 27 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: 2.0
version: 2.1

jobs:
build:
docker:
- image: cypress/base:10
- image: cypress/base:12.0.0
environment:
TERM: xterm
CIRCLE_TEST_REPORTS: test-results
Expand All @@ -13,14 +13,14 @@ jobs:
- checkout
- restore_cache:
keys:
- v2-deps-{{ checksum "yarn.lock" }}
- v2-deps-{{ .Branch }}
- v2-deps
- v3-deps-{{ checksum "yarn.lock" }}
- v3-deps-{{ .Branch }}
- v3-deps
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
key: v2-deps-{{ checksum "yarn.lock" }}
key: v3-deps-{{ checksum "yarn.lock" }}
paths:
- node_modules
- packages/ripple-nuxt-tide/node_modules
Expand All @@ -40,15 +40,15 @@ jobs:

warm-up:
docker:
- image: cypress/base:10
- image: cypress/base:12.0.0
steps:
- run:
name: wake up dev backend
command: curl https://develop.content.vic.gov.au/ --max-time 1000

test:
docker:
- image: cypress/base:10
- image: cypress/base:12.0.0
environment:
TERM: xterm
CIRCLE_TEST_REPORTS: test-results
Expand All @@ -60,9 +60,9 @@ jobs:
at: ~/app
- restore_cache:
keys:
- v2-deps-{{ checksum "yarn.lock" }}
- v2-deps-{{ .Branch }}
- v2-deps
- v3-deps-{{ checksum "yarn.lock" }}
- v3-deps-{{ .Branch }}
- v3-deps
- run:
name: Lint code.
command: yarn lint --format ./node_modules/eslint-junit/index.js
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
e2e-vic-gov:
# This runs the full suite of e2e tests
docker:
- image: cypress/base:10
- image: cypress/browsers:node12.0.0-chrome73
environment:
TERM: xterm
TZ: "Australia/Melbourne"
Expand All @@ -106,9 +106,43 @@ jobs:
at: ~/app
- restore_cache:
keys:
- v2-deps-{{ checksum "yarn.lock" }}
- v2-deps-{{ .Branch }}
- v2-deps
- v3-deps-{{ checksum "yarn.lock" }}
- v3-deps-{{ .Branch }}
- v3-deps
- run:
name: run full e2e test
command: yarn test:e2e-vic
- run:
name: prepare cucumber test report
command: yarn test:report
when: always
- store_artifacts:
path: test-results
- store_test_results:
path: test-results
- store_artifacts:
path: examples/vic-gov-au/test/e2e/videos
- store_artifacts:
path: examples/vic-gov-au/test/e2e/screenshots

e2e-vic-gov-develop:
# Tests against the actual website using FQDN
docker:
- image: cypress/browsers:node12.0.0-chrome73
environment:
TERM: xterm
TZ: "Australia/Melbourne"
CYPRESS_BASE_URL: "https://www.develop.www.vic.gov.au"
working_directory: ~/app
parallelism: 1
steps:
- attach_workspace:
at: ~/app
- restore_cache:
keys:
- v3-deps-{{ checksum "yarn.lock" }}
- v3-deps-{{ .Branch }}
- v3-deps
- run:
name: run full e2e test
command: yarn test:e2e-vic
Expand All @@ -128,7 +162,7 @@ jobs:
e2e-example:
# This runs the full suite of e2e tests
docker:
- image: cypress/base:10
- image: cypress/browsers:node12.0.0-chrome73
environment:
TERM: xterm
working_directory: ~/app
Expand All @@ -137,9 +171,9 @@ jobs:
at: ~/app
- restore_cache:
keys:
- v2-deps-{{ checksum "yarn.lock" }}
- v2-deps-{{ .Branch }}
- v2-deps
- v3-deps-{{ checksum "yarn.lock" }}
- v3-deps-{{ .Branch }}
- v3-deps
- run:
name: build example nuxt app
command: cd examples/basic-examples && yarn build:default
Expand All @@ -160,7 +194,7 @@ jobs:

e2e-vue-example-app:
docker:
- image: cypress/base:10
- image: cypress/browsers:node12.0.0-chrome73
environment:
TERM: xterm
working_directory: ~/app
Expand All @@ -169,9 +203,9 @@ jobs:
at: ~/app
- restore_cache:
keys:
- v2-deps-{{ checksum "yarn.lock" }}
- v2-deps-{{ .Branch }}
- v2-deps
- v3-deps-{{ checksum "yarn.lock" }}
- v3-deps-{{ .Branch }}
- v3-deps
- run:
name: run smoke test
command: cd examples/vue-example-app && yarn test:smoke
Expand Down Expand Up @@ -199,9 +233,9 @@ jobs:
at: ~/app
- restore_cache:
keys:
- v2-deps-{{ checksum "yarn.lock" }}
- v2-deps-{{ .Branch }}
- v2-deps
- v3-deps-{{ checksum "yarn.lock" }}
- v3-deps-{{ .Branch }}
- v3-deps
- run:
name: Set NPM_TOKEN
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
Expand All @@ -228,6 +262,7 @@ workflows:
branches:
only:
- /^release\/.*/
- feature/update-e2e-tests
- e2e-example:
requires:
- build
Expand Down Expand Up @@ -271,7 +306,7 @@ workflows:
context: Ripple
requires:
- build
- e2e-vic-gov:
- e2e-vic-gov-develop:
context: Ripple
requires:
- build
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scripts-prepend-node-path=true
3 changes: 0 additions & 3 deletions examples/basic-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
"babel-preset-vue": "^2.0.2",
"core-js": "^2.6.5",
"cross-env": "^5.2.0",
"cypress": "^3.1.5",
"cypress-axe": "^0.4.0",
"cypress-cucumber-preprocessor": "^1.11.0",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Feature: Custom error page
Custom error page content should work

Scenario: Example for adding custom 404 messages
Given I attempt to visit the page "/404"
When I attempt to visit the page "/404"
Then the example 404 error content is added

Scenario: Example for adding custom 500 messages
Given I attempt to visit the page "/500"
When I attempt to visit the page "/500"
Then the example 500 error content is added
9 changes: 7 additions & 2 deletions examples/vic-gov-au/cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
"screenshotsFolder": "test/e2e/screenshots",
"supportFile": "test/e2e/support/index.js",
"videosFolder": "test/e2e/videos",
"ignoreTestFiles": "*.js",
"ignoreTestFiles": [
"*.js",
"*.md"
],
"snapshotFileName": "test/e2e/snapshots.js",
"projectId": "wtymar",
"chromeWebSecurity": false,
"projectId": "wtymar"
"$schema": "https://on.cypress.io/cypress.schema.json"
}
8 changes: 3 additions & 5 deletions examples/vic-gov-au/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"build:default": "if [ \"$NUXT_HOT_RELOADING\" != \"1\" ] ; then nuxt build; fi",
"build:win32": "IF \"%NUXT_HOT_RELOADING%\" NEQ \"1\" ( nuxt build )",
"cy:open": "cypress open",
"cy:run": "cypress run -e TAGS='not @skip or @smoke'",
"cy:run-record": "cypress run -e TAGS='not @skip or @smoke' --record --parallel --group $CIRCLE_JOB",
"cy:run": "cypress run -b chrome -e TAGS='not @skip or @smoke'",
"cy:run-record": "cypress run -b chrome -e TAGS='not @skip or @smoke' --record --parallel --group $CIRCLE_JOB",
"cy:run-smoke": "cypress run -e TAGS='@smoke' --spec 'test/e2e/integration/smoke/*'",
"test:dev": "cross-env NODE_ENV=test start-server-and-test dev http://localhost:3000 cy:open",
"test:smoke": "cross-env TEST=1 start-server-and-test start http://localhost:3000 cy:run-smoke",
Expand All @@ -34,9 +34,6 @@
"babel-eslint": "^10.0.1",
"babel-plugin-lodash": "^3.3.2",
"cross-env": "^5.2.0",
"cypress": "^3.1.5",
"cypress-axe": "^0.4.0",
"cypress-cucumber-preprocessor": "^1.11.0",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
Expand All @@ -57,6 +54,7 @@
},
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"step_definitions": "test/e2e/integration/",
"cucumberJson": {
"generate": true,
"outputFolder": "./../../test-results/cucumber",
Expand Down
21 changes: 7 additions & 14 deletions examples/vic-gov-au/test/e2e/fixtures/alert/1-BE-Alert-1.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
- entity: node
type: alert
title: 1-BE-Alert-1 Demo Alert
uid: 1
status: 1
path:
- pathauto: 0
alias: '/1-BE-Alert-1'
uid: 1
uuid: 0566c8c7-1deb-41a7-a6e3-86ac81341a93
nid: 81019
moderation_state:
- '#process':
callback: reference
Expand All @@ -11,7 +16,7 @@
- workflow: editorial
moderation_state: published
field_call_to_action:
- uri: https://vic.gov.au
- uri: https://www.google.com
title: More details
# Alert type.
field_alert_type:
Expand All @@ -23,18 +28,6 @@
name: 'Demo Alert Type'
# Sites.
field_node_site:
- '#process':
callback: reference
args:
- taxonomy_term
- vid: sites
name: 'Demo Site'
- '#process':
callback: reference
args:
- taxonomy_term
- vid: sites
name: 'Demo Section 1'
- '#process':
callback: reference
args:
Expand Down
9 changes: 7 additions & 2 deletions examples/vic-gov-au/test/e2e/fixtures/alert/1-BE-Alert-2.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
- entity: node
type: alert
title: 1-BE-Alert-2 Demo Alert
uid: 1
status: 1
path:
- pathauto: 0
alias: '/1-BE-Alert-2'
uid: 1
uuid: 56f0477e-a819-4b2c-83b3-0afd7057d5fb
nid: 81020
moderation_state:
- '#process':
callback: reference
Expand All @@ -11,7 +16,7 @@
- workflow: editorial
moderation_state: published
field_call_to_action:
- uri: https://vic.gov.au
- uri: https://www.google.com
title: More details
# Alert type.
field_alert_type:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
title: 1-FE-auth-content-4
uid: 1
status: 1
path:
- pathauto: 0
alias: '/1-FE-auth-content-4'
uid: 1
uuid: b66ab2d5-256f-44e0-a5af-b7fc4a38ef77
nid: 90774
moderation_state:
- '#process':
callback: reference
Expand Down Expand Up @@ -48,11 +54,11 @@
- entity: paragraph
type: hero_banner_with_cta
field_paragraph_cta:
- uri: https://www.vic.gov.au
- uri: https://www.google.com
title: Phasellus congue
field_paragraph_freetext: Nulla ultricies dignissim leo, posuere vestibulum erat cursus vitae
field_paragraph_link_text:
- uri: https://vic.gov.au
- uri: https://www.google.com
title: Nullam laoreet
field_paragraph_background_image:
- '#process':
Expand Down Expand Up @@ -106,7 +112,7 @@
args:
- taxonomy_term
- vid: authenticated_content
name: 'test'
name: test
field_tags:
- '#process':
callback: reference
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- entity: "taxonomy_term"
vid: "authenticated_content"
name: "test"
name: "test"
Loading

0 comments on commit 0b21409

Please sign in to comment.