-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cypress Test hangs indefinitely and will not deploy #240
Comments
Here's what I've discovered after hours of messing around with it. First off, I was using yarn for create react app. However, the docs for Cypress and Amplify use npm in the amplify.xml. So, I switched from yarn to npm for the project to see if that had an effect. It did. The test panel properly installed Cypress. I'm guessing there's some (undocumented?) changes to the cypress configuration you have to make when using yarn instead of npm. HOWEVER, while the URL that the docs say to put into the amplify.yml as the "wait on" is Since nothing ever launches on And hangs indefinitely. Again. This is the log from the test tab. # Starting phase: preTest
# Executing command: npm install
2019-11-13T09:01:56.994Z [WARNING]: npm WARN
2019-11-13T09:01:56.998Z [WARNING]: [email protected] requires a peer of graphql@^0.11.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2019-11-13T09:01:56.999Z [INFO]: audited 909009 packages in 7.89s
found 0 vulnerabilities
2019-11-13T09:01:57.007Z [INFO]: # Executing command: npm install wait-on
2019-11-13T09:02:06.093Z [INFO]: > [email protected] postinstall /codebuild/output/src654400301/src/app/node_modules/wait-on/node_modules/core-js
> node postinstall || echo "ignore"
2019-11-13T09:02:07.307Z [WARNING]: npm
2019-11-13T09:02:07.312Z [WARNING]: WARN [email protected] requires a peer of graphql@^0.11.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2019-11-13T09:02:07.313Z [INFO]: + [email protected]
added 3 packages from 2 contributors and audited 909082 packages in 9.96s
found 0 vulnerabilities
2019-11-13T09:02:07.323Z [INFO]: # Executing command: npm install [email protected] mochawesome mochawesome-merge mochawesome-report-generator
2019-11-13T09:02:19.432Z [WARNING]: npm WARN [email protected] requires a peer of graphql@^0.11.0 but none is installed. You must install peer dependencies yourself.
2019-11-13T09:02:19.434Z [WARNING]: npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2019-11-13T09:02:19.435Z [INFO]: + [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
added 58 packages from 453 contributors and audited 909384 packages in 11.777s
found 0 vulnerabilities
2019-11-13T09:02:19.447Z [INFO]: # Executing command: npm start & npx wait-on http://172.17.0.2:3000
2019-11-13T09:02:19.638Z [INFO]: > [email protected] start /codebuild/output/src654400301/src/app
> react-scripts start
2019-11-13T09:02:20.883Z [INFO]: Starting the development server...
2019-11-13T09:02:34.178Z [INFO]: Compiled successfully!
2019-11-13T09:02:34.180Z [INFO]: You can now view frontend in the browser.
Local: http://localhost:3000/
On Your Network: http://172.17.0.2:3000/
Note that the development build is not optimized.
To create a production build, use yarn build.
2019-11-13T09:02:35.431Z [INFO]: # Completed phase: preTest
# Starting phase: test
2019-11-13T09:02:35.432Z [INFO]: # Executing command: npx cypress run --record --reporter mochawesome --reporter-options reportDir=cypress/report/mochawesome-report,overwrite=false,html=false,json=true,timestamp=mmddyyyy_HHMMss This looks like a bug with Amplify, but it's also possible that Cypress WANTS to run on Suggestions? |
I tried setting an environment variable for the URL being used by Cypress for the dev server.
Still hangs forever. |
I removed the 2019-11-13T09:43:31.101Z [INFO]: # Executing command: npx cypress run --reporter mochawesome --reporter-options reportDir=cypress/report/mochawesome-report,overwrite=false,html=false,json=true,timestamp=mmddyyyy_HHMMss
2019-11-13T09:43:31.377Z [INFO]: The cypress npm package is installed, but the Cypress binary is missing.
We expected the binary to be installed here: /root/.cache/Cypress/3.6.1/Cypress/Cypress
Reasons it may be missing:
- You're caching 'node_modules' but are not caching this path: /root/.cache/Cypress
- You ran 'npm install' at an earlier build step but did not persist: /root/.cache/Cypress
Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.
Alternatively, you can run 'cypress install' to download the binary again.
https://on.cypress.io/not-installed-ci-error
----------
Platform: linux (Raspbian - 2)
Cypress Version: 3.6.1 |
As per the instructions at that link in the Cypress docs (even though their kitchen sink amplify.yml file has node_modules cached), I removed node_modules from the amplify.yml cache, and changed it to this: cache:
paths:
- ~/.cache I no longer get the above error from Cypress, but it hangs indefinitely again when it hits 2019-11-13T10:01:12.737Z [INFO]: Starting the development server...
2019-11-13T10:01:27.893Z [INFO]: Compiled successfully!
2019-11-13T10:01:27.895Z [INFO]: You can now view frontend in the browser.
Local: http://localhost:3000/
On Your Network: http://172.17.0.2:3000/
Note that the development build is not optimized.
To create a production build, use yarn build.
2019-11-13T10:01:29.403Z [INFO]: # Completed phase: preTest
# Starting phase: test
2019-11-13T10:01:29.405Z [INFO]: # Executing command: npx cypress run --reporter mochawesome --reporter-options reportDir=cypress/report/mochawesome-report,overwrite=false,html=false,json=true,timestamp=mmddyyyy_HHMMss It feels like I'm just spinning my wheels here.
🤷🏻♂️ |
@stevensacks , sorry you're having a hard time getting your tests to work. We're currently investigating this issue. We will follow up with you shortly. |
Thank you. I made a public repo that is essentially the same project (with the code that is specific to the amplify backend on my org’s AWS account removed). |
Hello @stevensacks
(I didn't add any environment variables.) It works on my amplify console. |
Wow. http://localhost:3000 worked! Thanks @Joycehao19 ! |
Hi @stevensacks , when I worked on When you test your code locally, did you get the expected UI list? |
I ran into this issue as well, and resolved it with the recommended tweak (Thank you!!!):
Also, though, I needed to make sure I had a cypress.json file in the root of my project with: { Without that, Console timed-out in the test phase of the build. |
Closing this issue. If you encounter something in the future please reach out. |
I am seeing this very issue after one or two successful builds. Nothing changed other than a minor tweak to a test and now it hangs when attempting to run Cypress. No error is given it just hangs. I've tried different ports and various other tweaks but so far nothing will get it running again. |
I have spent a few hours trying to figure out what is going on with my build. It worked correctly initially but nothing I do now will get it past hanging on running Cypress. I've curled the server to check for a response and it looks to be running fine. I've tried an Express server and the CRA Server. The same code is currently working correctly with a custom Bitbucket Pipeline so I know it works fine outside of the Amplify stack. |
I spent some time trying to get rid of Install yarn add start-server-and-test --dev Modify version: 0.1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- yarn install
build:
commands:
- yarn run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
test:
artifacts:
baseDirectory: cypress
configFilePath: '**/mochawesome.json'
files:
- '**/*.png'
- '**/*.mp4'
phases:
preTest:
commands:
- yarn install
- yarn add mocha mochawesome mochawesome-merge mochawesome-report-generator
test:
commands:
- npx start-test 'yarn start' 3000 'npx cypress run --reporter mochawesome --reporter-options "reportDir=cypress/report/mochawesome-report,overwrite=false,html=false,json=true,timestamp=mmddyyyy_HHMMss"'
postTest:
commands:
- npx mochawesome-merge cypress/report/mochawesome-report/mochawesome*.json > cypress/report/mochawesome.json |
Besides other comments I have added env variable with "CI=true" in amplify console, otherwise Test hangs on Starting Development Server.. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Describe the bug
I have integrated Cypress into my app, followed all the instructions, made a Cypress dashboard account, added the env variable, added a cypress test to my app, ensured it passed, but no matter what I do, the Amplify build hangs on the Test tab.
This is a basic Create React App with AppSync and Apollo. I'm just trying to get the initial build stuff set up and I'm stuck.
After 30 minutes, it ultimately fails. When I download the artifacts, I see this:
To Reproduce
As stated above.
Expected behavior
I expect it to run the cypress test as described in the documentation.
The text was updated successfully, but these errors were encountered: