Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1f67a91

Browse filesBrowse files
authored
links patterns api (via #968)
1 parent 12b0001 commit 1f67a91
Copy full SHA for 1f67a91

File tree

Expand file treeCollapse file tree

5 files changed

+325
-86
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+325
-86
lines changed

‎packages/allure-codeceptjs/README.md

Copy file name to clipboardExpand all lines: packages/allure-codeceptjs/README.md
+63-3Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ npm i -D allure-js-commons allure-codeceptjs
2323
Add the allure plugin inside you plugins section of your CodeceptJS config file.
2424
For instance the config file is `codecept.config.(js|ts)` then:
2525

26-
```
26+
```js
27+
module.exports.config = {
2728
plugins: {
28-
...
29+
// ...
2930
allure: {
3031
enabled: true,
3132
require: "allure-codeceptjs",
3233
},
33-
...
34+
// ...
3435
}
3536
};
3637
```
@@ -61,6 +62,65 @@ Scenario("login-scenario1", async () => {
6162

6263
You can also use tags to manage labels on scenarios.
6364

65+
## Links usage
66+
67+
```js
68+
import { link, issue, tms } from "allure-js-commons";
69+
70+
Feature("login-feature");
71+
Scenario("login-scenario1", async () => {
72+
await link("link_type", "https://allurereport.org", "Allure Report");
73+
await issue("Issue Name", "https://github.com/allure-framework/allure-js/issues/352");
74+
await tms("Task Name", "https://github.com/allure-framework/allure-js/tasks/352");
75+
});
76+
```
77+
78+
You can also configure links formatters to make usage much more convenient. `%s`
79+
in `urlTemplate` parameter will be replaced by given value.
80+
81+
```diff
82+
module.exports.config = {
83+
// ...
84+
plugins: {
85+
allure: {
86+
enabled: true,
87+
require: "allure-codeceptjs",
88+
+ links: [
89+
+ {
90+
+ type: "${LinkType.ISSUE}",
91+
+ urlTemplate: "https://example.org/issues/%s",
92+
+ },
93+
+ {
94+
+ type: "${LinkType.TMS}",
95+
+ urlTemplate: "https://example.org/tasks/%s",
96+
+ }
97+
+ ]
98+
},
99+
},
100+
// ...
101+
};
102+
```
103+
104+
Then you can assign link using shorter notation:
105+
106+
```js
107+
import { link, issue, tms } from "allure-js-commons";
108+
109+
Feature("login-feature");
110+
Scenario("login-scenario1", async () => {
111+
await issue("351");
112+
await issue("352", "Issue Name");
113+
await tms("351");
114+
await tms("352", "Task Name");
115+
await link("custom", "352");
116+
await link("custom", "352", "Link name");
117+
});
118+
```
119+
120+
## Tags metadata API
121+
122+
You also can mark up your tests with Allure metadata using CodeceptJS tags API.
123+
64124
### Id
65125

66126
```javascript

‎packages/allure-cucumberjs/README.md

Copy file name to clipboardExpand all lines: packages/allure-cucumberjs/README.md
+65-6Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@
1717
Install the required packages using your favorite package manager:
1818

1919
```shell
20-
# using npm
21-
npm install --save-dev allure-cucumberjs
22-
# using yarn
23-
yarn add -D allure-cucumberjs
24-
# using pnpm
25-
pnpm add -D allure-cucumberjs
20+
npm add -D allure-cucumberjs
2621
```
2722

2823
Create `reporter.js` with following content:
@@ -119,6 +114,70 @@ Given(/my step/, async function() {
119114

120115
If you run your Cucumber features using single thread mode, `AllureCucumberWorld` is set automatically.
121116

117+
### Links usage
118+
119+
```js
120+
const { Given } = require("@cucumber/cucumber");
121+
import { link, issue, tms } from "allure-js-commons";
122+
123+
Given("step name", async () => {
124+
await link("link_type", "https://allurereport.org", "Allure Report");
125+
await issue("Issue Name", "https://github.com/allure-framework/allure-js/issues/352");
126+
await tms("Task Name", "https://github.com/allure-framework/allure-js/tasks/352");
127+
});
128+
```
129+
130+
You can also configure links formatters to make usage much more convenient. `%s`
131+
in `urlTemplate` parameter will be replaced by given value.
132+
133+
```diff
134+
// config.js
135+
export default {
136+
format: "./path/to/reporter.js",
137+
+ formatOptions: {
138+
+ links: [
139+
+ {
140+
+ pattern: [/@issue=(.*)/],
141+
+ type: "issue",
142+
+ urlTemplate: "https://example.com/issues/%s",
143+
+ },
144+
+ {
145+
+ pattern: [/@tms=(.*)/],
146+
+ type: "tms",
147+
+ urlTemplate: "https://example.com/tasks/%s",
148+
+ },
149+
+ ],
150+
+ }
151+
};
152+
```
153+
154+
Then you can assign link using shorter notation:
155+
156+
```js
157+
const { Given } = require("@cucumber/cucumber");
158+
import { link, issue, tms } from "allure-js-commons";
159+
160+
Given("step name", async () => {
161+
await issue("351");
162+
await issue("352", "Issue Name");
163+
await tms("351");
164+
await tms("352", "Task Name");
165+
await link("custom", "352");
166+
await link("custom", "352", "Link name");
167+
});
168+
```
169+
170+
Links patterns also work with Cucumber tags which match `pattern` parameter:
171+
172+
```gherkin
173+
@issue=0
174+
Feature: links
175+
176+
@issue=1 @tms=2
177+
Scenario: a
178+
Given a step
179+
```
180+
122181
### Parameters usage
123182

124183
```ts

‎packages/allure-jest/README.md

Copy file name to clipboardExpand all lines: packages/allure-jest/README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
2222
## Installation
2323

24-
Use your favorite node package manager to install required packages:
24+
Use your favorite node package manager to install the package:
2525

2626
```shell
2727
npm add -D allure-jest

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.