diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php new file mode 100644 index 0000000000000..6aa970037fe5f --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php @@ -0,0 +1,66 @@ +graphQlQuery($mutation); + $this->assertArrayHasKey('generateCustomerToken', $response); + $this->assertInternalType('string', $response['generateCustomerToken']); + } + + /** + * Verify customer with invalid credentials + * + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testGenerateCustomerTokenWithInvalidCredentials() + { + $userName = 'customer@example.com'; + $password = 'bad-password'; + + $mutation + = <<expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors: ' . + 'The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.'); + $this->graphQlQuery($mutation); + } +}