-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.ts
40 lines (33 loc) · 1.05 KB
/
commands.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
/// <reference types="cypress" />
Cypress.Commands.add('dataCy', (value) => {
return cy.get(`[data-cy="${value}"]`)
})
Cypress.Commands.add('visitHash', (value) => {
return cy.visit(`/#${value}`)
})
Cypress.Commands.add('inputWrapperError', () => {
return cy.get('.mantine-InputWrapper-error')
})
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cypress {
interface Chainable {
/**
* Custom command to select DOM element by `data-cy` attribute.
* @example cy.dataCy('greeting')
*/
dataCy(value: string): Chainable<unknown>
/**
* A wrapper over cy.visit() that prepends the hash to the URL.
* @example cy.visitHash('/characters/1') => cy.visit('/#/characters/1')
*/
visitHash(value: string): Chainable<unknown>
/**
* A wrapper over cy.get() that selects the error message of an input.
* This is generated client side by Mantine when submitting a form.
*/
inputWrapperError(): Chainable<unknown>
}
}
}
export {}