Skip to content

Commit

Permalink
Initial commit adding integration tests. (mozilla#1557)
Browse files Browse the repository at this point in the history
* Initial commit adding integration tests.

* Fix test name.

* Adding package-lock.

* Some updates.

* More updates.

* Extend page comparison max to 9.99%

* Removed node assert statement.

* Updated baseline images and tests.

* Added docs, fixed docker configuration file.

* Updates.

* Update docker compose.

* Fix json error.

* Add comment to Dockerfile.

* Comment to trigger CI.

* Moved dependencies to allow for docker image build.

* Add restore command.

* Fix restore command.

* Change docker image.

* Add checkout command.

* Add java.

* Add node version install.

* Trying machine executor.

* Fix typo.:

* Remove old docker command.

* EVERYTHING IN ONE SHELL.

* Trying nvm.

* Fix typo.

* Fix node version...

* Fix typo.

* More node stuff.

* Updates to docker compose.

* Add chown to circleci config.

* Fix docker login error.

* Change exec command user.

* Add screenshots for debugging.

* Try fixing js command.

* Try fixing js command again.

* Change screenshot path

* Add mkdir for error shots.

* Trying something for postgres.

* Updates.

* Fix lint error.

* Try fixing errorshots.

* Updates before rebase.

* Updated baseline for new homepage.

* Remove baseline image save.

* Trying a change for errorshots.

* Update test.
  • Loading branch information
b4handjr authored Apr 3, 2020
1 parent d252cc2 commit b19eff6
Show file tree
Hide file tree
Showing 27 changed files with 10,263 additions and 9,572 deletions.
27 changes: 26 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ jobs:
name: Test Code
command: docker run blurts-server npm run lint

integration-test:
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run:
name: Build and run tests.
command: |
export NVM_DIR="/opt/circleci/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm use 10
node -v
cp .env-dist .env
npm install
npm install --only=dev
sudo chown -R $USER:$USER .
mkdir ./tests/integration/errorShots
docker-compose -f tests/integration/docker-compose.yml up --build -d
docker-compose -f tests/integration/docker-compose.yml exec --user root firefox npm run test:integration
- store_artifacts:
path: ./tests/integration/errorShots/

deploy:
docker:
- image: docker:18.02.0-ce
Expand Down Expand Up @@ -98,7 +120,6 @@ workflows:
filters:
tags:
only: /.*/

- deploy:
requires:
- build
Expand All @@ -111,3 +132,7 @@ workflows:
filters:
branches:
only: master
- integration-test:
requires:
- build

9 changes: 5 additions & 4 deletions .env-dist
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@ BASKET_NEWSLETTER=mozilla-and-you
# leave FXA_ENABLED empty to disable FXA
FXA_ENABLED=
FXA_SETTINGS_URL="https://stable.dev.lcip.org/settings"
OAUTH_CLIENT_ID=cb1bef9d06bb9bc9
OAUTH_CLIENT_SECRET=f5fb99de6e0af18ab17e013ac1d439903179a97a1c510fc10bc3bd50bbce089b
OAUTH_CLIENT_ID=edd29a80019d61a1
OAUTH_CLIENT_SECRET=a80feaad77c847275d39ac989ee12a873ef6b54cbc184128f86f2afecdf003b5
OAUTH_AUTHORIZATION_URI="https://oauth-stable.dev.lcip.org/v1/authorization"
OAUTH_PROFILE_URI="https://stable.dev.lcip.org/profile/v1/profile"
OAUTH_TOKEN_URI="https://oauth-stable.dev.lcip.org/v1/token"

# HIBP API for breach data
HIBP_API_ROOT="https://stage.haveibeenpwned.com/api/v2/"
# How many seconds to wait before refreshing upstream breach data from HIBP
HIBP_RELOAD_BREACHES_TIMER=600
# HIBP API for range search and subscription
HIBP_KANON_API_ROOT="https://api.haveibeenpwned.com"
HIBP_KANON_API_TOKEN=""
HIBP_KANON_API_TOKEN=
HIBP_API_ROOT="https://haveibeenpwned.com/api/v2"
HIBP_API_TOKEN=
# How many milliseconds to wait before retrying an HIBP request
HIBP_THROTTLE_DELAY=2000
# Max number of times to try an HIBP request before throwing error
Expand Down
12 changes: 11 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,17 @@ module.exports = {
],
env: {
jest: true,
}
},
},
{
files: [
'tests/integration/**/*.js',
],
globals: {
"$": "readonly",
"$$": "readonly",
"browser": "readonly",
},
},
],
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ USER app
COPY package.json package.json
COPY package-lock.json package-lock.json

RUN npm install && rm -rf ~app/.npm /tmp/*
RUN npm install --production && rm -rf ~app/.npm /tmp/*

COPY --chown=app:app . /app

Expand Down
Loading

0 comments on commit b19eff6

Please sign in to comment.