testcafe icon indicating copy to clipboard operation
testcafe copied to clipboard

SelectText waits for the full timeout duration before selecting text when it is slightly occluded by an element.

Open switch201 opened this issue 7 years ago • 10 comments

What is your Test Scenario?

I am attempting to call selectText on a text box that is slightly occluded by a footer

What is the Current behavior?

When selectText is called it will jump down to where the text box is only partially showing as the footer covers its lower half. Then TestCafe waits up to the timeout duration and then clicks the text box. The behavior is exactly like this issue: https://github.com/DevExpress/testcafe/issues/2080

The difference is that it now only happens when the text box is occluded. If I manually scroll down, then the text box is selected right away. This only happens when testcafe autoscrolls to the text box but the footer is still covering the bottom half of the text box.

What is the Expected behavior?

Tstcafe should select the textBox right away, or scroll slightly farther to avoid this behavior.

What is your web application and your TestCafe test code?

No Public code available at this time. Try to find a webpage with textBoxes and a footer (like a data entry page) and the issue should occur.

Your website URL (or attach your complete example):

Your complete test code (or attach your test files):
 t.selectText(<selector>)
Your complete configuration file (if any):
I am running the test via google chrome.
Your complete test report:

Screenshots:

Steps to Reproduce:

  1. Go to my website ...
  2. Execute this command...
  3. See the error...

Your Environment details:

  • testcafe version: 1.6.0
  • node.js version: 9.5.0
  • command-line arguments:
  • browser name and version:
  • platform and version:
  • other:

switch201 avatar Oct 18 '19 14:10 switch201

Hello, Thank you for your report. Could you please provide us a simple page or public url to reproduce this issue and research it on our side?

Dmitry-Ostashev avatar Oct 18 '19 17:10 Dmitry-Ostashev

At this time, I am unable to share the website that I am testing as it is still under development. I also tried searching for a web page that has a similar footer, but couldn't find one. I will keep looking, but this issue seems to happen whenever there is a "footer" that gets rendered over the bottom of the page. The type of footer that stays at the bottom of the page as you scroll up or down. I am sorry I can't provide a working example, but if you look at the issue I linked up top, the behavior is exactly the same, the only difference being the issue shows it self when the text box is occluded by the footer.

You can probably reproduce the issue by creating a page with one element covering 3/4 of a text box. if you attempt to select text in the text box (which is partially occluded) then the issue should occur.

switch201 avatar Oct 21 '19 15:10 switch201

TestCafe can scroll pages to avoid situations when an action target element is covered by some other absolutely positioned element (header, footer, banner, etc.). We have automated tests for such cases:

https://github.com/DevExpress/testcafe/tree/d7918a1fa4e6a5f76498acd5da1069e55a5c2618/test/functional/fixtures/regression/gh-1057/pages https://github.com/DevExpress/testcafe/blob/024d23bd6bc9e92d84a557d92e3e8ad0898b4d06/test/functional/fixtures/regression/gh-2450/pages/index.html

By default, TestCafe clicks at the center of an input element to activate it before simulating text selection. If your input element is located at the very bottom of your page and there is not enough space for scrolling, you can add a t.click action with custom offsetX and offsetY options to activate your input element before the text selection phase: https://devexpress.github.io/testcafe/documentation/test-api/actions/action-options.html#click-action-options.

AndreyBelym avatar Oct 22 '19 15:10 AndreyBelym

Your assumption that there is no more room to scroll is incorrect. There is still room for the test to scroll, test cafe just doesn't scroll to show the full element. It only scrolls far enough to see the top of the text box not the full thing (maybe this is because at that point the element becomes "visible" according to testcafe. When using other user actions like typing and clicking it appears to work like it should. If what you said was true then i would be having this issue for all the user actions, but I only see this issue for the selectText user action.

Furthermore (and this is why i am so sure this is a bug and not user error) after the timeout, the text is still selected. In that case why does it wait for the timeout duration and then still select the text? If the element was obscured then select text should fail after the timeout duration is reached, but it successfully selects the text after the time out. Nothing changes on the page while testcafe is waiting for the timeout, so there should be no reason it has to wait till the end of the time out to select the text.

Again please see #2080 if there is confusion about the behavior I am describing as the behavior is very similar to that of #2080

switch201 avatar Oct 24 '19 19:10 switch201

I have gotten permission to attach this screenshot showing the issue occurring:

Screen Shot 2019-10-24 at 5 06 50 PM

In this case testcafe is waiting to selectText in the "ACH or Routing Number" text box after it waits for the timeout duration it then successfully selects the text.

Note that there is "shadow" that is also part of the footer. It looks like if the shadow wasn't there testcafe would be scrolling to right up to the point where the middle of the text box is shown, but because of the shadow (which is part of the footer) only about 1/4 of the text box is showing.

Again all this might be a red haring, because as I stated before the text box gets selected at the end of the timeout without the page changing from this state. so the element is visible enough to still get selected at the end of the timeout, so it should be visible enough to select without waitng the full timeout duration.

switch201 avatar Oct 24 '19 21:10 switch201

@switch201

Hello,

This information is not sufficient to reproduce the issue. We are still waiting for your simple project (or a public URL) to reproduce the issue on our side. We will examine it and check for a suitable solution.

Farfurix avatar Oct 28 '19 10:10 Farfurix

I may be able to give a public URL but it won't be available for a month or 2. other than that there is not much more I can provide at this time unfortunately.....

switch201 avatar Oct 28 '19 20:10 switch201

My current workaround for this is to call hover before I call selectText it appears that hover will scroll far enough to allow this issue to not occur when selectText is called

switch201 avatar Oct 29 '19 14:10 switch201

We are happy to hear that you found a workaround for your issue. I'll close it for now. However, if you have a public url or reproducible sample, feel free to add it here. We'll reopen the issue immediately after we have the project to research.

AlexKamaev avatar Oct 30 '19 14:10 AlexKamaev

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

lock[bot] avatar Nov 09 '19 15:11 lock[bot]