Sashika Wijesinghe
Sashika Wijesinghe

Reputation: 425

TestCafe Studio - How to debug test failure when .testcafe file is executed?

I'm using TestCafe Studio to create my tests and executing the tests written in .testcafe format using the testcafe docker container. Further I'm using 'Drone' as CI environment. Below is the command that I use to execute my tests

  `- /opt/testcafe/docker/testcafe-docker.sh -c 3 chromium -q --skip-js-errors --ass`ertion-timeout 60000 --selector-timeout 60000 CommonScenarios/*.testcafe

When a test failure occur I will not get enough information about the test failure. For example below is an error log printed.

1) AssertionError: expected false to be truthy

         Browser: Chrome 91.0.4472.124 / Linux 0.0

         7

Is there any way that I can get enough details about which step is actually failing when the tests are executed in .testcafe format?

(When I ran .js format of the test it gives which line is failing)

Upvotes: 0

Views: 367

Answers (1)

Dmitry Ostashev
Dmitry Ostashev

Reputation: 2348

This looks like a bug in TestCafe Framework. I opened an issue in the GitHub repository: https://github.com/DevExpress/testcafe/issues/6424. Subscribe it to be notified of updates.

As a simple solution, you can convert your *.testcafe fixture file to *.js. Also, there is a more complex workaround - it allows you to determine which step is failing:

  1. Open the *.testcafe file in VS Code or some other editor. You will see that it looks like a JSON file.
  2. Find an object with the "name" property whose value corresponds to your test name: "name": "Your-failed-test-name"
  3. Look at the "commands" array. Find an object with the "callsite" property whose value is equal to the number that you can see in the error console output. This object specifies the failed step. Note that the format of this file is intended for internal use, and it is not recommend to modify it manually.

Upvotes: 1

Related Questions