Allow one to store location as alias and visit it later
See original GitHub issueDesired 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:
- Created 5 years ago
- Reactions:6
- Comments:8 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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?
A shorter version of
michael1visser’s code: