@wdio/allure-reporter 8.4.0 → 8.6.6

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/README.md CHANGED
@@ -58,7 +58,14 @@ export const config = {
58
58
  * `addFeature(featureName)` – assign features to test
59
59
  * `addStory(storyName)` – assign user story to test
60
60
  * `addSeverity(value)` – assign severity to test, accepts one of these values: blocker, critical, normal, minor, trivial
61
+ * `addTag(value)` – assign a tag label to test
62
+ * `addEpic(value)` – assign an epic label to test
63
+ * `addOwner(value)` – assign an owner label to test
64
+ * `addSuite(value)` – assign a suite label to test
65
+ * `addSubSuite(value)` – assign a sub suite label to test
66
+ * `addParentSuite(value)` – assign a parent suite label to test
61
67
  * `addIssue(value)` – assign issue id to test
68
+ * `addAllureId(value)` – assign allure test ops id label to test
62
69
  * `addTestId(value)` – assign TMS test id to test
63
70
  * `addEnvironment(name, value)` – save environment value
64
71
  * `addAttachment(name, content, [type])` – save attachment to test.
@@ -78,6 +85,8 @@ export const config = {
78
85
  * `title` (*String*) - name of the step.
79
86
  * `endStep(status)` - end with a step
80
87
  * `status` (*String*, optional) - step status, `passed` by default. Must be "failed", "passed" or "broken"
88
+ * `step(name, body)` - starts step with content function inside. Allows to create steps with infinite hierarchy
89
+ * `body` (*Function*) - the step body async function
81
90
 
82
91
  ### Usage
83
92
  Allure Api can be accessed using:
@@ -115,6 +124,20 @@ Given('I include feature and story name', () => {
115
124
  })
116
125
  ```
117
126
 
127
+ #### Custom steps
128
+
129
+ `step` method simplifies dealing with steps because each step present as an async function with any content inside.
130
+ The first argument of the function is the current step, that has most of the allure API methods (such as `label`, `epic`, `attach` etc):
131
+
132
+ ```js
133
+ allureReporter.step('my step name', async (s1) => {
134
+ s1.label('foo', 'bar')
135
+ await s1.step('my child step name', async (s2) => {
136
+ // you can add any combination of steps in the body function
137
+ })
138
+ })
139
+ ```
140
+
118
141
  ##### Cucumber Tags
119
142
 
120
143
  Cucumber tags with special names (`issue` and `testId`) are converted to the links (the corresponding link templates must be configured before):
@@ -1,11 +1,6 @@
1
1
  /// <reference types="node" />
2
- import type { Status } from '../types.js';
3
- /**
4
- * Assign feature to test
5
- * @name addFeature
6
- * @param {(string)} featureName - feature name or an array of names
7
- */
8
- export declare function addFeature(featureName: string): void;
2
+ import type { StepBodyFunction } from 'allure-js-commons';
3
+ import { Status } from 'allure-js-commons';
9
4
  /**
10
5
  * Assign label to test
11
6
  * @name addLabel
@@ -13,6 +8,26 @@ export declare function addFeature(featureName: string): void;
13
8
  * @param {string} value - label value
14
9
  */
15
10
  export declare function addLabel(name: string, value: string): void;
11
+ /**
12
+ * Assign link to test
13
+ * @name addLink
14
+ * @param {string} url - link name
15
+ * @param {string} [name] - link name
16
+ * @param {string} [type] - link type
17
+ */
18
+ export declare function addLink(url: string, name?: string, type?: string): void;
19
+ /**
20
+ * Assign allure id label to test to link test to existing entity inside the test ops
21
+ * @name addAllureId
22
+ * @param {string} id - inner allure test ops id
23
+ */
24
+ export declare function addAllureId(id: string): void;
25
+ /**
26
+ * Assign feature to test
27
+ * @name addFeature
28
+ * @param {(string)} featureName - feature name or an array of names
29
+ */
30
+ export declare function addFeature(featureName: string): void;
16
31
  /**
17
32
  * Assign severity to test
18
33
  * @name addSeverity
@@ -32,11 +47,47 @@ export declare function addIssue(issue: string): void;
32
47
  */
33
48
  export declare function addTestId(testId: string): void;
34
49
  /**
35
- * Assign story to test
50
+ * Assign story label to test
36
51
  * @name addStory
37
52
  * @param {string} storyName - story name for test
38
53
  */
39
54
  export declare function addStory(storyName: string): void;
55
+ /**
56
+ * Assign suite label to test
57
+ * @name addSuite
58
+ * @param {string} suiteName - story name for test
59
+ */
60
+ export declare function addSuite(suiteName: string): void;
61
+ /**
62
+ * Assign parent suite label to test
63
+ * @name addParentSuite
64
+ * @param {string} suiteName - suite name
65
+ */
66
+ export declare function addParentSuite(suiteName: string): void;
67
+ /**
68
+ * Assign sub-suite label to test
69
+ * @name addSubSuite
70
+ * @param {string} suiteName - sub-suite name
71
+ */
72
+ export declare function addSubSuite(suiteName: string): void;
73
+ /**
74
+ * Assign epic label to test
75
+ * @name addEpic
76
+ * @param {string} epicName - the epic name
77
+ */
78
+ export declare function addEpic(epicName: string): void;
79
+ /**
80
+ * Assign owner label to test
81
+ * @name addOwner
82
+ * @param {string} owner - the owner name
83
+ */
84
+ export declare function addOwner(owner: string): void;
85
+ /**
86
+ * Assign tag label to test
87
+ * @name addTag
88
+ * @param {string} tag - the tag name
89
+ */
90
+ export declare function addTag(tag: string): void;
40
91
  /**
41
92
  * Add environment value
42
93
  * @name addEnvironment
@@ -89,8 +140,16 @@ export declare function addStep(title: string, { content, name, type }?: any, st
89
140
  * @param {string} value - argument value
90
141
  */
91
142
  export declare function addArgument(name: string, value: string): void;
143
+ /**
144
+ * Starts allure step execution with any content
145
+ * Can be used to generate any hierarchy of steps
146
+ * @param {string} name - the step name
147
+ * @param {StepBodyFunction} body - the step content function
148
+ */
149
+ export declare function step(name: string, body: StepBodyFunction): Promise<void>;
92
150
  declare const _default: {
93
151
  addFeature: typeof addFeature;
152
+ addAllureId: typeof addAllureId;
94
153
  addLabel: typeof addLabel;
95
154
  addSeverity: typeof addSeverity;
96
155
  addIssue: typeof addIssue;
@@ -103,6 +162,7 @@ declare const _default: {
103
162
  endStep: typeof endStep;
104
163
  addStep: typeof addStep;
105
164
  addArgument: typeof addArgument;
165
+ step: typeof step;
106
166
  };
107
167
  export default _default;
108
168
  //# sourceMappingURL=api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/common/api.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAYzC;;;;GAIG;AACH,wBAAgB,UAAU,CAAE,WAAW,EAAE,MAAM,QAE9C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAEpD;AACD;;;;GAIG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AE,MAAM,QAK3F;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAE,KAAK,EAAE,MAAM,QAEvC;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAE,MAAM,GAAE,MAAsB,QAKtD;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CACnB,KAAK,EAAE,MAAM,EACb,EACI,OAAO,EACP,IAAmB,EACnB,IAAmB,EACtB,GAAE,GAAQ,EACX,MAAM,GAAE,MAAsB,QAQjC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAEvD;AAED;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,iBAK9D;;;;;;;;;;;;;;;;;;AAED,wBAGC"}
@@ -1,4 +1,5 @@
1
- import { events, stepStatuses } from '../constants.js';
1
+ import { Status, AllureCommandStepExecutable } from 'allure-js-commons';
2
+ import { events } from '../constants.js';
2
3
  /**
3
4
  * Call reporter
4
5
  * @param {string} event - event name
@@ -8,14 +9,6 @@ import { events, stepStatuses } from '../constants.js';
8
9
  const tellReporter = (event, msg = {}) => {
9
10
  process.emit(event, msg);
10
11
  };
11
- /**
12
- * Assign feature to test
13
- * @name addFeature
14
- * @param {(string)} featureName - feature name or an array of names
15
- */
16
- export function addFeature(featureName) {
17
- tellReporter(events.addFeature, { featureName });
18
- }
19
12
  /**
20
13
  * Assign label to test
21
14
  * @name addLabel
@@ -25,6 +18,32 @@ export function addFeature(featureName) {
25
18
  export function addLabel(name, value) {
26
19
  tellReporter(events.addLabel, { name, value });
27
20
  }
21
+ /**
22
+ * Assign link to test
23
+ * @name addLink
24
+ * @param {string} url - link name
25
+ * @param {string} [name] - link name
26
+ * @param {string} [type] - link type
27
+ */
28
+ export function addLink(url, name, type) {
29
+ tellReporter(events.addLink, { url, name, type });
30
+ }
31
+ /**
32
+ * Assign allure id label to test to link test to existing entity inside the test ops
33
+ * @name addAllureId
34
+ * @param {string} id - inner allure test ops id
35
+ */
36
+ export function addAllureId(id) {
37
+ tellReporter(events.addAllureId, { id });
38
+ }
39
+ /**
40
+ * Assign feature to test
41
+ * @name addFeature
42
+ * @param {(string)} featureName - feature name or an array of names
43
+ */
44
+ export function addFeature(featureName) {
45
+ tellReporter(events.addFeature, { featureName });
46
+ }
28
47
  /**
29
48
  * Assign severity to test
30
49
  * @name addSeverity
@@ -50,13 +69,61 @@ export function addTestId(testId) {
50
69
  tellReporter(events.addTestId, { testId });
51
70
  }
52
71
  /**
53
- * Assign story to test
72
+ * Assign story label to test
54
73
  * @name addStory
55
74
  * @param {string} storyName - story name for test
56
75
  */
57
76
  export function addStory(storyName) {
58
77
  tellReporter(events.addStory, { storyName });
59
78
  }
79
+ /**
80
+ * Assign suite label to test
81
+ * @name addSuite
82
+ * @param {string} suiteName - story name for test
83
+ */
84
+ export function addSuite(suiteName) {
85
+ tellReporter(events.addSuite, { suiteName });
86
+ }
87
+ /**
88
+ * Assign parent suite label to test
89
+ * @name addParentSuite
90
+ * @param {string} suiteName - suite name
91
+ */
92
+ export function addParentSuite(suiteName) {
93
+ tellReporter(events.addParentSuite, { suiteName });
94
+ }
95
+ /**
96
+ * Assign sub-suite label to test
97
+ * @name addSubSuite
98
+ * @param {string} suiteName - sub-suite name
99
+ */
100
+ export function addSubSuite(suiteName) {
101
+ tellReporter(events.addSubSuite, { suiteName });
102
+ }
103
+ /**
104
+ * Assign epic label to test
105
+ * @name addEpic
106
+ * @param {string} epicName - the epic name
107
+ */
108
+ export function addEpic(epicName) {
109
+ tellReporter(events.addEpic, { epicName });
110
+ }
111
+ /**
112
+ * Assign owner label to test
113
+ * @name addOwner
114
+ * @param {string} owner - the owner name
115
+ */
116
+ export function addOwner(owner) {
117
+ tellReporter(events.addOwner, { owner });
118
+ }
119
+ /**
120
+ * Assign tag label to test
121
+ * @name addTag
122
+ * @param {string} tag - the tag name
123
+ */
124
+ export function addTag(tag) {
125
+ tellReporter(events.addTag, { tag });
126
+ }
60
127
  /**
61
128
  * Add environment value
62
129
  * @name addEnvironment
@@ -101,9 +168,9 @@ export function startStep(title) {
101
168
  * @name endStep
102
169
  * @param {StepStatus} [status='passed'] - step status
103
170
  */
104
- export function endStep(status = 'passed') {
105
- if (!Object.values(stepStatuses).includes(status)) {
106
- throw new Error(`Step status must be ${Object.values(stepStatuses).join(' or ')}. You tried to set "${status}"`);
171
+ export function endStep(status = Status.PASSED) {
172
+ if (!Object.values(Status).includes(status)) {
173
+ throw new Error(`Step status must be ${Object.values(Status).join(' or ')}. You tried to set "${status}"`);
107
174
  }
108
175
  tellReporter(events.endStep, status);
109
176
  }
@@ -117,9 +184,9 @@ export function endStep(status = 'passed') {
117
184
  * @param {string} [attachmentObject.type='text/plain'] - attachment type
118
185
  * @param {string} [status='passed'] - step status
119
186
  */
120
- export function addStep(title, { content, name = 'attachment', type = 'text/plain' } = {}, status = 'passed') {
121
- if (!Object.values(stepStatuses).includes(status)) {
122
- throw new Error(`Step status must be ${Object.values(stepStatuses).join(' or ')}. You tried to set "${status}"`);
187
+ export function addStep(title, { content, name = 'attachment', type = 'text/plain' } = {}, status = Status.PASSED) {
188
+ if (!Object.values(Status).includes(status)) {
189
+ throw new Error(`Step status must be ${Object.values(Status).join(' or ')}. You tried to set "${status}"`);
123
190
  }
124
191
  const step = content ? { title, attachment: { content, name, type }, status } : { title, status };
125
192
  tellReporter(events.addStep, { step });
@@ -133,7 +200,18 @@ export function addStep(title, { content, name = 'attachment', type = 'text/plai
133
200
  export function addArgument(name, value) {
134
201
  tellReporter(events.addArgument, { name, value });
135
202
  }
203
+ /**
204
+ * Starts allure step execution with any content
205
+ * Can be used to generate any hierarchy of steps
206
+ * @param {string} name - the step name
207
+ * @param {StepBodyFunction} body - the step content function
208
+ */
209
+ export async function step(name, body) {
210
+ const runningStep = new AllureCommandStepExecutable(name);
211
+ const result = await runningStep.start(body);
212
+ tellReporter(events.addAllureStep, result);
213
+ }
136
214
  export default {
137
- addFeature, addLabel, addSeverity, addIssue, addTestId, addStory, addEnvironment,
138
- addDescription, addAttachment, startStep, endStep, addStep, addArgument
215
+ addFeature, addAllureId, addLabel, addSeverity, addIssue, addTestId, addStory, addEnvironment,
216
+ addDescription, addAttachment, startStep, endStep, addStep, addArgument, step,
139
217
  };
@@ -1,18 +1,17 @@
1
- import type { Status } from './types.js';
2
- export declare const PASSED = "passed";
3
- export declare const FAILED = "failed";
4
- export declare const BROKEN = "broken";
5
- export declare const PENDING = "pending";
6
- export declare const CANCELED = "canceled";
7
- export declare const SKIPPED = "skipped";
8
- export declare const testStatuses: Record<string, Status>;
9
- export declare const stepStatuses: Record<string, Status>;
10
1
  export declare const events: {
11
2
  readonly addLabel: "allure:addLabel";
3
+ readonly addLink: "allure:addLink";
12
4
  readonly addFeature: "allure:addFeature";
13
5
  readonly addStory: "allure:addStory";
6
+ readonly addEpic: "allure:addEpic";
7
+ readonly addSuite: "allure:addSuite";
8
+ readonly addSubSuite: "allure:addSubSuite";
9
+ readonly addParentSuite: "allure:addParentSuite";
10
+ readonly addOwner: "allure:addOwner";
14
11
  readonly addSeverity: "allure:addSeverity";
12
+ readonly addTag: "allure:addTag";
15
13
  readonly addIssue: "allure:addIssue";
14
+ readonly addAllureId: "allure:addAllureId";
16
15
  readonly addTestId: "allure:addTestId";
17
16
  readonly addEnvironment: "allure:addEnvironment";
18
17
  readonly addDescription: "allure:addDescription";
@@ -21,6 +20,7 @@ export declare const events: {
21
20
  readonly endStep: "allure:endStep";
22
21
  readonly addStep: "allure:addStep";
23
22
  readonly addArgument: "allure:addArgument";
23
+ readonly addAllureStep: "allure:addAllureStep";
24
24
  };
25
25
  export declare const mochaEachHooks: readonly ["\"before each\" hook", "\"after each\" hook"];
26
26
  export declare const mochaAllHooks: readonly ["\"before all\" hook", "\"after all\" hook"];
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,eAAO,MAAM,MAAM,WAAW,CAAA;AAC9B,eAAO,MAAM,MAAM,WAAW,CAAA;AAC9B,eAAO,MAAM,MAAM,WAAW,CAAA;AAC9B,eAAO,MAAM,OAAO,YAAY,CAAA;AAChC,eAAO,MAAM,QAAQ,aAAa,CAAA;AAClC,eAAO,MAAM,OAAO,YAAY,CAAA;AAEhC,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKtC,CAAA;AACV,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMtC,CAAA;AAEV,eAAO,MAAM,MAAM;;;;;;;;;;;;;;CAcT,CAAA;AAEV,eAAO,MAAM,cAAc,0DAAuD,CAAA;AAClF,eAAO,MAAM,aAAa,wDAAqD,CAAA;AAC/E,eAAO,MAAM,eAAe,OAAO,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;CAuBT,CAAA;AAEV,eAAO,MAAM,cAAc,0DAAuD,CAAA;AAClF,eAAO,MAAM,aAAa,wDAAqD,CAAA;AAC/E,eAAO,MAAM,eAAe,OAAO,CAAA"}
@@ -1,28 +1,17 @@
1
- export const PASSED = 'passed';
2
- export const FAILED = 'failed';
3
- export const BROKEN = 'broken';
4
- export const PENDING = 'pending';
5
- export const CANCELED = 'canceled';
6
- export const SKIPPED = 'skipped';
7
- export const testStatuses = {
8
- PASSED,
9
- FAILED,
10
- BROKEN,
11
- PENDING
12
- };
13
- export const stepStatuses = {
14
- PASSED,
15
- FAILED,
16
- BROKEN,
17
- CANCELED,
18
- SKIPPED
19
- };
20
1
  export const events = {
21
2
  addLabel: 'allure:addLabel',
3
+ addLink: 'allure:addLink',
22
4
  addFeature: 'allure:addFeature',
23
5
  addStory: 'allure:addStory',
6
+ addEpic: 'allure:addEpic',
7
+ addSuite: 'allure:addSuite',
8
+ addSubSuite: 'allure:addSubSuite',
9
+ addParentSuite: 'allure:addParentSuite',
10
+ addOwner: 'allure:addOwner',
24
11
  addSeverity: 'allure:addSeverity',
12
+ addTag: 'allure:addTag',
25
13
  addIssue: 'allure:addIssue',
14
+ addAllureId: 'allure:addAllureId',
26
15
  addTestId: 'allure:addTestId',
27
16
  addEnvironment: 'allure:addEnvironment',
28
17
  addDescription: 'allure:addDescription',
@@ -30,7 +19,8 @@ export const events = {
30
19
  startStep: 'allure:startStep',
31
20
  endStep: 'allure:endStep',
32
21
  addStep: 'allure:addStep',
33
- addArgument: 'allure:addArgument'
22
+ addArgument: 'allure:addArgument',
23
+ addAllureStep: 'allure:addAllureStep'
34
24
  };
35
25
  export const mochaEachHooks = ['"before each" hook', '"after each" hook'];
36
26
  export const mochaAllHooks = ['"before all" hook', '"after all" hook'];
@@ -1,62 +1,82 @@
1
- import type { SuiteStats, HookStats, RunnerStats, TestStats, BeforeCommandArgs, AfterCommandArgs, CommandArgs } from '@wdio/reporter';
1
+ /// <reference types="node" />
2
+ import type { SuiteStats, HookStats, RunnerStats, TestStats, BeforeCommandArgs, AfterCommandArgs } from '@wdio/reporter';
2
3
  import WDIOReporter from '@wdio/reporter';
3
- import { addFeature, addLabel, addSeverity, addIssue, addTestId, addStory, addEnvironment, addDescription, addAttachment, startStep, endStep, addStep, addArgument } from './common/api.js';
4
- import type { AddAttachmentEventArgs, AddDescriptionEventArgs, AddEnvironmentEventArgs, AddFeatureEventArgs, AddIssueEventArgs, AddLabelEventArgs, AddSeverityEventArgs, AddStoryEventArgs, AddTestIdEventArgs, Status, AllureReporterOptions } from './types.js';
4
+ import type { MetadataMessage, AllureStep } from 'allure-js-commons';
5
+ import { AllureGroup, AllureTest, Status as AllureStatus, ContentType } from 'allure-js-commons';
6
+ import { addFeature, addLink, addOwner, addEpic, addSuite, addSubSuite, addParentSuite, addTag, addLabel, addSeverity, addIssue, addTestId, addStory, addEnvironment, addAllureId, addDescription, addAttachment, startStep, endStep, addStep, addArgument, step } from './common/api.js';
7
+ import { AllureReporterState } from './state.js';
8
+ import type { AddAttachmentEventArgs, AddDescriptionEventArgs, AddEnvironmentEventArgs, AddFeatureEventArgs, AddIssueEventArgs, AddLabelEventArgs, AddSeverityEventArgs, AddEpicEventArgs, AddOwnerEventArgs, AddParentSuiteEventArgs, AddSubSuiteEventArgs, AddLinkEventArgs, AddAllureIdEventArgs, AddSuiteEventArgs, AddTagEventArgs, AddStoryEventArgs, AddTestIdEventArgs, AllureReporterOptions } from './types.js';
5
9
  export default class AllureReporter extends WDIOReporter {
6
10
  private _allure;
7
11
  private _capabilities;
8
12
  private _isMultiremote?;
9
13
  private _config?;
10
- private _lastScreenshot?;
11
14
  private _options;
12
15
  private _consoleOutput;
13
16
  private _originalStdoutWrite;
14
- private _addConsoleLogs;
15
- private _startedFeatures;
17
+ _state: AllureReporterState;
18
+ _runningUnits: Array<AllureGroup | AllureTest | AllureStep>;
16
19
  constructor(options?: AllureReporterOptions);
20
+ attachLogs(): void;
21
+ attachFile(name: string, content: string | Buffer, contentType: ContentType): void;
22
+ attachJSON(name: string, json: any): void;
23
+ attachScreenshot(name: string, content: Buffer): void;
24
+ _startSuite(suiteTitle: string): void;
25
+ _endSuite(): void;
26
+ _startTest(testTitle: string, cid?: string): void;
27
+ _skipTest(): void;
28
+ _endTest(status: AllureStatus, error?: Error): void;
29
+ _startStep(testTitle: string): void;
30
+ setTestParameters(cid?: string): void;
17
31
  registerListeners(): void;
18
32
  onRunnerStart(runner: RunnerStats): void;
19
33
  onSuiteStart(suite: SuiteStats): void;
20
- onSuiteEnd(suite: SuiteStats): any;
34
+ onSuiteEnd(suite: SuiteStats): void;
21
35
  onTestStart(test: TestStats | HookStats): void;
22
- setCaseParameters(cid: string | undefined, parentUid: string | undefined, addFeatureLabel?: boolean): void;
23
- getParentSuite(uid?: string): SuiteStats | undefined;
24
- getLabels({ tags }: SuiteStats): {
25
- name: string;
26
- value: string;
27
- }[];
28
- onTestPass(): any;
36
+ onTestPass(): void;
29
37
  onTestFail(test: TestStats | HookStats): void;
30
38
  onTestSkip(test: TestStats): void;
31
39
  onBeforeCommand(command: BeforeCommandArgs): void;
32
40
  onAfterCommand(command: AfterCommandArgs): void;
33
- onHookStart(hook: HookStats): false | undefined;
34
- onHookEnd(hook: HookStats): false | undefined;
35
- addLabel({ name, value }: AddLabelEventArgs): false | undefined;
36
- addStory({ storyName }: AddStoryEventArgs): false | undefined;
37
- addFeature({ featureName }: AddFeatureEventArgs): false | undefined;
38
- addSeverity({ severity }: AddSeverityEventArgs): false | undefined;
39
- addIssue({ issue }: AddIssueEventArgs): false | undefined;
40
- addTestId({ testId }: AddTestIdEventArgs): false | undefined;
41
- addEnvironment({ name, value }: AddEnvironmentEventArgs): false | undefined;
42
- addDescription({ description, descriptionType }: AddDescriptionEventArgs): false | undefined;
43
- addAttachment({ name, content, type }: AddAttachmentEventArgs): false | undefined;
44
- startStep(title: string): false | undefined;
45
- endStep(status: Status): false | undefined;
46
- addStep({ step }: any): false | undefined;
47
- addArgument({ name, value }: any): false | undefined;
48
- isAnyTestRunning(): any;
49
- isScreenshotCommand(command: CommandArgs): boolean;
50
- dumpJSON(name: string, json: object): void;
51
- attachScreenshot(): void;
41
+ onHookStart(hook: HookStats): void;
42
+ onHookEnd(hook: HookStats): void;
43
+ addLabel({ name, value }: AddLabelEventArgs): void;
44
+ addLink({ name, url, type, }: AddLinkEventArgs): void;
45
+ addAllureId({ id, }: AddAllureIdEventArgs): void;
46
+ addStory({ storyName }: AddStoryEventArgs): void;
47
+ addFeature({ featureName }: AddFeatureEventArgs): void;
48
+ addSeverity({ severity }: AddSeverityEventArgs): void;
49
+ addEpic({ epicName, }: AddEpicEventArgs): void;
50
+ addOwner({ owner, }: AddOwnerEventArgs): void;
51
+ addSuite({ suiteName, }: AddSuiteEventArgs): void;
52
+ addParentSuite({ suiteName, }: AddParentSuiteEventArgs): void;
53
+ addSubSuite({ suiteName, }: AddSubSuiteEventArgs): void;
54
+ addTag({ tag, }: AddTagEventArgs): void;
55
+ addTestId({ testId, linkName, }: AddTestIdEventArgs): void;
56
+ addIssue({ issue, linkName, }: AddIssueEventArgs): void;
57
+ addEnvironment({ name, value }: AddEnvironmentEventArgs): void;
58
+ addDescription({ description, descriptionType }: AddDescriptionEventArgs): void;
59
+ addAttachment({ name, content, type }: AddAttachmentEventArgs): void;
60
+ startStep(title: string): void;
61
+ endStep(status: AllureStatus): void;
62
+ addStep({ step }: any): void;
63
+ addArgument({ name, value }: any): void;
64
+ addAllureStep(metadata: MetadataMessage): void;
52
65
  /**
53
66
  * public API attached to the reporter
54
67
  * deprecated approach and only here for backwards compatibility
55
68
  */
56
69
  static addFeature: typeof addFeature;
70
+ static addLink: typeof addLink;
71
+ static addEpic: typeof addEpic;
72
+ static addOwner: typeof addOwner;
73
+ static addTag: typeof addTag;
57
74
  static addLabel: typeof addLabel;
58
75
  static addSeverity: typeof addSeverity;
59
76
  static addIssue: typeof addIssue;
77
+ static addSuite: typeof addSuite;
78
+ static addSubSuite: typeof addSubSuite;
79
+ static addParentSuite: typeof addParentSuite;
60
80
  static addTestId: typeof addTestId;
61
81
  static addStory: typeof addStory;
62
82
  static addEnvironment: typeof addEnvironment;
@@ -66,5 +86,7 @@ export default class AllureReporter extends WDIOReporter {
66
86
  static endStep: typeof endStep;
67
87
  static addStep: typeof addStep;
68
88
  static addArgument: typeof addArgument;
89
+ static addAllureId: typeof addAllureId;
90
+ static step: typeof step;
69
91
  }
70
92
  //# sourceMappingURL=reporter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,UAAU,EAAO,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EACrE,gBAAgB,EAAE,WAAW,EAChC,MAAM,gBAAgB,CAAA;AACvB,OAAO,YAAY,MAAM,gBAAgB,CAA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