Skip to content

Commit

Permalink
Add frontend integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tlrobinson committed Feb 1, 2019
1 parent 33f7368 commit bece6c2
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 7 deletions.
16 changes: 16 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,18 @@ jobs:
command: yarn run test-unit
no_output_timeout: 5m

fe-tests-integration:
<<: *defaults
steps:
- attach_workspace:
at: /home/circleci/
- restore_cache:
<<: *restore-fe-deps-cache
- run:
name: Run frontend integration tests
command: yarn run test-integration
no_output_timeout: 5m

build-uberjar:
<<: *defaults
steps:
Expand Down Expand Up @@ -680,6 +692,9 @@ workflows:
- fe-tests-unit:
requires:
- fe-deps
- fe-tests-integration:
requires:
- fe-deps
- build-uberjar:
requires:
- be-deps
Expand Down Expand Up @@ -716,6 +731,7 @@ workflows:
- fe-linter-flow
- fe-tests-karma
- fe-tests-unit
- fe-tests-integration
- fe-tests-e2e
filters:
branches:
Expand Down
2 changes: 1 addition & 1 deletion jest.e2e.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"<rootDir>/frontend/test/legacy-selenium"
],
"testMatch": [
"**/?(*.)e2e.spec.js?(x)"
"<rootDir>/frontend/test/**/*.e2e.spec.js?(x)"
],
"modulePaths": [
"<rootDir>/frontend/test",
Expand Down
31 changes: 31 additions & 0 deletions jest.integ.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"moduleNameMapper": {
"\\.(css|less)$": "<rootDir>/frontend/test/__mocks__/styleMock.js",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/frontend/test/__mocks__/fileMock.js",
"^promise-loader\\?global\\!metabase\\/lib\\/ga-metadata$": "<rootDir>/frontend/src/metabase/lib/ga-metadata.js"
},
"testPathIgnorePatterns": [
"<rootDir>/frontend/test/legacy-karma",
"<rootDir>/frontend/test/legacy-selenium"
],
"testMatch": [
"<rootDir>/frontend/test/**/*.integ.spec.js?(x)"
],
"modulePaths": [
"<rootDir>/frontend/test",
"<rootDir>/frontend/src"
],
"setupFiles": [
"<rootDir>/frontend/test/jest-setup.js",
"<rootDir>/frontend/test/metabase-bootstrap.js"
],
"globals": {
"ace": {},
"ga": {},
"document": {}
},
"coverageDirectory": "./",
"coverageReporters": ["text", "json-summary"],
"collectCoverageFrom": ["frontend/src/**/*.js", "frontend/src/**/*.jsx"],
"coveragePathIgnorePatterns": ["/node_modules/", "/frontend/src/metabase/visualizations/lib/errors.js"]
}
6 changes: 4 additions & 2 deletions jest.unit.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
},
"testPathIgnorePatterns": [
"<rootDir>/frontend/test/legacy-karma",
"<rootDir>/frontend/test/legacy-selenium",
"e2e.spec.js"
"<rootDir>/frontend/test/legacy-selenium"
],
"testMatch": [
"<rootDir>/frontend/test/**/*.unit.spec.js?(x)"
],
"modulePaths": [
"<rootDir>/frontend/test",
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,18 @@
"lint-eslint": "yarn && eslint --ext .js --ext .jsx --rulesdir frontend/lint/eslint-rules --max-warnings 0 frontend/src frontend/test",
"lint-prettier": "yarn && prettier -l 'frontend/**/*.{js,jsx,css}' || (echo '\nThese files are not formatted correctly. Did you forget to \"yarn prettier\"?' && false)",
"flow": "yarn && flow check",
"test": "yarn test-unit && yarn test-e2e && yarn test-karma",
"test-e2e": "./bin/build-for-test && yarn test-e2e-no-build",
"test-e2e-watch": "yarn test-e2e --watch",
"test-e2e-no-build": "yarn && babel-node ./frontend/test/__runner__/run_e2e_tests.js",
"test": "yarn test-unit && yarn test-integration && yarn test-e2e && yarn test-karma",
"test-unit": "yarn && jest --maxWorkers=8 --config jest.unit.conf.json",
"test-unit-watch": "yarn test-unit --watch",
"test-unit-update-snapshot": "yarn test-unit --updateSnapshot",
"test-integration": "yarn && jest --maxWorkers=8 --config jest.integ.conf.json",
"test-integration-watch": "yarn test-integration --watch",
"test-e2e": "./bin/build-for-test && yarn test-e2e-no-build",
"test-e2e-watch": "yarn test-e2e --watch",
"test-e2e-no-build": "yarn && babel-node ./frontend/test/__runner__/run_e2e_tests.js",
"test-karma": "yarn && karma start frontend/test/karma.conf.js --single-run",
"test-karma-watch": "yarn && karma start frontend/test/karma.conf.js --auto-watch --reporters nyan",
"test-integrated": "echo 'test-integrated renamed to test-e2e'; exit 1",
"build": "yarn && webpack --bail",
"build-watch": "yarn && webpack --watch",
"build-hot": "yarn && NODE_ENV=hot webpack-dev-server --progress",
Expand Down

0 comments on commit bece6c2

Please sign in to comment.