Skip to content

Commit d7bb2bd

Browse files
committed
docs: intro video, demo report, API section
1 parent b7fa547 commit d7bb2bd

File tree

88 files changed

+3651
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+3651
-106
lines changed

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lts/hydrogen
1+
lts/iron

docs/api/01-docblocks.mdx

+371
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,371 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
# Docblocks
6+
7+
:::info
8+
9+
Docblocks cannot be applied to `describe` statements.
10+
If you want to apply a docblock to all tests in the file,
11+
you can put it on the first line of the file.
12+
13+
:::
14+
15+
Docblocks (JSDoc-style comments) are the least intrusive way to add metadata to your tests.
16+
These annotations get parsed by `jest-allure2-reporter` and used as a source of information for your test reports.
17+
18+
## Plain comments
19+
20+
Plain comments act as [`@description`][1] annotations, when applied to a test case.
21+
22+
```javascript
23+
/**
24+
* This test demonstrates the addition operation.
25+
*/
26+
test('should add two numbers', () => {
27+
expect(1 + 2).toBe(3);
28+
});
29+
```
30+
31+
For hooks, they act as [`@displayName`][2] annotations.
32+
33+
```javascript
34+
/**
35+
* Navigate to the home page
36+
*/
37+
beforeEach(async () => {
38+
await page.goto('https://example.com');
39+
});
40+
```
41+
42+
## `@description` / `@desc`
43+
44+
Adds a Markdown description to a test case.
45+
46+
```javascript
47+
/**
48+
* @description
49+
* This test demonstrates the addition operation.
50+
*/
51+
test('should add two numbers', () => {
52+
expect(1 + 2).toBe(3);
53+
});
54+
```
55+
56+
## `@descriptionHtml`
57+
58+
Adds an HTML description to a test case.
59+
60+
```javascript
61+
/**
62+
* @descriptionHtml
63+
* This test demonstrates the <code>-</code> operator.
64+
*/
65+
test('should subtract two numbers', () => {
66+
expect(2 - 1).toBe(1);
67+
});
68+
```
69+
70+
## `@displayName`
71+
72+
Overrides test names specified in `test('...')` or `it('...')` in the test report.
73+
74+
```javascript
75+
/**
76+
* @displayName 1 + 1 = 2
77+
*/
78+
test('First test', () => {
79+
expect(1 + 1).toBe(2);
80+
});
81+
```
82+
83+
When applied to a hook, it sets a custom display name for the hook, similar to a [plain comment][3]:
84+
85+
```javascript
86+
/**
87+
* @displayName Custom "beforeEach" hook
88+
*/
89+
beforeEach(() => {
90+
// Hook implementation
91+
});
92+
```
93+
94+
## `@fullName`
95+
96+
Sets a full name for a test case, which can be used for more detailed identification.
97+
By default, full names are also used for tracking test history across multiple runs or retries.
98+
99+
```javascript
100+
/**
101+
* @fullName Arithmetic > Addition > Valid assertion
102+
*/
103+
test('First test', () => {
104+
expect(1 + 1).toBe(2);
105+
});
106+
```
107+
108+
## `@historyId`
109+
110+
Assigns a custom history ID to a test case, useful for tracking test history across multiple runs or retries.
111+
112+
```javascript
113+
/**
114+
* @historyId HISTORY-2
115+
*/
116+
test('First test', () => {
117+
expect(2 + 2).toBe(3);
118+
});
119+
```
120+
121+
## `@issue`
122+
123+
Links an issue to a test case.
124+
125+
For an individual test:
126+
127+
```javascript
128+
/**
129+
* @issue XMLRPC-15
130+
*/
131+
test('Proving the fix', () => {
132+
expect(1 + 1).toBe(2);
133+
});
134+
```
135+
136+
For all tests in the file, put the docblock at the very top:
137+
138+
```javascript
139+
/**
140+
* @issue XMLRPC-15
141+
*/
142+
143+
// Rest of your test file...
144+
```
145+
146+
## `@owner`
147+
148+
Specifies the owner of a test or suite.
149+
150+
For an individual test:
151+
152+
```javascript
153+
/**
154+
* @owner John Doe
155+
*/
156+
test('Test maintained by John', () => {
157+
// Test implementation
158+
});
159+
```
160+
161+
For all tests in the file:
162+
163+
```javascript
164+
/**
165+
* @owner John Doe
166+
*/
167+
168+
// Rest of your test file...
169+
```
170+
171+
## `@package`
172+
173+
Specifies the package for a test or suite, useful for organizing tests.
174+
175+
For an individual test:
176+
177+
```javascript
178+
/**
179+
* @package e2e.pragmas
180+
*/
181+
test('should log a message', () => {
182+
// Test implementation
183+
});
184+
```
185+
186+
For all tests in the file:
187+
188+
```javascript
189+
/**
190+
* @package e2e.my-tests
191+
*/
192+
193+
// Rest of your test file...
194+
```
195+
196+
## `@severity`
197+
198+
Sets the severity level for a test or suite.
199+
200+
For an individual test:
201+
202+
```javascript
203+
/**
204+
* @severity critical
205+
*/
206+
test('Important test', () => {
207+
expect(1 + 1).toBe(2);
208+
});
209+
```
210+
211+
For all tests in the file:
212+
213+
```javascript
214+
/**
215+
* @severity critical
216+
*/
217+
218+
// Rest of your test file...
219+
```
220+
221+
## `@epic`, `@feature`, `@story`
222+
223+
Categorizes tests into epics and features for better organization.
224+
225+
Example:
226+
227+
```javascript
228+
/**
229+
* @epic Arithmetic operations
230+
* @feature Addition
231+
*/
232+
233+
// Rest of your test file...
234+
235+
/**
236+
* @story Sane assumptions
237+
*/
238+
test('1 + 1 should equal 2', () => {
239+
expect(1 + 1).toBe(2);
240+
});
241+
```
242+
243+
## `@tag`
244+
245+
Adds tags to a test or suite.
246+
247+
For an individual test:
248+
249+
```javascript
250+
/**
251+
* @tag arithmetic, addition
252+
*/
253+
test('First test', () => {
254+
expect(1 + 1).toBe(2);
255+
});
256+
```
257+
258+
For all tests in the file:
259+
260+
```javascript
261+
/**
262+
* @tag arithmetic
263+
*/
264+
265+
// Rest of your test file...
266+
```
267+
268+
## `@thread`
269+
270+
Specifies a custom thread for concurrent tests.
271+
Do not use it unless you want to control tests on the [Timeline][4] manually.
272+
273+
For an individual test:
274+
275+
```javascript
276+
/**
277+
* @thread IV
278+
*/
279+
test('Concurrent test', () => {
280+
expect(1 + 1).toBe(2);
281+
});
282+
```
283+
284+
For all tests in the file:
285+
286+
```javascript
287+
/**
288+
* @thread IV
289+
*/
290+
291+
// Rest of your test file...
292+
```
293+
294+
## `@tms`
295+
296+
Links a test management system (TMS) case to a test.
297+
298+
For an individual test:
299+
300+
```javascript
301+
/**
302+
* @tms TMS-1234
303+
*/
304+
test('should be linked to a TMS ticket', () => {
305+
expect(1 + 1).toBe(2);
306+
});
307+
```
308+
309+
For all tests in the file:
310+
311+
```javascript
312+
/**
313+
* @tms TMS-1234
314+
*/
315+
316+
// Rest of your test file...
317+
```
318+
319+
## `@url`
320+
321+
Adds a custom URL link to a test or suite.
322+
323+
For an individual test:
324+
325+
```javascript
326+
/**
327+
* @url https://en.wikipedia.org/wiki/Addition ➕ Addition
328+
*/
329+
test('1 + 1 = 2', () => {
330+
expect(1 + 1).toBe(2);
331+
});
332+
```
333+
334+
For all tests in the file:
335+
336+
```javascript
337+
/**
338+
* @url https://en.wikipedia.org/wiki/Arithmetic 🔢 Arithmetic
339+
*/
340+
341+
// Rest of your test file...
342+
```
343+
344+
## `@parentSuite`, `@suite`, `@subSuite`
345+
346+
Organizes tests into a hierarchical suite structure.
347+
348+
Example:
349+
350+
```javascript
351+
/**
352+
* @parentSuite Custom Parent Suite
353+
*/
354+
355+
// ...
356+
357+
/**
358+
* @suite Custom Suite
359+
* @subSuite Custom Sub-Suite
360+
*/
361+
test('Test with custom suite hierarchy', () => {
362+
// Test implementation
363+
});
364+
```
365+
366+
These docblock annotations provide a powerful way to enrich your tests with metadata, improving the organization and readability of your Allure reports. By using these annotations, you can create more informative and structured test reports that help in better understanding and maintaining your test suite.
367+
368+
[1]: #description--desc
369+
[2]: #displayname
370+
[3]: #plain-comments
371+
[4]: #TODO

0 commit comments

Comments
 (0)