-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor typedefs for cy * fix dtslint * fix dtslint * add test for extending types 03-00000014 * typo * docs and examples for cy type * sorted props * remove a few tabs * better jsdoc
- Loading branch information
Showing
3 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// Test that plugin authors can write .d.ts files to extend Cypress types | ||
// with new "cy" properties and new methods. | ||
// | ||
// Unfortunately we cannot test that vendor types located in node_modules are working | ||
// since those are copied as part of the deploy process | ||
// | ||
|
||
/** | ||
* If you want to add additional properties to the "cy" object, | ||
* or additional methods to "cy" or "cy.<command>()" chained value, | ||
* declare them and TypeScript will merge new definitions with existing ones. | ||
* @see https://on.cypress.io/typescript#Types-for-custom-commands | ||
*/ | ||
declare namespace Cypress { | ||
interface cy { | ||
/** | ||
* We have added a label property to "cy" object. | ||
* @example console.log(cy.myLabel) | ||
*/ | ||
myLabel: string, | ||
/** | ||
* Definition for a custom command "login" that was added separately | ||
* using `Cypress.Commands.add('login', (username, password) => {...})`. | ||
*/ | ||
login(username: string, password: string): Chainable | ||
} | ||
interface Chainable { | ||
/** | ||
* Additional property added to the chained object, | ||
* returned by Cypress commands. This property will NOT | ||
* be part of "cy" object, but a property of an object | ||
* returned by Cypress commands. | ||
``` | ||
cy.get('.element').chainerProp | ||
``` | ||
*/ | ||
chainerProp: number | ||
} | ||
} | ||
|
||
// $ExpectType string | ||
cy.myLabel | ||
|
||
// new custom command "cy.login" | ||
// $ExpectType Chainable<any> | ||
cy.login(Cypress.env('username'), Cypress.env('password')) | ||
|
||
// "myLabel" property has been added to "interface cy" | ||
// thus it is NOT of the command chain. | ||
// $ExpectError | ||
cy.get('.element').myLabel | ||
|
||
// $ExpectType number | ||
cy.chainerProp | ||
|
||
// $ExpectType number | ||
cy.get('.element').chainerProp |
f518e6e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux x64
version of the Test Runner.You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.
You will need to use custom
CYPRESS_INSTALL_BINARY
url and install Cypress using an url instead of the version.f518e6e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppVeyor has built the
win32 x64
version of the Test Runner.You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.
You will need to use custom
CYPRESS_INSTALL_BINARY
url and install Cypress using an url instead of the version.f518e6e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppVeyor has built the
win32 ia32
version of the Test Runner.You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.
You will need to use custom
CYPRESS_INSTALL_BINARY
url and install Cypress using an url instead of the version.f518e6e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin x64
version of the Test Runner.You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.
You will need to use custom
CYPRESS_INSTALL_BINARY
url and install Cypress using an url instead of the version.