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.

Not possible to set specific timeout on custom commands

See original GitHub issue

This issue is related to Cypress API for custom commands. Hopefully it’s just undocumented or I didn’t find it in the docs.

I define a custom command, which might be a long operation. I wish to control the default timeout for my custom command. My command looks like this:

Cypress.Commands.add('myCommand', () => {
  return cy.document().then(doc => {
   <long operation>
  });
});

I’d like the <long operation> to have its own timeout. Is that possible? Or achievable in some way?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
vince1995commented, Sep 11, 2020
Cypress.Commands.add("login", () => {
    return cy.document().then({ timeout: 10000 }, doc => {
        
        // And here your code.

    });
});
1reaction
vince1995commented, Sep 14, 2020

@vince1995 Auth.signIn is from amplify, it’s an api, why should i wrap it in cy.document promise ?

It’s just a workaround so you can sepcify the default timeout time in the command and not in the test.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress: custom timeout in specific should command
tl;dr. Just pass the timeout to get , it will pass it down to should . cy.get('body', {timeout: 30000}).should('contain','success') ...
Read more >
Custom Commands - Cypress Documentation
Custom commands are a great way to abstract away setup (specific to your app). When doing those kinds of tasks, skip as much...
Read more >
How to increase time out for one specific command
I am implementing an operational command and I want to increase the time out for this specific command as it takes longer time...
Read more >
Setting Command Timeouts in Bash | Baeldung on Linux
The timeout command is part of an external package. This means that it might not be available on every system. 4.2. Custom Timeouts....
Read more >
Understanding command statuses - AWS Systems Manager
Configure Amazon Simple Notification Service (Amazon SNS) to send notifications for all status changes or specific statuses such as Failed or TimedOut. Run ......
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