Debugging the tests
Now let's see how we can debug our tests. We will review it in two blocks:
- Debugging tests in TestCafe.
- Debugging tests in Chrome Developer Tools.
Let's take a look.
Debugging tests in TestCafe
Let's use the code from the previous example to create a basic-test-wrong.js
file with a slightly modified class name in the selector:
const { Selector } = require('testcafe');fixture('My first set of tests') .page('http://demo.redmine.org/');test('My first test', async (t) => { await t.click('.login-wrong');});
Note
You can also review and download this file on GitHub: https://github.com/PacktPublishing/Modern-Web-Testing-with-TestCafe/blob/master/ch4/test-project/tests/basic-test-wrong.js.
The class name .login-wrong
is used instead of .login
to provoke the element not found error. Let's launch our test to confirm this...