25 lines
578 B
TypeScript
25 lines
578 B
TypeScript
/// <reference types="cypress" />
|
|
|
|
Cypress.Commands.add('getByTestId', (id: string, timeout = 8000) => {
|
|
return cy.get(`[data-testid="${id}"]`, { timeout })
|
|
})
|
|
|
|
Cypress.Commands.add('forbidGeolocation', () => {
|
|
cy.window().then(win => {
|
|
cy.stub(win.navigator.geolocation, 'getCurrentPosition').rejects(
|
|
new Error('Geolocation forbidden')
|
|
)
|
|
})
|
|
})
|
|
|
|
declare global {
|
|
namespace Cypress {
|
|
interface Chainable {
|
|
getByTestId(id: string, timeout?: number): Chainable<JQuery<HTMLElement>>
|
|
forbidGeolocation(): Chainable<void>
|
|
}
|
|
}
|
|
}
|
|
|
|
export {}
|