Show dynamic request aliases in the command log
See original GitHub issueWhat would you like?
When I assign an alias from my cy.intercept()
route handler, I want it to show up in the command log just as if I had aliased the route using cy.intercept().as()
.
Why is this needed?
The command log is extremely useful to understanding test execution and control flow, and without a clear link between the route table and an XHR made by my app, it can be difficult for developers to understand what happened.
Other
To reproduce the issue, you can run this standalone test:
describe("Dynamic aliasing", function () {
it("test", () => {
cy.visit("https://jsonplaceholder.cypress.io/");
cy.intercept('/todos/1', req => {
req.alias = 'dynamic';
req.continue();
});
cy.contains('button', 'Try it').click();
cy.contains('#result', 'delectus aut autem');
});
});
Which results in the XHR having “no alias” in the command log, even though I clearly gave it an alias:
Issue Analytics
- State:
- Created 2 years ago
- Reactions:11
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Db2 11 - Data sharing - Member-specific location aliases - IBM
You can use the MODIFY DDF command with the ALIAS option to define and manage as many as 40 location aliases dynamically. You...
Read more >Linux dynamic alias - Super User
The alias command is for making shortcuts for regularly issued commands ... This function will look for the logfile in the directory passed....
Read more >Variables and Aliases - Cypress Documentation
To alias something you'd like to share use the .as() command. Let's look at our previous example with aliases. beforeEach(() ...
Read more >alias command in Linux with Examples - GeeksforGeeks
–help option : It displays help Information. Syntax: alias --help. How to remove an alias? We use unalias command for this purpose.
Read more >Linux: 70 commands aliases for everyday life
Aliases are a very dynamic way to add power to the command terminal ... This way you can type less to request the...
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 FreeTop 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
Top GitHub Comments
It seems I can neither use
cy.wait('@test')
on the dynamic alias.Here’s a workaround: Use
Cypress.log
in thecy.intercept
.Cypress.log
runs syncrounously, so the log appears directly below the request, which is good enough for identifying which graphql request is which. https://docs.cypress.io/api/cypress-api/cypress-log#Syntax