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.

Allow one to store location as alias and visit it later

See original GitHub issue

Desired behavior:

I would love if something like this would work:

cy.location('pathname').should('match', /\/document\/(.*)/).as('document');

// ... much later ...

cy.visit('@document');

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:6
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
joshpzerocommented, Apr 22, 2019

This seems like some pretty useful behaviour that fits the use case for the alias nicely. Can this be prioritised or a proposed solution for a custom command?

0reactions
mshavliukcommented, Oct 18, 2022

A shorter version of michael1visser’s code:

cy.get<string>('@url').then(cy.visit);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Variables and Aliases - Cypress Documentation
Whenever you have mutable objects and you're trying to compare them, you'll need to store their values. Using const is a perfect way...
Read more >
How to save a variable/text to use later in Cypress test?
I'm trying to store the text of a div on one page to use later, for example: // let vpcName; it('Store current name...
Read more >
Lambda function aliases - AWS Documentation
You can create one or more aliases for your Lambda function. A Lambda alias is like a pointer to a specific function version....
Read more >
Add a user alias domain or secondary domain - Google Support
If you own another domain, you can add it to your Google Workspace or Cloud Identity account. For example, you might manage multiple...
Read more >
about Aliases - PowerShell | Microsoft Learn
After you create the alias for the cmdlet name, you can use the ... a set of built-in aliases, including cd and chdir...
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