Skip to content
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

CypressError: Timed out retrying: coordsHistory must be at least 2 sets of coords #3738

Closed
mmsudy opened this issue Mar 18, 2019 · 20 comments · Fixed by #15643
Closed

CypressError: Timed out retrying: coordsHistory must be at least 2 sets of coords #3738

mmsudy opened this issue Mar 18, 2019 · 20 comments · Fixed by #15643

Comments

@mmsudy
Copy link

mmsudy commented Mar 18, 2019

@jennifer-shehane @brian-mann @bahmutov #coordsHistory

Current behavior:

image

image

Desired behavior:

Steps to reproduce: (app code and test code)

cy.get('div._md-container.md-ink-ripple').click({multiple:true})

want to select all check boxes once at a time so, used div class

Versions

cypress Version 3.1.5 , OS Windows 10, Chrome 72

@jennifer-shehane
Copy link
Member

Error being thrown: https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cy/actionability.coffee#L200

Yeah, this is not a great error message. Can you provide a reproducible example so that we can recreate this? App code + test code - just make a small repo of the isolated problem, not your entire repo.

I tried doing .click({multiple: true}) and couldn't recreate it.

@jennifer-shehane jennifer-shehane added stage: needs information Not enough info to reproduce the issue type: bug labels Mar 19, 2019
@mmsudy
Copy link
Author

mmsudy commented Mar 19, 2019

Error being thrown: https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cy/actionability.coffee#L200

Yeah, this is not a great error message. Can you provide a reproducible example so that we can recreate this? App code + test code - just make a small repo of the isolated problem, not your entire repo.

I tried doing .click({multiple: true}) and couldn't recreate it.

<div flex="30" style="margin-top:10px" class="flex-30">
  <md-checkbox class="blue ng-pristine ng-untouched ng-valid ng-empty" ng-model="entity._profile.ext.minutebook_local" aria-label="minutebook location" ng-disabled="userMinutebook.access === 'read-only' || userMinutebook.access === 'summary-only'" tabindex="0" type="checkbox" role="checkbox" aria-disabled="false" aria-checked="false" aria-invalid="false">
    <div class="_md-container md-ink-ripple" md-ink-ripple="" md-ink-ripple-checkbox="">
      <div class="_md-icon"></div>
    </div>
    <div ng-transclude="" class="_md-label">
      <span class="ng-scope">Minutebook is at our office</span>
    </div>
  </md-checkbox>
</div>

<div flex="30" class="flex-30">
  <md-checkbox class="blue ng-pristine ng-valid ng-empty ng-touched" ng-model="entity._profile.ext.corp_seal" aria-label="corporate seal" ng-disabled="userMinutebook.access === 'read-only' || userMinutebook.access === 'summary-only'" tabindex="0" type="checkbox" role="checkbox" aria-disabled="false" aria-checked="false" aria-invalid="false" style="">
    <div class="_md-container md-ink-ripple" md-ink-ripple="" md-ink-ripple-checkbox=""> . 
      <div class="_md-icon"></div>
      <div class="md-ripple-container"></div>
    </div>
    <div ng-transclude="" class="_md-label">
      <span class="ng-scope">Corporate seal</span>
    </div>
  </md-checkbox>
</div>

like this 13 elements only ng-model was different everything else is same
instead of writing code for every model I have written

cy.get('div._md-container.md-ink-ripple').click({multiple:true})

to select multiple check box

@jennifer-shehane
Copy link
Member

@mmsudy I think the styles would need to be provided as well. The provided html alone does not seem to produce the required effect needed for testing - the checkboxes are not visible.

Screen Shot 2019-03-19 at 10 48 25 PM

@mmsudy
Copy link
Author

mmsudy commented Mar 19, 2019

@mmsudy I think the styles would need to be provided as well. The provided html alone does not seem to produce the required effect needed for testing - the checkboxes are not visible.

Screen Shot 2019-03-19 at 10 48 25 PM

image

out of 13 check boxes after 9 boxes cypress throwing that error

@jennifer-shehane
Copy link
Member

@mmsudy Can you provide the css from your stylesheet that affects these DOM elements where I can copy and paste them into my own stylesheet? Thanks!

@mmsudy mmsudy closed this as completed Mar 20, 2019
@mmsudy
Copy link
Author

mmsudy commented Mar 20, 2019

@mmsudy Can you provide the css from your stylesheet that affects these DOM elements where I can copy and paste them into my own stylesheet? Thanks!
@jennifer-shehane css.docx

@jennifer-shehane
Copy link
Member

Hey @mmsudy, why did you close the issue? Did you resolve the problem?

@mmsudy mmsudy reopened this Mar 21, 2019
@mmsudy
Copy link
Author

mmsudy commented Mar 21, 2019

@jennifer-shehane No not yet

@jennifer-shehane
Copy link
Member

I've still been unable to reproduce this exactly with the html, css, and test code provided.
Unfortunately we have to close this issue as there is not enough information to reproduce the problem. This does not mean that your issue is not happening - it just means that we do not have a path to move forward.

Please comment in this issue with a reproducible example and we will reopen the issue. 🙏

@jennifer-shehane jennifer-shehane removed stage: needs information Not enough info to reproduce the issue type: bug labels Jul 11, 2019
@themightychris
Copy link

I'm running into this too, I suspect that the missing ingredient was CSS that pushes some of the to-be clicked elements out of the viewport

@jennifer-shehane
Copy link
Member

If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run.

@mauricius
Copy link

I have experienced this problem too. Apparently Cypress cannot get all the elements if a subset of them are outside the viewport. I temporarily solved it using a cycle, selecting only a small number of elements in each iteration
cy.get('.tags > .tag:lt(20)').click({multiple:true})

@beenushrestha
Copy link

@mmsudy I was also searching solution for this particular problem nd the below ode worke for me:

cy.get('div._md-container.md-ink-ripple').click({multiple:true force: true})

Also add force: true. This worked for me hope works for you as well.

@jennifer-shehane
Copy link
Member

This is happening occasionally in our Windows Appveyor tests https://ci.appveyor.com/project/cypress-io/cypress/builds/38219970/job/2pjd3fi6s1kwe30c It's very flaky though - so it's hard to reproduce reliably.

Screen Shot 2021-03-15 at 12 32 35 PM

@github-actions
Copy link
Contributor

Internal Jira issue: TR-707

@chrisbreiding
Copy link
Contributor

I found the key to reproducing this is slowing the browser down using Chrome's Performance tab options:

  • Run the kitchensink's actions.spec.js click spec. You can put an .only on the test.
  • Open Chrome DevTools, go to Performance tab
  • Click the gear (⚙) icon on the top right
  • Set CPU throttling to '6x slowdown'
  • Enable advanced paint instrumentation (slow)

Screen Shot 2021-03-22 at 10 05 03 AM

  • Hit record and rerun the spec

Screen Shot 2021-03-22 at 10 07 42 AM

The reason this happens is that we only increase the default timeout (4000ms) by 50ms per click when there are multiple clicks, so if the system is resource-constrained and the execution is slow, it's not enough time to perform each click, especially if there are decent number of clicks.

The error message is definitely misleading. It should say something like 'Timed out attempting to click multiple elements'. The coordsHistory bit is a red herring and just happens to be the error that gets picked up when the command times out. The timeout duration in the error message is also wrong. It says it timed out after 4050ms, but it should be 4300ms or so. We settle on the timeout too early, but it's dynamic based on the number of clicks.

We should fix the error message, but that still leaves a question to be answered.

Should we only fix the error message because it's the expected behavior that clicking multiple elements should happen within the required time frame? Then the user would be expected to increase the timeout for that click command, since it's going to take too long to click every element with the default timeout.

Or is the timeout we add per click too short and we should increase it so this is less likely to happen? With a slow enough system, even increasing it to 150ms, for example, might not be enough and still require setting a custom, higher timeout for the click, but maybe there's a more reasonable amount than 50ms.

@jennifer-shehane
Copy link
Member

@chrisbreiding I didn't understand there being a specific click increased timeout of 50ms. This isn't documented anywhere. I would kind of assume with multiple clicks that each click would have default timeout of 4000ms. So clicking 3 elements would be 12000ms. I dunno, this secret timeout is weird to me.

I would like a solution that is the most common sense solution and for it to be well documented. Let's not just blindly increase it to 150ms. But think how the solution can work for most use cases without the timeout to begin with. Anything that can reduce flake with network variation will be a win.

@chrisbreiding
Copy link
Contributor

It was news to me too. I talked to Brian about it, and he said it's an oversight and each click should get the full 4000ms timeout. I'm working on fixing that, the error message, and I'll update the click doc too.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 24, 2021

The code for this is done in cypress-io/cypress#15643, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 5, 2021

Released in 7.0.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v7.0.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants