question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Indicate when XHR's match aliases multiple times, and correlate those to waits

See original GitHub issue

Current behavior:

There’s not an easy to know or correlate multiple matched XHR aliases to knowing how to wait for them.

Here’s an example screenshot:

zone_single_modal_edit_name_spec js-1

The problem is that the user is trying to wait on the 2nd XHR. But since they’ve only added a single cy.wait("@getTable") Cypress only waited on the first XHR to resolve.

Desired behavior:

When an XHR matches an alias multiple times we should add a number indicator next to it…

(XHR) /getTable @getTable
(XHR) /getTable @getTable.2
(XHR) /getTable @getTable.3

So then when adding code like:

cy
.wait("@getTable")
.wait("@getTable")
.wait("@getTable")

The command log would actually look like:

WAIT @getTable
WAIT @getTable.2
WAIT @getTable.3

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

8reactions
jennifer-shehanecommented, Aug 13, 2018

@bsmithEG There actually is an undocumented way to check the number of times an XHR was responsed to using .all on the alias.

cy.wait('@getRuns')
cy.tick(10000)
// should have done 2 request responses, and definitely not 3
cy.get('@getRuns.all').should('have.length', 2)
7reactions
danieljosephbrennancommented, May 24, 2019

This is just what I need, but I can’t find anything in the docs. How would I wait for the nth instance of a particular call?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wait for multiple XHR requests to the same url or endpoint
You should set up an alias (using .as()) to a single cy.route() that matches all of the XHRs. You can then cy.wait() on...
Read more >
Azure Application Insights for JavaScript web apps
Get page view and session counts, web client data, and single-page applications and track usage patterns. Detect exceptions and performance ...
Read more >
AM 6 > Authentication and Single Sign-On Guide
For example, the following callback indicates a wait time of 10 seconds: ... For more information, see "To Configure DNS Aliases for Accessing...
Read more >
The CometD Reference Book — 7.0.9
The address https://bugs.cometd.org is an alias for the CometD GitHub ... You can use wildcards to match multiple channels: channel /foo/* ...
Read more >
A measurement study of insecure javascript practices on the ...
more popular than using the relatively secure technique of creating script elements via DOM methods. Our analysis indicates that safe alternatives to these...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found