aws-amplify / aws-amplify/amplify-hosting
Integration with Jest test suite
- Dominant language
- Dockerfile
- Stars
- 481
- Forks
- 123
- PR merge metrics
- No merged PRs in 30d
Description
Attempting to integrate E2E front-end tests with Amplify console. I am not sure if there is something wrong with our build settings, or if are not writing our tests correctly.
The tests work fine locally. However, the pipeline gets stuck at the tests step (after the tests have succeeded). I have attached some logs and the current settings that the console uses

The current amplify.yml
```
version: 0.1
build:
phases:
prebuild:
commands:
- sudo yum install gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget -y
frontend:
phases:
preBuild:
commands:
- curl https://intoli.com/install-google-chrome.sh | bash
- yarn global add serve
- yarn install
build:
commands:
- yarn run build
artifacts:
baseDirectory: build
files:
- "**/*"
cache:
paths:
- node_modules/**/*
test:
artifacts:
baseDirectory: __tests__/screenshots
files:
- "*.png"
phases:
preTest:
commands:
- yarn add wait-on serve
- "serve -s build & npx wait-on http://localhost:5000"
test:
commands:
- yarn test
```
Build log
```
# Starting phase: preTest
# Executing command: yarn add wait-on serve
2020-02-24T18:05:31.438Z [INFO]: yarn add v1.16.0
2020-02-24T18:05:31.551Z [INFO]: [1/4] Resolving packages...
2020-02-24T18:05:31.626Z [WARNING]: warning Resolution field "apollo-client@2.6.8" is incompatible with requested version "apollo-client@2.4.6"
2020-02-24T18:05:32.428Z [INFO]: [2/4] Fetching packages...
2020-02-24T18:05:33.313Z [INFO]: info fsevents@1.2.4: The platform "linux" is incompatible with this module.
2020-02-24T18:05:33.314Z [INFO]: info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-02-24T18:05:33.321Z [INFO]: info fsevents@1.2.11: The platform "linux" is incompatible with this module.
2020-02-24T18:05:33.322Z [INFO]: info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-02-24T18:05:33.330Z [INFO]: info fsevents@2.1.2: The platform "linux" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-02-24T18:05:33.334Z [INFO]: [3/4] Linking dependencies...
2020-02-24T18:05:33.337Z [WARNING]: warning " > apollo-client@2.6.8" has unmet peer dependency "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0".
2020-02-24T18:05:33.338Z [WARNING]: warning "apollo-client > apollo-cache@1.3.4" has unmet peer dependency "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0".
warning " > apollo-link@1.2.13" has unmet peer dependency "graphql@^0.11.3 || ^0.12.3 || ^0.13.0 || ^14.0.0".
warning "apollo-client > apollo-utilities@1.3.3" has unmet peer dependency "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0".
warning " > @apollo/react-hooks@3.1.3" has unmet peer dependency "@types/react@^16.8.0".
warning " > @apollo/react-hooks@3.1.3" has unmet peer dependency "graphql@^14.3.1".
warning "@apollo/react-hooks > @apollo/react-common@3.1.3" has unmet peer dependency "@types/react@^16.8.0".
2020-02-24T18:05:33.340Z [WARNING]: warning "@apollo/react-hooks > @apollo/react-common@3.1.3" has unmet peer dependency "apollo-utilities@^1.3.2".
warning "@apollo/react-hooks > @apollo/react-common@3.1.3" has unmet peer dependency "graphql@^14.3.1".
2020-02-24T18:05:33.341Z [WARNING]: warning " > apollo-link-http@1.5.16" has unmet peer dependency "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0".
warning "apollo-link-http > apollo-link-http-common@0.2.15" has unmet peer dependency "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0".
warning "aws-amplify > @aws-amplify/api@2.1.5" has incorrect peer dependency "@aws-amplify/pubsub@^1.2.4".
warning "aws-appsync > apollo-link-http@1.3.1" has incorrect peer dependency "graphql@^0.11.0".
warning " > graphql-tag@2.10.3" has unmet peer dependency "graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0".
warning " > leaflet-moving-marker@0.3.0" has incorrect peer dependency "leaflet@1.0.2".
warning " > leaflet.markercluster@1.4.1" has incorrect peer dependency "leaflet@~1.3.1".
warning " > react-apollo@3.1.3" has unmet peer dependency "@types/react@^16.8.0".
warning " > react-apollo@3.1.3" has unmet peer dependency "graphql@^14.3.1".
warning "react-apollo > @apollo/react-components@3.1.3" has unmet peer dependency "@types/react@^16.8.0".
warning "react-apollo > @apollo/react-components@3.1.3" has unmet peer dependency "apollo-cache@^1.3.2".
2020-02-24T18:05:33.343Z [WARNING]: warning "react-apollo > @apollo/react-components@3.1.3" has unmet peer dependency "apollo-utilities@^1.3.2".
warning "react-apollo > @apollo/react-components@3.1.3" has unmet peer dependency "graphql@^14.3.1".
warning "react-apollo > @apollo/react-hoc@3.1.3" has unmet peer dependency "@types/react@^16.8.0".
warning "react-apollo > @apollo/react-hoc@3.1.3" has unmet peer dependency "graphql@^14.3.1".
warning " > react-leaflet-heatmap-layer@2.0.0" has unmet peer dependency "react-leaflet@^2.0.0".
2020-02-24T18:05:37.751Z [INFO]: [4/4] Building fresh packages...
2020-02-24T18:05:37.896Z [INFO]: success Saved lockfile.
2020-02-24T18:05:38.128Z [INFO]: success Saved 25 new dependencies.
2020-02-24T18:05:38.128Z [INFO]: info Direct dependencies
├─ serve@11.3.0
└─ wait-on@4.0.0
info All dependencies
2020-02-24T18:05:38.128Z [INFO]: ├─ @hapi/address@2.1.4
├─ @hapi/formula@1.2.0
├─ @hapi/hoek@8.5.1
├─ @hapi/joi@16.1.8
├─ @hapi/pinpoint@1.0.2
├─ @hapi/topo@3.1.6
├─ @zeit/schemas@2.6.0
├─ ansi-align@2.0.0
├─ arch@2.1.1
├─ arg@2.0.0
├─ boxen@1.3.0
├─ cli-boxes@1.0.0
├─ clipboardy@1.2.3
├─ compression@1.7.3
├─ content-disposition@0.5.2
├─ fast-url-parser@1.1.3
├─ path-to-regexp@2.2.1
├─ registry-auth-token@3.3.2
├─ registry-url@3.1.0
├─ serve-handler@6.1.2
├─ serve@11.3.0
├─ term-size@1.2.0
├─ update-check@1.5.2
├─ wait-on@4.0.0
└─ widest-line@2.0.1
2020-02-24T18:05:38.131Z [INFO]: Done in 6.70s.
2020-02-24T18:05:38.147Z [INFO]: # Executing command: serve -s build & npx wait-on http://localhost:5000
2020-02-24T18:05:38.395Z [INFO]: INFO: Accepting connections at http://localhost:5000
2020-02-24T18:05:38.517Z [INFO]: # Completed phase: preTest
# Starting phase: test
2020-02-24T18:05:38.518Z [INFO]: # Executing command: yarn test
2020-02-24T18:05:38.666Z [INFO]: yarn run v1.16.0
2020-02-24T18:05:38.691Z [INFO]: $ jest --maxWorkers=2 --detectOpenHandles
2020-02-24T18:05:44.315Z [WARNING]: PASS __tests__/index.js
2020-02-24T18:05:44.319Z [WARNING]: Page load test
✓ Test on Desktop (2166ms)
✓ Test on Mobile (1786ms)
2020-02-24T18:05:44.320Z [WARNING]: Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 4.865s
Ran all test suites.
```
Contributor guide
Research direction
Start with the attached amplify.yml and the E2E entry point __tests__/index.js, then reproduce the Amplify Console run using the shown preTest and test commands. Confirm why yarn test exits after the two passing tests and define done as the pipeline completing successfully while retaining the screenshot artifacts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, javascript
- Domain
- ci-cd, frontend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100