-
Notifications
You must be signed in to change notification settings - Fork 667
Expand file tree
/
Copy pathsupport.ts
More file actions
36 lines (29 loc) · 905 Bytes
/
support.ts
File metadata and controls
36 lines (29 loc) · 905 Bytes
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
/// <reference types="cypress" />
import * as toolbelt from 'ts-toolbelt'
// Workaround for @testing-library/dom problem.
// We should be able remove it in the future.
if (typeof global === 'undefined') {
Object.assign(window, { global: window })
}
require('@testing-library/cypress/add-commands')
require('@percy/cypress')
declare global {
namespace Cypress {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Chainable<Subject> extends Chainables<typeof commands> {}
}
}
export {}
const commands = {}
type Chainables<T extends object> = {
[K in keyof T]: T[K] extends (...args: any[]) => any
? (
...args: toolbelt.List.Tail<Parameters<T[K]>>
) => Cypress.Chainable<ReturnType<T[K]>>
: never
}
Cypress.on('uncaught:exception', (err, _runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})