Skip to the editor

Fix the wrong assertion

Forms & validation · level 2 of 5 · Nimbus

A test can fail because it asserts the wrong outcome. Read what the app actually does, then assert that.

The problem

This test enters a wrong password and expects to reach the dashboard, but a wrong password should be rejected, so the test fails.

Fix the assertion to check for the error message (data-testid="login-error") instead.

Fix the failing test

This test is red right now. Run it to see how it fails, then edit until it passes, without weakening what it checks.

Done when

  • A wrong password is rejected and shows the error message.

Bugs we plant

  • Wrong credentials show no error message

We break each one in a copy of the app. Your fixed test has to fail on every copy.

Loading the editor…