DevExpress / testcafe

A Node.js tool to automate end-to-end web testing.
https://testcafe.io
MIT License
9.82k stars 670 forks source link

Assertion Failure Is throwing Uncaught exception #6861

Closed aprabh001c closed 1 year ago

aprabh001c commented 2 years ago

What is your Scenario?

When TestCase fail due to assertion, it throws an uncaught exception, sometime it leads to testcase termination. Which is affecting automated run. I have tried to replicate this issue in a public website. Please refer details in respective sections

What is the Current behavior?

1) AssertionError: expected false to be truthy

  Browser: Chrome 97.0.4692.99 / Windows 10

      4 |fixture `UnHandledException`
      5 |
      6 |test(`UnhandledExceptionTC`, async tn=>{
      7 |    await t.navigateTo("https://www.xfinity.com/learn/offers");
      8 |    await t.wait(10000);
   >  9 |    await t.expect(Selector('#localization-address-fieldJunk').visible).ok()
     10 |})

     at <anonymous> (C:\Users\xxxxxxx\unexpected.js:9:73)
     at asyncGeneratorStep (C:\Users\xxxxx\unexpected.js:1:259)
     at _next (C:\Users\xxxxx\unexpected.js:1:597)

2) Uncaught exception:

  Error [ERR_HTTP2_SESSION_ERROR]: Session closed with error code 11
  at Http2Session.onGoawayData (internal/http2/core.js:649:21)
  at Http2Session.callbackTrampoline (internal/async_hooks.js:134:14)

  Browser: Chrome 97.0.4692.99 / Windows 10

TestCafe Version - 1.18.2 Node Version - v14.17.0

What is the Expected behavior?

Test should fail without any exception.

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

https://www.xfinity.com/learn/offers

What is your TestCafe test code?

import {t, Selector} from 'testcafe'

fixture UnHandledException

test(UnhandledExceptionTC, async tn=>{ await t.navigateTo("https://www.xfinity.com/learn/offers"); await t.wait(10000); await t.expect(Selector('#localization-address-fieldJunk').visible).ok() })

Your complete configuration file

No response

Your complete test report

No response

Screenshots

2) Uncaught exception:

  Error [ERR_HTTP2_SESSION_ERROR]: Session closed with error code 11
  at Http2Session.onGoawayData (internal/http2/core.js:649:21)
  at Http2Session.callbackTrampoline (internal/async_hooks.js:134:14)

  Browser: Chrome 97.0.4692.99 / Windows 10

Steps to Reproduce

1. 2. 3.

TestCafe version

1.18.2

Node.js version

v14.17.0

Command-line arguments

testcafe chrome -F UnHandledException

Browser name(s) and version(s)

Chrome 97.0.4692.99

Platform(s) and version(s)

Windows 10

Other

No response

AlexKamaev commented 2 years ago

Thank you for reporting this. I was able to reproduce the issue. For the team: I was able to reproduce it with the testcafe-hammerhead playground.

nvindraneel4 commented 2 years ago

Hi, I am running into a similar issue, can someone please provide me a solution here. Thank you.

github-actions[bot] commented 2 years ago

There are no workarounds. Once we get any updates, we will post them in this thread.

miherlosev commented 1 year ago

Hi @aprabh001c,

TestCafe runs tests using the URL-rewritten proxy. This approach is good. However, there is a way to improve the stability and speed of test execution - the native browser automation API. We have a test execution mode uses native browser automation - we call it the Proxyless mode. In Proxyless mode, a few issues are already fixed. By the way, this issue was also fixed in Proxyless mode. Try running your tests in Proxyless mode and let us know the results. This option is available in all interfaces:

// Command-line
testcafe chrome tests --experimental-proxyless

// Programmatic
const testcafe = await createTestCafe({ experimentalProxyless: true });

// Configuration file
{
   "experimentalProxyless": "true"
}   

Note that at present it is an experimental mode. Also, the Proxyless mode is implemented only in Google Chrome. It will not work correctly if you run tests in a non-Chrome browser or in a combination of other browsers.

aprabh001c commented 1 year ago

Node Version - 19.3.0 TestCafe Version - 2.3.0 Browser - Chrome

When experimentalProxyless=true, testcafe is not clicking _search button( or after clicking browser is not responding) and it fails

Script Used to reproduce with Public Website import {t, Selector} from 'testcafe'

fixture UnHandledException

test(UnhandledExceptionTC, async tn=>{ const _addressField = Selector('#Address_SingleStreetAddress,input[name="localizationAddressField"]'); const _search = Selector(".localization-container button[type='submit']");

await t.navigateTo("https://www.xfinity.com/learn/offers"); await t.wait(10000); await t.typeText(_addressField,"200 MAIN ST, NORTHAMPTON, MA 01060",{paste:true}) await t.wait(2000) await t.click(_search) await t.expect(_search.visible).notOk();

})

miherlosev commented 1 year ago

Hi @aprabh001c,

This issue is not reproduced with combination of testcafe@3.0.1 and the Google Chrome browser. Feel free to reopen this issue if you encounter it in other browsers.