class PingCest
{
public function testPing(AcceptanceTester $I)
{
$query = 'query{ping {response}}';
$I->sendGraphQL($query);
$I->seeResponseMatchesJsonType ([
'response' => 'string',
], '$.ping[*]'
]);
$I->seeResponseContainsJson([
'ping' => [
'response' => 'pong',
]
]);
}
}
Add support for testing JSON responses and validate JSON structures, see: https://codeception.com/docs/10-WebServices and https://codeception.com/docs/modules/REST#seeResponseMatchesJsonType