Skip to content

Commit c5d3b0a

Browse files
added new api parser step (#104)
1 parent 2415093 commit c5d3b0a

File tree

5 files changed

+52
-28
lines changed

5 files changed

+52
-28
lines changed

versioned_docs/version-2x/StandaloneSolutions/playwright.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ npm init playwright
1111
```
1212

1313
```shell
14-
npm install @qavajs/core @qavajs/playwright @qavajs/playwright-runner-adapter @qavajs/memory
14+
npm install @qavajs/playwright
1515
```
1616

1717
## Configuration
@@ -33,7 +33,7 @@ export default {
3333

3434
playwright.config.ts
3535
```typescript
36-
import { defineCucumber } from '@qavajs/playwright-runner-adapter';
36+
import { defineCucumber } from '@qavajs/playwright';
3737

3838
export default defineConfig({
3939
testDir: defineCucumber({

versioned_docs/version-2x/Steps/accessibility-ea.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ Steps to perform accessibility checks using accessibility-checker library.
77
Library can work on top of playwright and webdriverio drivers
88

99
## Installation
10-
`npm install @qavajs/steps-accessibility-ea`
10+
```bash
11+
npm install @qavajs/steps-accessibility-ea
12+
```
1113

1214
## Configuration
1315
```javascript
14-
module.exports = {
15-
default: {
16-
require: [
17-
'node_modules/@qavajs/steps-wdio/index.js', //corresponding driver library should be imported first
18-
'node_modules/@qavajs/steps-accessibility-ea/index.js'
19-
],
20-
format: [
21-
'@qavajs/html-formatter:report.html'
22-
],
23-
}
16+
export default {
17+
require: [
18+
'node_modules/@qavajs/steps-wdio/index.js', //corresponding driver library should be imported first
19+
'node_modules/@qavajs/steps-accessibility-ea/index.js'
20+
],
21+
format: [
22+
['@qavajs/html-formatter', 'report.html']
23+
],
2424
}
2525
```
2626

versioned_docs/version-2x/Steps/accessibility.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ sidebar_position: 7
66
Steps to perform accessibility checks using axe library.
77

88
## Installation
9-
`npm install @qavajs/steps-accessibility`
9+
```bash
10+
npm install @qavajs/steps-accessibility
11+
```
1012

1113
## Configuration
1214
```javascript
13-
module.exports = {
14-
default: {
15-
require: [
16-
'node_modules/@qavajs/steps-wdio/index.js', //corresponding driver library should be imported first
17-
'node_modules/@qavajs/steps-accessibility/index.js'
18-
],
19-
format: [
20-
'@qavajs/html-formatter:report.html'
21-
],
22-
}
15+
export default {
16+
require: [
17+
'node_modules/@qavajs/steps-wdio/index.js', //corresponding driver library should be imported first
18+
'node_modules/@qavajs/steps-accessibility/index.js'
19+
],
20+
format: [
21+
['@qavajs/html-formatter', 'report.html']
22+
]
2323
}
2424
```
2525

versioned_docs/version-2x/Steps/api.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,19 +182,43 @@ When I send "POST" request and save response as "response" to "$BASE_API_URL" wi
182182
```
183183

184184
### I parse \{response} body as \{type}
185-
MANDATORY STEP THAT SHOULD BE USED AFTER SENDING REQUEST
186-
Parsing body in needed way and adds payload property to response
185+
Parse body in needed way and adds `payload` property to response
187186

188187
| param | type | description |
189188
|:--------:|:-----------------------------------:|:----------------------:|
190189
| response | string | response key in memory |
191190
| type | [bodyParsingType](#bodyparsingtype) | type of payload |
192191

193192
```gherkin
194-
When I parse '$response' body as 'json'
193+
When I parse '$response' body as json
195194
Then I expect '$response.payload.foo' to equal 'bar'
196195
```
197196

197+
### I parse \{response} body as \{type}
198+
Parse body with provided parser and adds `payload` property to response
199+
200+
| param | type | description |
201+
|:--------:|:-----------------------------------:|:-------------------------------:|
202+
| response | string | response key in memory |
203+
| type | string | function with parser logic |
204+
205+
```gherkin
206+
When I parse "$response" body as "$soap"
207+
Then I expect "$response.payload['soap:envelope']" to equal "bar"
208+
```
209+
210+
where `soap` is memory function
211+
```typescript
212+
import { XMLParser } from 'fast-xml-parser';
213+
const xml = new XMLParser();
214+
class Data {
215+
soap = async (response: Response) => {
216+
const text = await response.text();
217+
return xml.parse(text);
218+
}
219+
}
220+
```
221+
198222
## Construction API Steps
199223

200224
---

versioned_docs/version-2x/Steps/files.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar_position: 5
66
Step library to work with file system
77

88
## Installation
9-
```
9+
```bash
1010
npm install @qavajs/steps-files
1111
```
1212

0 commit comments

Comments
 (0)