-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathindex.d.ts
104 lines (87 loc) · 3.24 KB
/
index.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
declare module 'gherkin-testcafe' {
global {
interface GherkinTestcafeRunner extends Runner {
tags(tags: string[]): GherkinTestcafeRunner;
parameterTypeRegistryFile(path: string): GherkinTestcafeRunner;
dryRun(enabled: boolean): GherkinTestcafeRunner;
}
interface GherkinTestCafe extends TestCafe {
/**
* Creates the test runner that is used to configure and launch test tasks.
*/
createRunner(): GherkinTestcafeRunner;
/**
* Creates the live mode test runner that is used to configure and launch test tasks.
*/
createLiveModeRunner(): GherkinTestcafeRunner;
/**
* Contains the URL of TestCafe for remote access
*/
browserConnectionGateway: { connectUrl: string };
}
interface GherkinTestCafeFactory extends TestCafeFactory {
(
hostname?: string,
port1?: number,
port2?: number,
sslOptions?: TlsOptions,
developmentMode?: boolean
): Promise<GherkinTestCafe>;
}
interface TestController {
testRun: {
test: {
name: string;
meta: Record<string, string>;
fixture: {
name: string;
meta: Record<string, string>;
};
};
/**
* Shared between all the tests of a given feature - use carefully as sharing data between
* tests goes against the isolation principle
*/
fixtureCtx: Record<string, any>;
};
}
}
const createTestCafe: GherkinTestCafeFactory;
export * from 'testcafe';
export default createTestCafe;
}
declare module '@cucumber/cucumber' {
import { t } from 'testcafe';
export interface DataTable {
/** Returns the table as a 2-D array. */
raw(): string[][];
/** Returns the table as a 2-D array, without the first row. */
rows(): string[][];
/** Returns an object where each row corresponds to an entry (first column is the key, second column is the value). */
rowsHash(): { [firstCol: string]: string };
/** Returns an array of objects where each row is converted to an object (column header is the key). */
hashes(): Array<{ [colName: string]: string }>;
/** Returns a new instance with the data transposed */
transpose(): DataTable;
}
export type TestHookFunction = (testController: typeof t) => Promise<void>;
export type GlobalHookFunction = (
fixtureContext: { [key: string]: any },
fixtureMeta: Record<string, string>
) => Promise<void>;
export function After(code: TestHookFunction): void;
export function After(options: string, code: TestHookFunction): void;
export function AfterAll(code: GlobalHookFunction): void;
export function Before(code: TestHookFunction): void;
export function Before(options: string, code: TestHookFunction): void;
export function BeforeAll(code: GlobalHookFunction): void;
export type StepFunction = (
testController: typeof t,
parameters: any[],
dataTable: DataTable | null,
docString: string | null
) => Promise<void>;
export function Given(pattern: RegExp | string, code: StepFunction): void;
export function When(pattern: RegExp | string, code: StepFunction): void;
export function Then(pattern: RegExp | string, code: StepFunction): void;
}