Giter Site home page Giter Site logo

Comments (9)

garyleefight avatar garyleefight commented on May 13, 2024

@janhesters You have to install the missing dependency yourself. You can add commands to install chrome dependencies in prebuild.

from amplify-hosting.

janhesters avatar janhesters commented on May 13, 2024

@garyleefight Do you know which dependencies and how to install them exactly?

I can't find how to install chrome for the Amplify console. I only found this, which tackles docker. And these Google docs are for Travis CI. As far as I can tell, there is no addons key for the Amplify build settings.

from amplify-hosting.

garyleefight avatar garyleefight commented on May 13, 2024

@janhesters https://stackoverflow.com/questions/44516816/install-chrome-headless-using-npm
Hope it helps.

from amplify-hosting.

janhesters avatar janhesters commented on May 13, 2024

@garyleefight Thank you for your help. Managed to solve the install problem by adding

- wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
- yum install -y ./google-chrome-stable_current_*.rpm

to my build settings.

My question is now: How can I run yarn start so that the tests can pass? Currently the functional tests run, but fail, because no server is running.

from amplify-hosting.

garyleefight avatar garyleefight commented on May 13, 2024

@janhesters You can use https://stackoverflow.com/questions/30950032/how-can-i-run-multiple-npm-scripts-in-parallel concurrently package to run yarn start and your test command in parallel.
It will kill yarn start when your test commands finished. But the exit code is 1, which is considered build failure in our console.
You can read this post to get rid of exit code 1.
https://github.com/kimmobrunfeldt/concurrently/issues/127

Hope it works for you.

Besides, AWS Amplify Console baked Cypress test in the default image. You can choose it as an alternative selection.

Thanks,
Gary

from amplify-hosting.

janhesters avatar janhesters commented on May 13, 2024

@garyleefight

You can use https://stackoverflow.com/questions/30950032/how-can-i-run-multiple-npm-scripts-in-parallel concurrently package to run yarn start and your test command in parallel.
It will kill yarn start when your test commands finished. But the exit code is 1, which is considered build failure in our console.
You can read this post to get rid of exit code 1.
kimmobrunfeldt/concurrently#127

Thank you I will try concurrently.

I also found the --app flag for TestCafe which does exactly what I want (= run yarn start when the test starts, and terminate the app afterwards). But, for some reason if I test in headless mode in the console or locally, the tests fail. I created a SO question here.

Besides, AWS Amplify Console baked Cypress test in the default image. You can choose it as an alternative selection.

Really? I didn't know that and could'n find anything in the docs about this. Do Cypress tests "just work"? Or is there extra configuration needed.

from amplify-hosting.

janhesters avatar janhesters commented on May 13, 2024

I got it working by adding a delay to launch the app.

"functional-tests": "testcafe 'chrome:headless' src/functional-tests/ --app 'yarn start' --app-init-delay 4000",

from amplify-hosting.

rudyhadoux avatar rudyhadoux commented on May 13, 2024

@janhesters Do you know the npm lib start-server-and-test (no need to add delay) ?
I achieve same tests with
start-server-and-test angular-http-server --path ./dist/site -p 4200 http://localhost:4200 testcafe chrome:headless ./testcafe/test.js

from amplify-hosting.

github-actions avatar github-actions commented on May 13, 2024

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.

from amplify-hosting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.