-
Notifications
You must be signed in to change notification settings - Fork 673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TestCafé can't click on a two-word link split over two lines with native automation enabled #8179
Comments
Hello, The issue is similar to this one: #8148 (comment). Basically, the click method clicks the center of your Selector by default. In the case of a two-word link, you need to add an offset option to your click call. For your specific example, the following option worked: .click('.info a', { offsetX: 5 }) https://testcafe.io/documentation/402710/reference/test-api/testcontroller/click#options Let us know if this helps. |
Thanks for the reply @Bayheck. No, that does not fix the issue, as a 5px horizontal offset from the top left corner of the bounding box is still not on the link itself, as you can see from this screenshot: This seems like a fairly fundamental regression in behaviour -- if I'm telling TestCafé to click on a link, it should be able to do so without me having to provide case-by-case special handling. It worked before version 3 without any issue. Obviously we can change our client side code to make the issue go away, but I really think this is a bug you should address. |
Hello, in v3.0 and newer, TestCafe runs tests with the Native Automation option enabled by default. The update from v2 to v3 is major and it may lead to breaking changes. Please use the offset option of your choice to adjust the click. If Native Automation does not meet your needs, you can always disable it and run your tests:
|
It seems extraordinary to me that simply using Bear in mind also that testing UI like this on different devices or resolutions might require different offsets as the text will wrap differently. If you're unwilling to look at fixing this in your code, then you will need to update your documentation for this method to explain that it isn't reliable for text-based links that break across lines. Other people will have the same problem in the future. |
Hello, |
<!-- Thank you for your contribution. Before making a PR, please read our contributing guidelines at https://github.com/DevExpress/testcafe/blob/master/CONTRIBUTING.md#code-contribution We recommend creating a *draft* PR, so that you can mark it as 'ready for review' when you are done. --> ## Purpose Testcafe did not click properly on multiline elements. ## Approach In testcafe-hammerhead replaced getBoundingClientRect with getClientRects. Fix Edge workflow tests #8189 ## References #8179 #8148 Hammerhead PR: DevExpress/testcafe-hammerhead#3004 ## Pre-Merge TODO - [x] Write tests for your proposed changes - [ ] Make sure that existing tests do not fail --------- Co-authored-by: Bayheck <adil.rakhaliyev@devexpress.com>
What is your Scenario?
We are upgrading from TestCafé 2.6.1 to the latest version.
One of our tests involves clicking on a two-word link that is split over two lines, see this image for an example:
What is the Current behavior?
The test fails in TestCafé > 3 when native automation is enabled. It works in 2.6.1.
What is the Expected behavior?
The click on the link should work, as it did in previous versions of TestCafé.
What is the public URL of the test page? (attach your complete example)
https://tc-link-click.surge.sh/
What is your TestCafe test code?
test.js
Your complete configuration file
N/A
Your complete test report
Screenshots
No response
Steps to Reproduce
Run the test above with TestCafé 3.5.0.
TestCafe version
3.5.0
Node.js version
20.6.1
Command-line arguments
npx testcafe@3.5.0 chrome test.js
Browser name(s) and version(s)
Seen on Chrome 123 and 124
Platform(s) and version(s)
Seen on macOS and Linux
Other
No response
The text was updated successfully, but these errors were encountered: