Im happy that I was able to use and test this extension for my needs. But I encounter an issue, might be a support feature given the condition and result below.
Condition:
GET api/123-123-123?_format=json - FAILED
[
{
"uuid": "123-123-123"
}
]
GET content/1?_format=json - PASSED
{
"uuid": [
{
"value": "abc-abc-abc"
}
]
}
Test Result
Scenario: Sending GET request to existing resource should lead to 200 # /opt/app-root/src/html/modules/custom/spa/behat/features/capabilities/custom/send_request.feature:10
When I send a GET request to "content/1?_format=json" # Ubirak\RestApiBehatExtension\RestApiContext::iSendARequest()
Then the response status code should be in 200 # Ubirak\RestApiBehatExtension\RestApiContext::theResponseCodeShouldBeIn()
And the JSON node "uuid[0].value" should be equal to "abc-abc-abc" # Ubirak\RestApiBehatExtension\Json\JsonContext::theJsonNodeShouldBeEqualTo()
Scenario: Sending GET request to existing resource should lead to 200 # /opt/app-root/src/html/modules/custom/spa/behat/features/capabilities/custom/send_request.feature:15
When I send a GET request to "api/123-123-123?_format=json" # Ubirak\RestApiBehatExtension\RestApiContext::iSendARequest()
And print last responses # ApiFeatureContext::printLastResponses()
Then the response status code should be in 200 # Ubirak\RestApiBehatExtension\RestApiContext::theResponseCodeShouldBeIn()
And the JSON node "uuid[0].value" should be equal to "123-123-123" # Ubirak\RestApiBehatExtension\Json\JsonContext::theJsonNodeShouldBeEqualTo()
Failed to evaluate expression "uuid[0].value" (Ubirak\RestApiBehatExtension\Json\WrongJsonExpectation)
│
╳ Warning: file_put_contents(/opt/app-root/src/html/modules/custom/spa/behat/screenshot/20180528-04_33_52-test-rest-api-request-error.jpg): failed to open stream: Permission denied in /opt/app-root/src/html/modules/custom/spa/behat/features/bootstrap/SocialMinkContext.php line 58
│
└─ @AfterStep # SocialMinkContext::takeScreenShotAfterFailedStep()
Does it have to do with the json format response? If yes, can anyone help of what is the correct way of searching for an element for uuid[0].value(on the failing result).
Im happy that I was able to use and test this extension for my needs. But I encounter an issue, might be a support feature given the condition and result below.
Condition: GET
api/123-123-123?_format=json
- FAILEDGET
content/1?_format=json
- PASSEDTest Result
Does it have to do with the json format response? If yes, can anyone help of what is the correct way of searching for an element for
uuid[0].value
(on the failing result).Already tried
uuid
anduuid[0]
, same result.