-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.d.ts
157 lines (148 loc) · 3.84 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
export * from '@cucumber/cucumber';
import { DataTable, IWorld, When } from '@cucumber/cucumber';
import { IConfiguration, IRunResult } from '@cucumber/cucumber/api';
export const Override: typeof When;
export { Fixture } from 'src/Fixture';
export { Template } from 'src/Template';
export { BeforeExecution, AfterExecution } from 'src/executionHooks.js';
/**
* Validation function
* @example
* expect(actualValue, expectedValue);
* expect.poll(actualValue, expectedValue)
*/
export interface Validation {
/**
* Perform polling validation
* @param {any} actualResult - actual result
* @param {any} expectedResult - expected result
*/
(actualResult: any, expectedResult: any): void;
/**
* @property
* original expression passed to memory value
*/
type: string;
/**
* Perform polling validation
* @param {any} actualResult - actual result
* @param {any} expectedResult - expected result
* @param {number} options.timeout - timeout to poll
* @param {number} options.interval - interval to poll
*/
poll: (AR: any, ER: any, options?: {timeout?: number, interval?: number}) => Promise<unknown>
}
/**
* Memory value
* @example
* memoryValue.value();
* memoryValue.set('some data')
*/
export interface MemoryValue {
/**
* @property
* original expression passed to memory value
*/
expression: string;
/**
* Return resolved value
* @example
* url.value()
* @return Promise<any>
*/
value(): any;
/**
* Set value to memory with provided key
* @param {any} value - value to set
* @example
* url.set('https://qavajs.github.io/')
*/
set(value: any): void;
}
export interface IQavajsWorld extends IWorld {
/**
* Get value from memory
* @param {any} expression - expression to parse
*/
getValue(expression: any): any;
/**
* Save value to memory
* @param {string} key - key to store
* @param {any} value - value to store
*/
setValue(key: string, value: any): void;
/**
* Execute existing step definition
* @param {string} step - cucumber expression to execute
* @param {DataTable | string} extraParam - extra data table or multiline string
*/
executeStep(step: string, extraParam?: DataTable | string): Promise<void>;
/**
* Return validation function by provided type
* @param {string} type - type of validation
*/
validation(type: string): Validation;
/**
* qavajs config
*/
config: any;
}
export interface IQavajsConfig extends Partial<IConfiguration> {
/**
* instance of memory object
*
* default: {}
* @example
* import Memory from './memory/Memory';
*
* export default {
* memory: new Memory()
* }
*/
memory?: Object,
/**
* Cucumber steps timeout
*
* default: 10_000
* @example
* export default {
* defaultTimeout: 20_000
* }
*/
defaultTimeout?: number,
/**
* Qavajs services
*
* default: []
* @example
* export default {
* service: [{
* before() {
* console.log('service started');
* },
* after(result: IRunResult) {
* console.log(result.success);
* }
* }]
* }
*/
service?: Array<{ before?: () => void, after: (result: IRunResult) => void }>,
/**
* Qavajs service timeout
*
* default: []
* @example
* export default {
* service: [{
* before() {
* console.log('service started');
* },
* after(result: IRunResult) {
* console.log(result.success);
* }
* }],
* serviceTimeout: 30_000
* }
*/
serviceTimeout?: number
}