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.

TypeScript types for cy.then

See original GitHub issue

Type of feature

  • Add a new command
  • Extend a default Cypress command
  • Change a Cypress-commands command
  • Other

What do you want to accomplish?

A clear and concise description of what the problem is. Ex. I’m always frustrated when […] I am using Cypress with typescript and would love to use the retry feature of your package

Why?

A short description of why you want to accomplish the things mentioned above. however I am getting errors related to types.

Argument of type '{ retry: boolean; }' is not assignable to parameter of type 'Partial<Timeoutable>'. Object literal may only specify known properties, and 'retry' does not exist in type 'Partial<Timeoutable>'.ts(2345)

Describe possible implementations

A clear and concise description of what you want to happen. I am not quite sure how, but I think we need to overwrite the default cypress then typings to include this packages options.

Additional context

Add any other context or screenshots about the request here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Lakitnacommented, Apr 10, 2019

Awesome! I’ll go ahead and merge it then.

I’ll include it in the 0.1.0 release which will also include #4 which I plan to finish up somewhere tonight or tomorrow.

0reactions
jkdowdlecommented, Apr 10, 2019

That looks like it did the trick! Thank you so much!

I tried both cy.then({ retry: true }, () => ++c) cy.then(() => ++c, { retry: true })

Both passed and gave me the expected warnings when I passed incorrect options.

describe('retryability', () => {
  it('retries until the upcoming assertion passes', () => {
    let c = 0
    cy.then(() => ++c, { retry: true })
  })
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript - Cypress Documentation
Cypress ships with official type declarations for TypeScript. This allows you to write your tests in TypeScript. Install TypeScript To use TypeScript.
Read more >
Starting with TypeScript in Cypress - Filip Hric
I have this getDataCy command,that is just a simple wrapper around Cypress .get() command. It will select element based on data-cy attribute so ......
Read more >
TypeScript type definitions · Issue #1040 · cypress-io ... - GitHub
TypeScript type definitions #1040 ... cy.then is going to be removed as a parent command. cy.resolve is being added as an alias of...
Read more >
Convert Cypress Specs from JavaScript to TypeScript
Each Cypress JS spec file now automatically knows the cy , Cypress , etc. You can watch me explaining the jsconfig.json file in...
Read more >
Molding Cypress & Typescript together. | by KS - Medium
New to Typescript or new to Cypress or in fact both? It is easy to implement. Gather snippets for configuring the two and...
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