Uploaded image for project: 'Metron'
  1. Metron
  2. METRON-1958

Optimize Cypress to use best practices

    Details

    • Type: Bug
    • Status: Done
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 0.7.1
    • Labels:
      None

      Description

      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 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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sardell Shane Ardell
                Reporter:
                sardell Shane Ardell
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m