Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting defaultCommandTimeout in cypress.json is not applied #19

Closed
adrians5j opened this issue Nov 1, 2018 · 3 comments · Fixed by #22
Closed

Setting defaultCommandTimeout in cypress.json is not applied #19

adrians5j opened this issue Nov 1, 2018 · 3 comments · Fixed by #22
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed released

Comments

@adrians5j
Copy link
Contributor

  • cypress-testing-library version: 2.3.1
  • node version: 9.0.0
  • npm (or yarn) version: 1.10.1

Relevant code or config

        cy.visit("/")
            .getByTestId("signUpButton", {timeout: 6000})

What you did:
I wanted to select a few elements, with a longer timeout. After a few selects, I figured it would be just easier to set the default command timeout in cypress.json, so I don't have to set this every time I call getBy... methods. So I went to cypress.json and put "defaultCommandTimeout": 6000.

What happened:
The default 6000ms command timeout wasn't applied.

Suggested solution:
I guess we should modify the defaults object (https://github.com/kentcdodds/cypress-testing-library/blob/master/src/index.js#L5):

var defaults = {
  timeout: Cypress.config().defaultCommandTimeout
};
@kentcdodds
Copy link
Member

Thanks @Adrian1358! I'd love a PR for this :)

@kentcdodds kentcdodds added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Nov 6, 2018
@adrians5j
Copy link
Contributor Author

Will do @kentcdodds!

kentcdodds pushed a commit that referenced this issue Nov 8, 2018
**What**:
- fixes #19

**Why**:
Developers would expect `cypress-testing-library` commands to respect `defaultCommandTimeout` value (this value can be set via `cypress.json`).

**How**:
We just replaced the hard-coded `3000` ms with `Cypress.config().defaultCommandTimeout`.

**Checklist**:

* [x] Documentation N/A
* [ ] Tests
* [ ] Ready to be merged
* [x] Added myself to contributors table <!-- this is optional, see the contributing guidelines for instructions -->

At this point, I'm just not sure what would be the most appropriate way to test this, any advice? Would it be better to test this with cypress or with jest ?

Thanks!
@kentcdodds
Copy link
Member

🎉 This issue has been resolved in version 2.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants