Skip to content

Commit 58d0444

Browse files
updated docs for soft assertions and xray (#91)
1 parent 87aa191 commit 58d0444

File tree

4 files changed

+77
-67
lines changed

4 files changed

+77
-67
lines changed

docs/Formatters/xray-formatter.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,25 @@ sidebar_position: 5
33
---
44

55
# @qavajs/xray-formatter
6+
Xray formatter for cucumber framework
67

7-
Jira Xray formatter for cucumber framework
8+
### Installation
9+
To install formatter run
810

9-
## Installation
10-
```
11-
npm install @qavajs/xray-formatter
12-
```
13-
14-
## Configuration
15-
Add to format section in config file
11+
`npm install @qavajs/xray-formatter`
12+
13+
add to formatter section in config file
1614

1715
cloud configuration:
1816
```javascript
1917
export default {
20-
format: [
21-
['@qavajs/xray-formatter', 'report/xray.out']
22-
],
18+
format: ['@qavajs/xray-formatter:report/xray.out'],
2319
formatOptions: {
2420
xray: {
2521
client_id: 'client_id', // generated client_id from xray cloud
2622
client_secret: 'client_secret', // generated client_id from xray client_secret
27-
testExecutionKey: 'ABC-12' // test execution jira key to send result
23+
testExecutionKey: 'ABC-12', // test execution jira key to send result
24+
tagRegexp: 'TEST_(.+)' // optional, parse tag regexp. default /@(.+-\d+)/
2825
}
2926
}
3027
}
@@ -38,24 +35,24 @@ export default {
3835
xray: {
3936
endpoint: 'https://your.jira.instance/jira', //jira api endpoint
4037
client_secret: 'client_secret', // personal access key from jira instance
41-
testExecutionKey: 'ABC-12' // test execution jira key to send result
38+
testExecutionKey: 'ABC-12', // test execution jira key to send result
39+
tagRegexp: 'TEST_(.+)' // optional, parse tag regexp
4240
}
4341
}
4442
}
4543
```
4644

47-
## How it works?
48-
Plugin reads all tags in jira key format (@ABCD-123) and update corresponding scenarios in provided test execution
45+
### How it works?
46+
Plugin reads all tags in jira key format (@ABCD-123) or ones that matches `tagRegexp` and update corresponding scenarios in provided test execution
4947

50-
## F.A.Q
48+
### F.A.Q
5149
- Does it work with Jira Server?
5250

5351
Yes
5452

55-
- What multiple test automated cases mapped to one xray test case?
53+
- What if multiple tests are mapped to one xray test case?
5654

5755
Test will get status from last result with corresponding tag
5856

59-
- What multiple xray cases mapped to one test automation case?
60-
61-
All mapped test cases will get same status
57+
- What if multiple xray cases are mapped to one test?
58+

docs/Guides/page-object-v2.mdx

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,6 @@ import TabItem from '@theme/TabItem';
88
# Page Object v2
99
qavajs provides flexible page object model that resolves plain-english selector and return element or array of elements.
1010

11-
<Tabs>
12-
<TabItem value="js" label="JavaScript" default>
13-
```javascript
14-
const { When } = require('@cucumber/cucumber');
15-
16-
// playwright
17-
When('click {playwrightLocator}'/, async function (locator) {
18-
await locator.click();
19-
});
20-
21-
// wdio
22-
When('click {wdioLocator}'/, async function (locator) {
23-
await locator().click();
24-
});
25-
```
26-
</TabItem>
27-
<TabItem value="ts" label="TypeScript">
28-
```typescript
29-
import { When } from '@cucumber/cucumber';
30-
31-
// playwright
32-
When('click {playwrightLocator}'/, async function (locator) {
33-
await locator.click();
34-
});
35-
36-
// wdio
37-
When('click {wdioLocator}'/, async function (locator) {
38-
await locator().click();
39-
});
40-
```
41-
</TabItem>
42-
</Tabs>
43-
44-
```gherkin
45-
When click 'Product > Add To Cart'
46-
```
47-
4811
## Create page object
4912

5013
Entry point of page object is class defined as _pageObject_ property in config
@@ -170,3 +133,42 @@ Playwright example:
170133
```
171134
</TabItem>
172135
</Tabs>
136+
137+
## Using page object in custom steps
138+
It's possible to use page object in custom step definitions via built-in parameter types `playwrightLocator` and `wdioLocator`
139+
<Tabs>
140+
<TabItem value="js" label="JavaScript" default>
141+
```javascript
142+
const { When } = require('@cucumber/cucumber');
143+
144+
// playwright
145+
When('click {playwrightLocator}'/, async function (locator) {
146+
await locator.click();
147+
});
148+
149+
// wdio
150+
When('click {wdioLocator}'/, async function (locator) {
151+
await locator().click();
152+
});
153+
```
154+
</TabItem>
155+
<TabItem value="ts" label="TypeScript">
156+
```typescript
157+
import { When } from '@cucumber/cucumber';
158+
159+
// playwright
160+
When('click {playwrightLocator}'/, async function (locator) {
161+
await locator.click();
162+
});
163+
164+
// wdio
165+
When('click {wdioLocator}'/, async function (locator) {
166+
await locator().click();
167+
});
168+
```
169+
</TabItem>
170+
</Tabs>
171+
172+
```gherkin
173+
When click 'Product > Add To Cart'
174+
```

docs/Modules/soft-assertion.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,32 @@ sidebar_position: 2
66
Module that allow to use soft asserts in qavajs tests
77

88
## Installation
9-
```shell
10-
npm install @qavajs/soft-assertion
11-
```
9+
`npm install @qavajs/soft-assertion`
1210

1311
## Usage
1412

15-
Add module to requireModule and set activation tag (default is @softAssert).
16-
Soft assertion change behavior of Cucumber and Then steps will not cause test case failure.
13+
Add module to requireModule.
1714
```javascript
1815
module.exports = {
1916
default: {
2017
requireModule: [
21-
'@qavajs/soft-assertion'
22-
],
23-
softAssertTag: '@yourTag'
18+
'@qavajs/soft-assertion/index.js'
19+
]
2420
}
2521
}
2622
```
23+
24+
Now you can use `softly` prefix before any expect.
25+
```gherkin
26+
Feature: Feature
27+
28+
Scenario: verify soft assert
29+
# first step fails but other steps will not be skipped
30+
Then I softly expect '2' to equal '1'
31+
# pass
32+
And I expect '1' to equal '1'
33+
# fail
34+
And I expect '2' to equal '1'
35+
# skip
36+
And I expect '1' to equal '1'
37+
```

docs/writing-tests.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Feature: Wikipedia
2222

2323
In this scenario:
2424

25-
- `Search Input`, `Search Button`, and `Title` are aliases for corresponding [(page objects)](./Guides/page-object-v2.mdx).
26-
- `$wikipedia` is an alias for a [(constant)](./Guides/memory.md) URL.
25+
- `Search Input`, `Search Button`, and `Title` are aliases for corresponding [page objects](./Guides/page-object-v2.mdx).
26+
- `$wikipedia` is an alias for a [constant](./Guides/memory.md) URL.
2727

2828
## Page Objects
2929
Define the page objects in the page_object folder:

0 commit comments

Comments
 (0)