Skip to content

Commit

Permalink
Adds Circle CI config for regression tests (#420)
Browse files Browse the repository at this point in the history
* Setup nightly regression test in CI, skip failing tests

* fix indent in circleci config

* fix lint

* Split CI Tasks

* fix syntax
  • Loading branch information
dylankelly authored and tim-yao committed Jul 15, 2019
1 parent 280759f commit 0be0554
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 12 deletions.
39 changes: 37 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,29 @@ jobs:
name: Unit tests
command: yarn test:unit
- run:
name: run e2e smoke test
name: run smoke test
command: yarn test:smoke
- persist_to_workspace:
root: ~/app
paths: .
- store_artifacts:
path: test/e2e/videos
- store_artifacts:
path: test/e2e/screenshots

regression:
# This runs the full suite of e2e tests
docker:
- image: cypress/base:10
environment:
TERM: xterm
SEARCH_BE: LOCAL-CI
working_directory: ~/app
steps:
- attach_workspace:
at: ~/app
- run:
name: run full e2e test
command: yarn test:e2e
- store_artifacts:
path: test/e2e/videos
Expand All @@ -49,4 +71,17 @@ workflows:
commit:
jobs:
- test

# Run full regression test nightly on master and release branches
nightly:
triggers:
- schedule:
cron: "30 14 * * *"
filters:
branches:
only:
- develop
jobs:
- test
- regression:
requires:
- test
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
"start:example": "cd examples/vic-gov-au/ && yarn run dev",
"start:build-example": "cd examples/vic-gov-au/ && nuxt build && nuxt start",
"test:dev": "cross-env NODE_ENV=dev start-server-and-test start:example http://localhost:3000 cy:open",
"test:e2e": "cross-env NODE_ENV=test start-server-and-test start:build-example http://localhost:3000 cy:run-smoke",
"test:smoke": "cross-env NODE_ENV=test start-server-and-test start:build-example http://localhost:3000 cy:run-smoke",
"test:e2e": "cross-env NODE_ENV=test start-server-and-test start:build-example http://localhost:3000 cy:run",
"test:unit": "jest --colors",
"build:storybook": "cd src && yarn build-storybook",
"build:example": "cd examples/vic-gov-au && yarn run build",
"cy:open": "cypress open",
"cy:run": "cypress run -e TAGS='not @skip'",
"cy:run": "cypress run -e TAGS='not @skip or @smoke'",
"cy:run-smoke": "cypress run -e TAGS='@smoke'",
"lint": "eslint --ext .js,.vue . --max-warnings 0 && sass-lint",
"lint:fix": "eslint --ext .js,.vue . --fix",
Expand Down
5 changes: 5 additions & 0 deletions packages/ripple-test-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@
"csvtojson": "^2.0.8",
"faker": "^4.1.0",
"puppeteer": "^1.13.0"
},
"peerDependencies": {
"cypress": "^3.1.5",
"cypress-axe": "^0.4.0",
"cypress-cucumber-preprocessor": "^1.11.0"
}
}
2 changes: 1 addition & 1 deletion test/e2e/integration/Homepage/Homepage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ Feature: Home Page
And the campaign primary banner component should exist

# Need to fix existing errors or work out ruleset to skip
@a11y
@a11y @skip
Scenario: There are no accessibility errors
Then it has no detectable a11y violations on load
2 changes: 1 addition & 1 deletion test/e2e/integration/LandingPage/LandingPage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Landing Page Components
Then the site header is visible
Then the site footer is visible

@a11y
@a11y @skip
Scenario: There are no accessibility errors
Given I have created a landing page with the json fixture "Pages/LandingPage/simple"
And I have navigated to the created test page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Feature: Preview content
And there should be a preview destination query string
And the created page should be removed

@skip
Scenario: Accessing a preview when authenticated shows page
Given there is a user in the system with the following credentials:
| login | password | active | email | role |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Feature: Protected content
And the created user should be removed
And the created page should be removed

@skip
Scenario: Can still navigate after session is expired
Given I have created a landing page with the json fixture "Pages/ProtectedContent/tc-pc1"
And there is a user in the system with the following credentials:
Expand Down
11 changes: 5 additions & 6 deletions test/e2e/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@

const cucumber = require('cypress-cucumber-preprocessor').default
const tideAdmin = require('@dpc-sdp/ripple-test-tools')

// Environment variables that need exposing to cypress go here - use the example site .env file
if (!process.env.CI) {
require('dotenv').config({ path: 'examples/vic-gov-au/.env' })
}

module.exports = (on, config) => {
on('file:preprocessor', cucumber())

tideAdmin(on, config)

// Environment variables that need exposing to cypress go here
if (process.env.NODE_ENV === 'dev' || process.env.NODE_ENV === 'test') {
require('dotenv').config()
}

config.env = {
ADMIN_USERNAME: process.env.CYPRESS_ADMIN_USERNAME,
ADMIN_PASSWORD: process.env.CYPRESS_ADMIN_PASSWORD,
Expand Down

0 comments on commit 0be0554

Please sign in to comment.