You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-4Lines changed: 14 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ Given /^set the display name of user "([^"]*)" to "([^"]*)"$/
56
56
Given /^set the email of user "([^"]*)" to "([^"]*)"$/
57
57
Given sending :verb to ocs :url
58
58
Given the response should have a status code :code
59
-
Given fetch field :path from prevous JSON response
59
+
Given fetch field :path from previous JSON response
60
60
Given the response should contain the initial state :name with the following values:
61
61
Given the response should contain the initial state :name json that match with:
62
62
Given the following :appId app config is set
@@ -83,7 +83,7 @@ Given sending "post" to ocs "/apps/libresign/api/v1/request-signature"
83
83
| file | {"base64":""} |
84
84
```
85
85
86
-
### Step: `fetch field :path from prevous JSON response`
86
+
### Step: `fetch field :path from previous JSON response`
87
87
88
88
If the json response is an array, you can fetch specific values using this step. The fetched values is stored to be used by other steps.
89
89
@@ -112,12 +112,22 @@ The alias `price` could be used in a path or body of a request:
112
112
}
113
113
"""
114
114
And sending "POST" to "/"
115
-
And fetch field "(foo)data.0.foo" from prevous JSON response
115
+
And fetch field "(foo)data.0.foo" from previous JSON response
116
116
# After fetch the field, you can use the value of field like this:
117
117
And sending "POST" to "/?foo=<foo>"
118
118
| field | <data.0.foo> |
119
119
```
120
120
121
+
#### Fetch field using jq
122
+
123
+
You can assign the return of a jq to your field using a jq like as the follow pattern:
124
+
125
+
```gherkin
126
+
And fetch field "(foo)(jq).value" from previous JSON response
127
+
```
128
+
129
+
This will retrieve a specific value from json response and assign this to your desided field.
130
+
121
131
## Parse response using jq
122
132
123
133
You can use [jq](https://jqlang.github.io/jq/manual/) expression casting to check a value in a json response body of a request. To do this you will need to install the jq command.
@@ -150,7 +160,7 @@ If you need to:
150
160
151
161
Implement a method `parseText` like the follow code and remember to call parent method.
152
162
153
-
This methods can works together with `fetch field :path from prevous JSON response`
163
+
This methods can works together with `fetch field :path from previous JSON response`
154
164
```php
155
165
protected function parseText(string $text): string {
0 commit comments