@autometa/runner 0.2.48 → 0.2.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,10 +1,11 @@
1
- import * as _autometa_config from '@autometa/config';
2
- import * as _autometa_cucumber_expressions from '@autometa/cucumber-expressions';
3
1
  import * as _autometa_types from '@autometa/types';
4
- import * as _autometa_gherkin from '@autometa/gherkin';
5
- export { DataTable, HTable, MTable, VTable } from '@autometa/gherkin';
6
2
  import * as _autometa_scopes from '@autometa/scopes';
3
+ import { FeatureScope, TestTimeout, FeatureAction, ScenarioAction, ScenarioScope, SizedTimeout, RuleAction, RuleScope } from '@autometa/scopes';
7
4
  export { Pass, Types } from '@autometa/scopes';
5
+ import * as _autometa_gherkin from '@autometa/gherkin';
6
+ export { DataTable, HTable, MTable, VTable } from '@autometa/gherkin';
7
+ import * as _autometa_config from '@autometa/config';
8
+ import * as _autometa_cucumber_expressions from '@autometa/cucumber-expressions';
8
9
  export * from '@autometa/phrases';
9
10
  import * as _autometa_app from '@autometa/app';
10
11
  export { App, AutometaApp, AutometaWorld, Fixture, World } from '@autometa/app';
@@ -42,126 +43,452 @@ declare const defineConfig: (...args: {
42
43
  };
43
44
  };
44
45
 
46
+ /**
47
+ * Defines a parameter type for use in step definitions.
48
+ *
49
+ * ```ts
50
+ * import { Color } from '../support/color';
51
+ *
52
+ * defineParameterType({
53
+ * name: "color",
54
+ * regexpPattern: /red|blue|yellow/,
55
+ * transform: (value: string) => Color(value)
56
+ * })
57
+ *
58
+ * // using regex arrays
59
+ * defineParameterType({
60
+ * name: "color",
61
+ * regexpPattern: [/red/, /blue/, /yellow/],
62
+ * transform: (value: string) => Color(value)
63
+ * })
64
+ * ```
65
+ */
45
66
  declare const defineParameterType: (...args: _autometa_cucumber_expressions.ParamTypeDefinition[]) => void;
46
67
 
47
- declare const Feature: {
48
- (filepath: string): _autometa_scopes.FeatureScope;
49
- (filepath: string, timeout: number): _autometa_scopes.FeatureScope;
50
- (filepath: string, timeout: _autometa_scopes.TestTimeout): _autometa_scopes.FeatureScope;
51
- (testDefinition: _autometa_scopes.FeatureAction, filepath: string): _autometa_scopes.FeatureScope;
52
- (testDefinition: _autometa_scopes.FeatureAction, filepath: string, timeout: number): _autometa_scopes.FeatureScope;
53
- (testDefinition: _autometa_scopes.FeatureAction, filepath: string, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.FeatureScope;
54
- (...args: (string | _autometa_scopes.TestTimeout | _autometa_scopes.FeatureAction)[]): _autometa_scopes.FeatureScope;
55
- } & {
56
- skip: {
57
- (filepath: string): _autometa_scopes.FeatureScope;
58
- (filepath: string, timeout: number): _autometa_scopes.FeatureScope;
59
- (filepath: string, timeout: _autometa_scopes.TestTimeout): _autometa_scopes.FeatureScope;
60
- (testDefinition: _autometa_scopes.FeatureAction, filepath: string): _autometa_scopes.FeatureScope;
61
- (testDefinition: _autometa_scopes.FeatureAction, filepath: string, timeout: number): _autometa_scopes.FeatureScope;
62
- (testDefinition: _autometa_scopes.FeatureAction, filepath: string, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.FeatureScope;
63
- (...args: (string | _autometa_scopes.TestTimeout | _autometa_scopes.FeatureAction)[]): _autometa_scopes.FeatureScope;
64
- };
65
- only: {
66
- (filepath: string): _autometa_scopes.FeatureScope;
67
- (filepath: string, timeout: number): _autometa_scopes.FeatureScope;
68
- (filepath: string, timeout: _autometa_scopes.TestTimeout): _autometa_scopes.FeatureScope;
69
- (testDefinition: _autometa_scopes.FeatureAction, filepath: string): _autometa_scopes.FeatureScope;
70
- (testDefinition: _autometa_scopes.FeatureAction, filepath: string, timeout: number): _autometa_scopes.FeatureScope;
71
- (testDefinition: _autometa_scopes.FeatureAction, filepath: string, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.FeatureScope;
72
- (...args: (string | _autometa_scopes.TestTimeout | _autometa_scopes.FeatureAction)[]): _autometa_scopes.FeatureScope;
73
- };
74
- };
75
- declare const Scenario: {
76
- (title: string, action: _autometa_scopes.ScenarioAction): _autometa_scopes.ScenarioScope;
77
- (title: string, action: _autometa_scopes.ScenarioAction, timeout: number): _autometa_scopes.ScenarioScope;
78
- (title: string, action: _autometa_scopes.ScenarioAction, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.ScenarioScope;
79
- } & {
80
- skip: {
81
- (title: string, action: _autometa_scopes.ScenarioAction): _autometa_scopes.ScenarioScope;
82
- (title: string, action: _autometa_scopes.ScenarioAction, timeout: number): _autometa_scopes.ScenarioScope;
83
- (title: string, action: _autometa_scopes.ScenarioAction, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.ScenarioScope;
84
- };
85
- only: {
86
- (title: string, action: _autometa_scopes.ScenarioAction): _autometa_scopes.ScenarioScope;
87
- (title: string, action: _autometa_scopes.ScenarioAction, timeout: number): _autometa_scopes.ScenarioScope;
88
- (title: string, action: _autometa_scopes.ScenarioAction, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.ScenarioScope;
89
- };
90
- };
91
- declare const ScenarioOutline: {
92
- (title: string, action: _autometa_scopes.ScenarioAction): _autometa_scopes.ScenarioScope;
93
- (title: string, action: _autometa_scopes.ScenarioAction, timeout: number): _autometa_scopes.ScenarioScope;
94
- (title: string, action: _autometa_scopes.ScenarioAction, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.ScenarioScope;
95
- } & {
96
- skip: {
97
- (title: string, action: _autometa_scopes.ScenarioAction): _autometa_scopes.ScenarioScope;
98
- (title: string, action: _autometa_scopes.ScenarioAction, timeout: number): _autometa_scopes.ScenarioScope;
99
- (title: string, action: _autometa_scopes.ScenarioAction, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.ScenarioScope;
100
- };
101
- only: {
102
- (title: string, action: _autometa_scopes.ScenarioAction): _autometa_scopes.ScenarioScope;
103
- (title: string, action: _autometa_scopes.ScenarioAction, timeout: number): _autometa_scopes.ScenarioScope;
104
- (title: string, action: _autometa_scopes.ScenarioAction, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.ScenarioScope;
105
- };
106
- };
107
- declare const Rule: {
108
- (title: string, action: _autometa_scopes.RuleAction): _autometa_scopes.RuleScope;
109
- (title: string, action: _autometa_scopes.RuleAction, timeout: number): _autometa_scopes.RuleScope;
110
- (title: string, action: _autometa_scopes.RuleAction, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.RuleScope;
111
- } & {
112
- skip: {
113
- (title: string, action: _autometa_scopes.RuleAction): _autometa_scopes.RuleScope;
114
- (title: string, action: _autometa_scopes.RuleAction, timeout: number): _autometa_scopes.RuleScope;
115
- (title: string, action: _autometa_scopes.RuleAction, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.RuleScope;
116
- };
117
- only: {
118
- (title: string, action: _autometa_scopes.RuleAction): _autometa_scopes.RuleScope;
119
- (title: string, action: _autometa_scopes.RuleAction, timeout: number): _autometa_scopes.RuleScope;
120
- (title: string, action: _autometa_scopes.RuleAction, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.RuleScope;
121
- };
122
- };
68
+ declare const AppType: (world: _autometa_types.Class<_autometa_app.AutometaWorld>, environment?: string | undefined) => (target: _autometa_types.Class<unknown>) => void;
69
+
70
+ declare function makeTestEmitter(opts: {
71
+ groupLogger: boolean;
72
+ }): TestEventEmitter;
73
+
74
+ /**
75
+ * Executes a gherkin `.feature` file. Assembles Tests
76
+ * using the Cucumber file and globally defined Step Definitions.
77
+ *
78
+ * ``ts
79
+ * // using relative path
80
+ * import { Feature } from '@autometa/runner'
81
+ *
82
+ * Feature('../features/my-feature.feature')
83
+ * ```
84
+ *
85
+ * Steps will be automatically assembled from Globally defined Step Definitions,
86
+ * if a step definition root and app root are defined.
87
+ *
88
+ * ```ts
89
+ * import { defineConfig } from '@autometa/runner'
90
+ *
91
+ * defineConfig({
92
+ * ...
93
+ * roots: {
94
+ * steps: ['./test/steps'],
95
+ * app: ['./app'],
96
+ * },
97
+ * }
98
+ * ```
99
+ *
100
+ * Global steps are defined in standard Cucumber stle.
101
+ * ```ts
102
+ * // ./test/steps/my-steps.ts
103
+ * import { Given, When, Then } from '@autometa/runner'
104
+ *
105
+ * Given('I have a step', () => {})
106
+ * When('I do something', () => {})
107
+ * Then('I expect something', () => {})
108
+ * ```
109
+ * @param filepath The absolute, relative, or 'feature root' path to the `.feature` file.
110
+ */
111
+ declare function Feature(filepath: string): FeatureScope;
112
+ /**
113
+ * Executes a gherkin `.feature` file. Assembles Tests
114
+ * using the Cucumber file and globally defined Step Definitions.
115
+ * Accepts a timeout in milliseconds which will be applied to
116
+ * all tests within the feature.
117
+ *
118
+ * ```ts
119
+ * // using relative path
120
+ * import { Feature } from '@autometa/runner'
121
+ * // 10 second timeout
122
+ * Feature('../features/my-feature.feature', 10_000)
123
+ * ```
124
+ *
125
+ * Steps will be automatically assembled from Globally defined Step Definitions,
126
+ * if a step definition root and app root are defined.
127
+ *
128
+ * ```ts
129
+ * import { defineConfig } from '@autometa/runner'
130
+ *
131
+ * defineConfig({
132
+ * ...
133
+ * roots: {
134
+ * steps: ['./test/steps'],
135
+ * app: ['./app'],
136
+ * },
137
+ * }
138
+ * ```
139
+ *
140
+ * Global steps are defined in standard Cucumber style.
141
+ *
142
+ * ```ts
143
+ * // ./test/steps/my-steps.ts
144
+ * import { Given, When, Then } from '@autometa/runner'
145
+ *
146
+ * Given('I have a step', () => {})
147
+ * When('I do something', () => {})
148
+ * Then('I expect something', () => {})
149
+ * ```
150
+ * @param filepath The absolute, relative, or 'feature root' path to the `.feature` file.
151
+ * @param timeout The timeout in milliseconds to apply to all tests within the feature.
152
+ */
153
+ declare function Feature(filepath: string, timeout: number): FeatureScope;
154
+ /**
155
+ * Executes a gherkin `.feature` file. Assembles Tests
156
+ * using the Cucumber file and globally defined Step Definitions.
157
+ * Accepts a timeout as a `TestTimeout` which is a tuple of `[durationNumber, 'ms' | 's' | 'm' | 'h']`
158
+ * which will be applied to all tests within the feature.
159
+ *
160
+ * i.e. `[10, 's']` is a 10 second timeout. `[1, 'm']` is a 1 minute timeout.
161
+ *
162
+ * ```ts
163
+ * // using relative path
164
+ * import { Feature } from '@autometa/runner'
165
+ *
166
+ * // 10 second timeout
167
+ * Feature('../features/my-feature.feature', [10, 's'])
168
+ * ```
169
+ *
170
+ * Steps will be automatically assembled from Globally defined Step Definitions,
171
+ * if a step definition root and app root are defined.
172
+ *
173
+ * ```ts
174
+ * import { defineConfig } from '@autometa/runner'
175
+ *
176
+ * defineConfig({
177
+ * ...
178
+ * roots: {
179
+ * steps: ['./test/steps'],
180
+ * app: ['./app'],
181
+ * },
182
+ * };
183
+ *
184
+ * ```
185
+ *
186
+ * @param filepath
187
+ * @param timeout
188
+ */
189
+ declare function Feature(filepath: string, timeout: TestTimeout): FeatureScope;
190
+ /**
191
+ * Executes a gherkin `.feature` file. Assembles Tests
192
+ * using the Cucumber file and optionally locally defined steps,
193
+ * mixed with optionally globally defined Step Definitions.
194
+ *
195
+ * ```ts
196
+ * import { Feature } from '@autometa/runner'
197
+ *
198
+ * Feature('My Feature', () => {
199
+ * Given('I have a step', () => {})
200
+ * When('I do something', () => {})
201
+ * Then('I expect something', () => {})
202
+ * })
203
+ * ```ts
204
+ *
205
+ * If defined in the Gherkin, it will also use any Globally defined Step Definitions which match,
206
+ * if none is defined locally. If a Step Definition is defined both globally and locally,
207
+ * the most local definition will be used. This applies to sub-scopes like Scenarios and Rules
208
+ * also.
209
+ *
210
+ * ```ts
211
+ * import { Feature } from '@autometa/runner'
212
+ *
213
+ * Feature('My Feature', () => {
214
+ * Given('I have a step', () => {})
215
+ * When('I do something', () => {})
216
+ * Then('I expect something', () => {})
217
+ *
218
+ * Scenario('My Scenario', () => {
219
+ * Given('I have a step', () => {})
220
+ * })
221
+ *
222
+ * Rule('My Rule', () => {
223
+ * Given('I have a step', () => {})
224
+ * })
225
+ *
226
+ * @param testDefinition
227
+ * @param filepath
228
+ */
229
+ declare function Feature(testDefinition: FeatureAction, filepath: string): FeatureScope;
230
+ /**
231
+ * Executes a gherkin `.feature` file. Assembles Tests
232
+ * using the Cucumber file and optionally locally defined steps,
233
+ * mixed with optionally globally defined Step Definitions.
234
+ * Accepts a timeout in milliseconds which will be applied to
235
+ * all tests within the feature.
236
+ *
237
+ * ```ts
238
+ * import { Feature } from '@autometa/runner'
239
+ *
240
+ * // 10 second timeout
241
+ * Feature('My Feature', () => {
242
+ * Given('I have a step', () => {})
243
+ * When('I do something', () => {})
244
+ * Then('I expect something', () => {})
245
+ * }, 10_000)
246
+ * ```
247
+ * @param testDefinition the Feature definition callback
248
+ * @param filepath
249
+ * @param timeout
250
+ */
251
+ declare function Feature(testDefinition: FeatureAction, filepath: string, timeout: number): FeatureScope;
252
+ declare function Scenario(title: string, action: ScenarioAction): ScenarioScope;
253
+ declare function Scenario(title: string, action: ScenarioAction, timeout: number): ScenarioScope;
254
+ declare function Scenario(title: string, action: ScenarioAction, timeout: SizedTimeout): ScenarioScope;
255
+ declare function ScenarioOutline(title: string, action: ScenarioAction): ScenarioScope;
256
+ declare function ScenarioOutline(title: string, action: ScenarioAction, timeout: number): ScenarioScope;
257
+ declare function ScenarioOutline(title: string, action: ScenarioAction, timeout: SizedTimeout): ScenarioScope;
258
+ declare function Rule(title: string, action: RuleAction): RuleScope;
259
+ declare function Rule(title: string, action: RuleAction, timeout: number): RuleScope;
260
+ declare function Rule(title: string, action: RuleAction, timeout: SizedTimeout): RuleScope;
261
+ /**
262
+ * Defines a `Given` step definition. Matches a gherkin step
263
+ * as either a string literal match, or a Cucumber Expression.
264
+ *
265
+ * The callback function is passed as it's last (or only) argument
266
+ * a copy of the `App` object which also contains a reference to the World.
267
+ * This can be used to access features, or store data across steps within a test.
268
+ *
269
+ * N.b. The App instance is shared between all step definitions and hooks within
270
+ * the context of a scenario, but cannot be accessed from the same step in a different
271
+ * scenario.
272
+ *
273
+ * ```ts
274
+ * import { Given } from '@autometa/runner'
275
+ *
276
+ * Given('I have a step', (app) => {
277
+ * app.world.someData = 'some value'
278
+ * })
279
+ * // using destructuring
280
+ * Given('I have a step', ({ world }) => {
281
+ * world.someData = 'some value'
282
+ * })
283
+ * ```
284
+ *
285
+ * Steps also support Cucumber Expressions, which can be used to match
286
+ * dynamic values in the step.
287
+ *
288
+ * ```ts
289
+ * import { Given } from '@autometa/runner'
290
+ *
291
+ * // matches 'Given I have a step with a 'blue' value'
292
+ * Given('I have a step with a {string} value', (value, { world }) => {
293
+ * world.someData = value
294
+ * })
295
+ *
296
+ * @param pattern The step pattern to match.
297
+ * @param action The step action to execute.
298
+ */
123
299
  declare const Given: <TText extends string, TTable extends _autometa_gherkin.DataTable = _autometa_gherkin.NeverDataTable>(title: TText, action: _autometa_scopes.StepActionFn<TText, TTable>, tableType?: _autometa_types.Class<TTable> | undefined) => void;
300
+ /**
301
+ * Defines a `When` step definition. Matches a gherkin step
302
+ * as either a string literal match, or a Cucumber Expression.
303
+ *
304
+ * The callback function is passed as it's last (or only) argument
305
+ * a copy of the `App` object which also contains a reference to the World.
306
+ * This can be used to access features, or store data across steps within a test.
307
+ *
308
+ * N.b. The App instance is shared between all step definitions and hooks within
309
+ *
310
+ * ```ts
311
+ * import { When } from '@autometa/runner'
312
+ *
313
+ * When('I do something', async (app) => {
314
+ * await app.webdriver.click('#some-button')
315
+ * })
316
+ *
317
+ * // using destructuring
318
+ * When('I do something', async ({ webdriver }) => {
319
+ * await webdriver.click('#some-button')
320
+ * })
321
+ * ```
322
+ *
323
+ * Steps also support Cucumber Expressions, which can be used to match
324
+ * dynamic values in the step.
325
+ *
326
+ * ```ts
327
+ * import { When } from '@autometa/runner'
328
+ *
329
+ * // matches 'When I do something with a 'blue' value'
330
+ * When('I do something with a {string} value', async (value, { webdriver }) => {
331
+ * await webdriver.click(`#some-button-${value}`)
332
+ * })
333
+ *
334
+ * @param pattern The step pattern to match.
335
+ * @param action The step action to execute.
336
+ */
124
337
  declare const When: <TText_1 extends string, TTable_1 extends _autometa_gherkin.DataTable = _autometa_gherkin.NeverDataTable>(title: TText_1, action: _autometa_scopes.StepActionFn<TText_1, TTable_1>, tableType?: _autometa_types.Class<TTable_1> | undefined) => void;
338
+ /**
339
+ * Defines a `Then` step definition. Matches a gherkin step
340
+ * as either a string literal match, or a Cucumber Expression.
341
+ *
342
+ * The callback function is passed as it's last (or only) argument
343
+ * a copy of the `App` object which also contains a reference to the World.
344
+ * This can be used to access features, or store data across steps within a test.
345
+ *
346
+ * N.b. The App instance is shared between all step definitions and hooks within
347
+ *
348
+ * ```ts
349
+ * import { Then } from '@autometa/runner'
350
+ *
351
+ * Then('I expect something', async (app) => {
352
+ * await app.webdriver.click('#some-button')
353
+ * })
354
+ *
355
+ * // using destructuring
356
+ * Then('I expect something', async ({ webdriver }) => {
357
+ * await webdriver.click('#some-button')
358
+ * })
359
+ * ```
360
+ *
361
+ * Steps also support Cucumber Expressions, which can be used to match
362
+ * dynamic values in the step.
363
+ *
364
+ * ```ts
365
+ * import { Then } from '@autometa/runner'
366
+ *
367
+ * // matches 'Then I expect something with a 'blue' value'
368
+ * Then('I expect something with a {string} value', async (value, { world }) => {
369
+ * expect(world.someData).toBe(value)
370
+ * })
371
+ *
372
+ * @param pattern The step pattern to match.
373
+ * @param action The step action to execute.
374
+ */
125
375
  declare const Then: <TText_2 extends string, TTable_2 extends _autometa_gherkin.DataTable = _autometa_gherkin.NeverDataTable>(title: TText_2, action: _autometa_scopes.StepActionFn<TText_2, TTable_2>, tableType?: _autometa_types.Class<TTable_2> | undefined) => void;
376
+ /**
377
+ * Defines a `Before` hook. Executes before each scenario.
378
+ *
379
+ * ```ts
380
+ * import { Before } from '@autometa/runner'
381
+ *
382
+ * Before(async (app) => {
383
+ * await app.webdriver.click('#some-button')
384
+ * })
385
+ *
386
+ * // using destructuring
387
+ * Before(async ({ webdriver }) => {
388
+ * await webdriver.click('#some-button')
389
+ * })
390
+ * ```
391
+ *
392
+ * @param action The hook action to execute.
393
+ */
126
394
  declare const Before: {
127
395
  (description: string, action: _autometa_scopes.HookAction): _autometa_scopes.BeforeHook;
128
396
  (description: string, action: _autometa_scopes.HookAction, timeout: number): _autometa_scopes.BeforeHook;
129
397
  (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string): _autometa_scopes.BeforeHook;
130
398
  (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string, timeout: number): _autometa_scopes.BeforeHook;
131
- (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.BeforeHook;
132
- (description: string, action: _autometa_scopes.HookAction, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.BeforeHook;
133
- (description: string, action: _autometa_scopes.HookAction, exprOrTimeout?: string | _autometa_scopes.TestTimeout | undefined, timeout?: _autometa_scopes.TestTimeout | undefined): _autometa_scopes.BeforeHook;
399
+ (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string, timeout: SizedTimeout): _autometa_scopes.BeforeHook;
400
+ (description: string, action: _autometa_scopes.HookAction, timeout: SizedTimeout): _autometa_scopes.BeforeHook;
401
+ (description: string, action: _autometa_scopes.HookAction, exprOrTimeout?: string | TestTimeout | undefined, timeout?: TestTimeout | undefined): _autometa_scopes.BeforeHook;
134
402
  };
403
+ /**
404
+ * Defines a `After` hook. Executes after each scenario.
405
+ *
406
+ * ```ts
407
+ * import { After } from '@autometa/runner'
408
+ *
409
+ * After(async (app) => {
410
+ * await app.webdriver.click('#some-button')
411
+ * })
412
+ *
413
+ * // using destructuring
414
+ * After(async ({ webdriver }) => {
415
+ * await webdriver.click('#some-button')
416
+ * })
417
+ * ```
418
+ *
419
+ * @param action The hook action to execute.
420
+ */
135
421
  declare const After: {
136
422
  (description: string, action: _autometa_scopes.HookAction): _autometa_scopes.AfterHook;
137
423
  (description: string, action: _autometa_scopes.HookAction, timeout: number): _autometa_scopes.AfterHook;
138
424
  (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string): _autometa_scopes.AfterHook;
139
425
  (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string, timeout: number): _autometa_scopes.AfterHook;
140
- (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.AfterHook;
141
- (description: string, action: _autometa_scopes.HookAction, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.AfterHook;
142
- (description: string, action: _autometa_scopes.HookAction, exprOrTimeout?: string | _autometa_scopes.TestTimeout | undefined, timeout?: _autometa_scopes.TestTimeout | undefined): _autometa_scopes.AfterHook;
426
+ (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string, timeout: SizedTimeout): _autometa_scopes.AfterHook;
427
+ (description: string, action: _autometa_scopes.HookAction, timeout: SizedTimeout): _autometa_scopes.AfterHook;
428
+ (description: string, action: _autometa_scopes.HookAction, exprOrTimeout?: string | TestTimeout | undefined, timeout?: TestTimeout | undefined): _autometa_scopes.AfterHook;
143
429
  };
430
+ /**
431
+ * Defines a `Setup` hook. Executes before all scenarios.
432
+ * Setups are scoped, meaning a Setup defined inside the scope of a rule
433
+ * will only apply to scenarios within that rule.
434
+ *
435
+ * N.b the Setup Hook and Teardown Hook reference their own unique
436
+ * copy of the App with it's own unique life cycle. Values stored here
437
+ * will not be accessible in tests without a singleton fixture.
438
+ *
439
+ * ```ts
440
+ * import { Setup } from '@autometa/runner'
441
+ *
442
+ * Setup(async (app) => {
443
+ * await app.webdriver.click('#some-button')
444
+ * })
445
+ *
446
+ * // using destructuring
447
+ * Setup(async ({ webdriver }) => {
448
+ * await webdriver.click('#some-button')
449
+ * })
450
+ * ```
451
+ *
452
+ * @param action The hook action to execute.
453
+ */
144
454
  declare const Teardown: {
145
455
  (description: string, action: _autometa_scopes.HookAction): _autometa_scopes.TeardownHook;
146
456
  (description: string, action: _autometa_scopes.HookAction, timeout: number): _autometa_scopes.TeardownHook;
147
457
  (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string): _autometa_scopes.TeardownHook;
148
458
  (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string, timeout: number): _autometa_scopes.TeardownHook;
149
- (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.TeardownHook;
150
- (description: string, action: _autometa_scopes.HookAction, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.TeardownHook;
459
+ (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string, timeout: SizedTimeout): _autometa_scopes.TeardownHook;
460
+ (description: string, action: _autometa_scopes.HookAction, timeout: SizedTimeout): _autometa_scopes.TeardownHook;
151
461
  };
462
+ /**
463
+ * Defines a `Teardown` hook. Executes after all scenarios have completed.
464
+ * Teardowns are scoped, meaning a Teardown defined inside the scope of a rule
465
+ * will only apply to scenarios within that rule.
466
+ *
467
+ * N.b the Setup Hook and Teardown Hook reference their own unique
468
+ * copy of the App with it's own unique life cycle. Values stored here
469
+ * will not be accessible in tests without a singleston fixture.
470
+ * ```ts
471
+ * import { Teardown } from '@autometa/runner'
472
+ *
473
+ * Teardown(async (app) => {
474
+ * await app.webdriver.click('#some-button')
475
+ * })
476
+ *
477
+ * // using destructuring
478
+ * Teardown(async ({ webdriver }) => {
479
+ * await webdriver.click('#some-button')
480
+ * })
481
+ * ```
482
+ *
483
+ * @param action The hook action to execute.
484
+ */
152
485
  declare const Setup: {
153
486
  (description: string, action: _autometa_scopes.HookAction): _autometa_scopes.SetupHook;
154
487
  (description: string, action: _autometa_scopes.HookAction, timeout: number): _autometa_scopes.SetupHook;
155
488
  (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string): _autometa_scopes.SetupHook;
156
489
  (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string, timeout: number): _autometa_scopes.SetupHook;
157
- (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.SetupHook;
158
- (description: string, action: _autometa_scopes.HookAction, timeout: _autometa_scopes.SizedTimeout): _autometa_scopes.SetupHook;
490
+ (description: string, action: _autometa_scopes.HookAction, tagFilterExpression: string, timeout: SizedTimeout): _autometa_scopes.SetupHook;
491
+ (description: string, action: _autometa_scopes.HookAction, timeout: SizedTimeout): _autometa_scopes.SetupHook;
159
492
  };
160
493
 
161
- declare const AppType: (world: _autometa_types.Class<_autometa_app.AutometaWorld>, environment?: string | undefined) => (target: _autometa_types.Class<unknown>) => void;
162
-
163
- declare function makeTestEmitter(opts: {
164
- groupLogger: boolean;
165
- }): TestEventEmitter;
166
-
167
494
  export { After, AppType, Before, Feature, Given, Rule, Scenario, ScenarioOutline, Setup, Teardown, Then, When, defineConfig, defineParameterType, makeTestEmitter };