-
Notifications
You must be signed in to change notification settings - Fork 20
/
cypress.d.ts
44 lines (39 loc) · 1.95 KB
/
cypress.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/// <reference types="cypress" />
declare namespace Cypress {
interface Chainable<Subject> {
/**
* Visit the blank test page. This should be in a `before` block of every test page. This command will load the iframe.html
* file. It is meant to be used with `cy.loadStory`
*/
visitStorybook(options?: Partial<VisitOptions>): Cypress.Chainable<Window>
/**
* Load a story. This will invoke the storybook router,
* unmount a previous story, mount the current story and force a rerender
* This should be in a `beforeEach` block to force a fresh new story
* @param categorization Categorization information found in the `.storiesOf` function or `title` - usually used for menu navigation
* @param story Variant of the story example in the `.add` function or the export name
* @example
* cy.loadStory('Button', 'Primary')
*/
loadStory(categorization: string, story: string): Cypress.Chainable<JQuery>
/**
* Change a knob of your story. Useful for testing permutations of a story without creating unique ones.
* @param name Name of the knob provided in the story
* @param value Value of the knob. The type is not checked, so make sure it is valid for your story
*/
changeKnob(name: string, value: any): Cypress.Chainable<null>
/**
* Change an Arg of your story. Useful for testing permutations of a story without creating unique ones.
* @param name Name of the Arg provided in the story
* @param value Value of the Arg. The type is not checked, so make sure it is valid for your story
*/
changeArg(name: string, value: any): Cypress.Chainable<null>
/**
* Retrieve a spy of a given action by name
* @param name The name as passed into the `action` function. E.g. `click` for `action('click')('foo')`.
* @example
* cy.storyAction('click').should('have.been.called')
*/
storyAction(name: string): Cypress.Chainable<sinon.SinonSpy>
}
}