Proposal: .pipe command that is essentially a retryable .then
See original GitHub issueProposal: Command that is essentially a retryable .then
Example:
const getTable = id => cy.get(`[data-testid=${id}`)
const getColumnNames = $el => Array.from($el.find('[role=columnheader]')).map(el => el.innerText)
getTable('identifier')
.then(getColumnNames) // The `should` doesn't cause this to re-evaluate
.should('deep.equal', ['Column One', 'Column Two'])
The getTable
will get an element given a test id and getColumnNames
will get the text contents of a table’s column headers. If the table’s column headers aren’t statically known (maybe column order is a user preference), the assertion immediately fails.
I don’t think we want .then
to retry. I think it is good that .then
has strong guarantees that it will only be run once. It just makes composition of functions not quite fit.
There could be another command that does re-run if there is an assertion:
getTable('identifier')
.pipe(getColumnNames) // The `should` would cause re-evaluation
.should('deep.equal', ['Column One', 'Column Two'])
Issue Analytics
- State:
- Created 5 years ago
- Comments:23 (23 by maintainers)
Top Results From Across the Web
Piping in Unix or Linux - GeeksforGeeks
Pipe is used to combine two or more commands, and in this, the output of one command acts as input to another command,...
Read more >bash - How can I use a file in a command and redirect output ...
The reason why you can't do that: bash processes the redirections first, then executes the command. So by the time grep looks at...
Read more >Assignment Two
In this example code, thePipe[0] is a file pointer (an index into the process's open file table) to the read end of the...
Read more >How do I write a retry logic in script to keep retrying to run it ...
for i in 1 2 3 4 5; do command && break || sleep 15; done. Replace "command" with your command. This is...
Read more >A proposal for a Linux SuperCommand set - Ubuntu Discourse
What I am proposing essentially is an extension of the existing Linux ... What if I created a superset of commands (now using...
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
You know - you work and then this guy comes in like it’s Christmas and just drops presents! Love it
Sent from my iPhone
I will add a PR to the plugins and close this PR.
pipe
can be fully implemented in user space.If later the Cypress team thinks it is valuable enough, pipe could be integrated into the core.
Thanks for the feedback!