Debugging an E2E Test

Not all tests are going to pass the first time. Hammer provides some tools to help you debug failed specs. When you run your tests, you can find a report in tests/e2e/report/index.html

timer Exercise: Fix a spec

To start, in your seed-exam:

  1. Open tests/e2e/conf.js
  2. Uncomment the line, specs/tutorial_spec.js
  3. Save
  4. Run the tests with these updated specs.

You will notice there is an error in one of our tests.

All the information regarding the error is listed in these console details. However if you end up with too many errors, reading them in the console can be daunting. There is an optional view you can use to debug. It is located in code tests/e2e/report/index.html.

The HTML view is much easier to read.

Whenever a test fails, a screenshot is taken and a link is provided to view it. This will help if the spec is testing against something visual. In our case, we are looking for a string No action taken. but it only found No action taken. The period is missing. Looks like we have a typo in our test.

Find the spec should have label "No action taken" in tests/e2e/specs/tutorial_spec.js

Change this line:

expect(statusWidget.getText()).toEqual('No action taken');

To:

expect(statusWidget.getText()).toEqual('No action taken.');

Rerun the tests and all specs should now pass.