Uncaught object error thrown using typeText on an input with an existing value #8202
Labels
STATE: Need clarification
An issue lacks information for further research.
STATE: Need simple sample
A simple sample is required to examine the issue.
TYPE: bug
The described behavior is considered as wrong (bug).
What is your Scenario?
Using Testcafe to test a Vue app, the
typeText
method throws an obscure error when typing text into a field that is already auto-populated with text (in this case, a reply button is clicked which shows a text field with a username mention pre-populated, and attempting to add more text causes this error - screenshots below). The issue happens on Chrome and Firefox but not Safari. The error fields mention frames, but there is no iFrame related to these components or on the page where this test is failing. Similar issues I've found are either from many years/TC versions ago, or are about interacting with iFrames.What is the Current behavior?
On chrome and firefox, when the
div[role=textbox]
below does not have the nestedspan
tag, no errors occur. Once it does,typeText
andpressKey
both throw the error.What is the Expected behavior?
typeText
should add additional text to the field instead of throwing an error, as it does when the field is emptyWhat is the public URL of the test page? (attach your complete example)
Unable to find a good example of this on a public website yet
What is your TestCafe test code?
text field from the Vue source code:
Selector definition in Testcafe:
Helper function which fails on the
typeText
line:Your complete configuration file
{
"src": "*-spec.js",
"concurrency": 1,
"debugOnFail": false,
"assertionTimeout": 10000,
"skipJsErrors": true,
"disableMultipleWindows": true,
"screenshots": {
"path": "./testscreenshots",
"takeOnFails": true,
"thumbnails": false
},
"quarantineMode": {
"successThreshold": 1,
"attemptLimit": 3
}
}
Your complete test report
Screenshots
Chrome^ When the
div[role=textbox]
here does not have the nestedspan
tag, no errors occur. Once it does,typeText
andpressKey
both throw the above error.Safari^ where there is no issue
Firefox^ where the issue still happens
Failure state w/ error, the runner will flash green a bunch of times, then turns red when it fails.
Steps to Reproduce
Use
typeText
on adiv[role="textbox"]
that has an existing value in the input. In this case, text with a link.TestCafe version
3.6 (this worked on versions earlier than 3)
Node.js version
20.14.0 & 18.14.0
Command-line arguments
testcafe chrome -c 1 testPath-spec.js --skip-uncaught-errors --skip-js-errors --disable-native-automation
Browser name(s) and version(s)
Chrome 125, Firefox 122
Platform(s) and version(s)
mocOS Ventura 13
Other
Tried running the test with and without native automation enabled for Chrome, with no difference. The issue also happens in Firefox, which suggests it has nothing to do with the new chrome/native automation changes in Testcafe. The issue does not happen in Safari despite the DOM being similar.
Tried adding
await t.expect(this.replyInput.visible).ok();
beforetypeText
- made no difference. Also confirmed in the TC debugger that my selector for this field is valid + no others found that it could be confused with.Tried explicitly clicking the input although it appears to be focused already - this doesn't throw the error, but instead proceeds without entering any text, making the test fail.
Tried adding
await t.pressKey('right');
beforetypeText
- the same error is thrown on thepressKey
line instead.Tried
console.log(await this.replyInput.innerText);
beforetypeText
- this correctly outputs the existing text in the input (the username mention text).Tried upgrading Node from v18.14.0 to v20.14.0 - issue still occurs.
Tried
typeText
with and without{ paste: true }
for all these scenarios - made no difference.Tried moving the helper function code into a
try/catch
- still caught the same error message.Tried using
.dispatchEvent
(from this similar issue) to input the text various ways (tried keydown, keydown + keyup, keypress events with key, key + code, and key options). This doesn't throw the error, but instead proceeds without entering any text, making the test fail.ex)
The text was updated successfully, but these errors were encountered: