testcafe icon indicating copy to clipboard operation
testcafe copied to clipboard

Render correct error text for uncaught errors

Open helen-dikareva opened this issue 3 years ago • 4 comments

What is your Scenario?

I'd like to use browser manipulation actions (e.g. resizeWindow, maximizeWindow etc.) the same way with other actions in my tests in the recording process. Test run for such tests works properly.

TestCafe Studio issue: https://github.com/DevExpress/testcafe-studio/issues/4170

What is the Current behavior?

When I add such actions in my tests (both *.js/ts and *.testcafe formats) and start recording for them in TestCafe Studio I get an error image

What is the Expected behavior?

Correct error message. We should show more descriptive error message. Otherwise we spend to much time to determinate the real cause and we won't be able to diagnost user's problems if they write to us about them.

Please add TestCafe Studio squad for review PR if API is changed or provide us with Breaking change list.

What is your public website URL? (or attach your complete example)

any

What is your TestCafe test code?

The smallest example could be the following

fixture `Google`
  .page `https://google.com`;
  
test(`New Test`, async t => {
  await t.maximizeWindow();
});

Your complete configuration file

Your complete test report

Screenshots

Steps to Reproduce

  1. Run test in TestCafe Studio

TestCafe version

1.18.4

Node.js version

14.9.0

Command-line arguments

Browser name(s) and version(s)

any

Platform(s) and version(s)

any

Other

The research result: The TestRun's constructor API was changed in the PR @Aleksey28 Specifically messageBus was added as a parameter. But in Studio we use this API .

The [object object] error was inroduced after the PR merging @AlexKamaev. This line raise error "TypeError: Cannot read property 'on' of undefined" and this error is catch in the catch block. But still in Studio we get an unidentified [object object] error.

helen-dikareva avatar Mar 22 '22 07:03 helen-dikareva

I have the same issue with "Uncaught object "[object Object]" was thrown. Throw Error instead." in Testcafe version 1.20.0-rc.1 for selectors where I try to get the innerText/textContent for a sub-element of a svg

Florian-HH avatar Jul 14 '22 08:07 Florian-HH

@Florian-HH I believe this issue is not related to the original one. Please share your project and your test code with us so that we can reproduce the issue on our side

AlexKamaev avatar Jul 18 '22 06:07 AlexKamaev

@AlexKamaev I am sorry, but the project and the test code is owned by a company and can't be shared. What I can say is that the object is the result of a java script function which updates the value every 1000ms. This value is shown in the html in a sub element of an svg. The test code tries to assign this value to a const via textContent. Does that help?

Florian-HH avatar Jul 18 '22 12:07 Florian-HH

Hi @Florian-HH,

We need an example that we can reproduce locally without any additional setup (see how to create a minimal working example). If you can create such an example please create a separate issue and attach an example to it. Also, it's not necessary to use the production code that cann't be shared. It's possible to create a simple example based on production code. Such example will not contain private information.

miherlosev avatar Jul 21 '22 09:07 miherlosev

Release v2.1.1-alpha.1 addresses this.

github-actions[bot] avatar Nov 29 '22 09:11 github-actions[bot]