Shane Ardell created METRON-1958:
------------------------------------
Summary: Optimize Cypress to use best practices
Key: METRON-1958
URL: https://issues.apache.org/jira/browse/METRON-1958
Project: Metron
Issue Type: Bug
Reporter: Shane Ardell
As of recent, there have been multiple unpredictable Cypress failures in
Travis. While looking into these failures, I noticed a few anti-patterns we
have in place that could definitely cause these failures:
1) We currently run `ng serve --aot` as a test server for Cypress. We are
running this command in parallel with the command that starts Cypress. As you
could imagine, this presents a race condition where Cypress could start running
before the server starts. Instead of using Angular CLI to build and serve our
project for Cypress to test against, we should first build the project, then
serve the built project with the Express server we have in place already.
Serving an already built project with Express is so fast we should be able to
confidently run it in parallel with the Cypress test script and not worry about
any race conditions failing our tests. This is the standard practice that has
been shown in other Angular/Cypress test examples.
2) Per the Cypress team's best practice recommendations, [we should remove the
command to logout in the afterEach
hook|https://docs.cypress.io/guides/references/best-practices.html#Using-after-or-afterEach-hooks]
since it's unnecessary for our needs and may be the cause for our failures
regarding the logout link.
3) Again per the Cypress team's best practices, [we should set a baseUrl in our
cypress.json config
file|https://docs.cypress.io/guides/references/best-practices.html#Setting-a-global-baseUrl].
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)