-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔧 fix failed test example & update version
- Loading branch information
Showing
6 changed files
with
59 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 41 additions & 57 deletions
98
templates/english/features/example-authentication.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,81 @@ | ||
Feature: Authentication on ADEQUATESHOP API | ||
Feature: DummyJSON API | ||
|
||
API Automation with Authentication example | ||
API Automation with DummyJSON API | ||
|
||
Scenario: User Registration using Registered Data | ||
Given I make a "POST" request to "http://restapi.adequateshop.com/api/authaccount/registration" | ||
Scenario: User Login using Valid Credentials | ||
Given I make a "POST" request to "https://dummyjson.com/auth/login" | ||
And I set body to | ||
""" | ||
{ | ||
"name": "PactumJS 01", | ||
"email": "pactumjs01@gmail.com", | ||
"password": 123456 | ||
"username": "emilys", | ||
"password": "emilyspass" | ||
} | ||
""" | ||
When I receive a response | ||
Then I expect response should have a status "200" | ||
And I expect response should have a json | ||
And I expect response should contain a json | ||
""" | ||
{ | ||
"code": 1, | ||
"message": "The email address you have entered is already registered", | ||
"data": null | ||
"id": 1, | ||
"email": "emily.johnson@x.dummyjson.com", | ||
"username": "emilys", | ||
"firstName": "Emily", | ||
"lastName": "Johnson", | ||
"gender": "female" | ||
} | ||
""" | ||
|
||
Scenario: User Registration using Invalid Data | ||
Given I make a "POST" request to "http://restapi.adequateshop.com/api/authaccount/registration" | ||
Scenario: User Login using Invalid Credentials | ||
Given I make a "POST" request to "https://dummyjson.com/auth/login" | ||
And I set body to | ||
""" | ||
{ | ||
"name": "PactumJS XXX", | ||
"email": "pactumjsxxx", | ||
"password": 123456 | ||
"username": "notfounduser", | ||
"password": "invalidpassword" | ||
} | ||
""" | ||
When I receive a response | ||
Then I expect response should have a status "400" | ||
And I expect response should have a json at "ModelState" | ||
And I expect response should have a json | ||
""" | ||
{ | ||
"User.email": [ | ||
"Enter valid email address" | ||
] | ||
"message": "Invalid credentials" | ||
} | ||
""" | ||
|
||
Scenario: User Login using Valid Data | ||
Given I make a "POST" request to "http://restapi.adequateshop.com/api/authaccount/login" | ||
Scenario: Add New User using Valid Data | ||
Given I make a "POST" request to "https://dummyjson.com/users/add" | ||
And I set body to | ||
""" | ||
{ | ||
"email": "pactumjs001@gmail.com", | ||
"password": 123456 | ||
"firstName": "Ujang", | ||
"lastName": "Tea", | ||
"maidenName": "Jajang", | ||
"age": 17, | ||
"gender": "male", | ||
"email": "ujang.jajang@x.dummyjson.com", | ||
"phone": "+62 812-1234-1234", | ||
"username": "ujangjajang", | ||
"password": "123123123" | ||
} | ||
""" | ||
When I receive a response | ||
Then I expect response should have a status "200" | ||
And I expect response should have a json schema at "data" | ||
""" | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"Id": { | ||
"type": "integer" | ||
}, | ||
"Name": { | ||
"type": "string" | ||
}, | ||
"Email": { | ||
"type": "string" | ||
}, | ||
"Token": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
""" | ||
Then I expect response should have a status "201" | ||
And I log the response body | ||
|
||
Scenario: User Login using Invalid Data | ||
Given I make a "POST" request to "http://restapi.adequateshop.com/api/authaccount/login" | ||
And I set body to | ||
""" | ||
{ | ||
"email": "invalidaccount@email.com", | ||
"password": 111222333 | ||
} | ||
""" | ||
Scenario: Get Valid Single User Data | ||
Given I make a "GET" request to "https://dummyjson.com/users/1" | ||
When I receive a response | ||
Then I expect response should have a status "200" | ||
And I log the response body | ||
|
||
Scenario: Get Invalid Single User Data | ||
Given I make a "GET" request to "https://dummyjson.com/users/99999" | ||
When I receive a response | ||
Then I expect response should have a status "404" | ||
And I expect response should have a json | ||
""" | ||
{ | ||
"code": 1, | ||
"message": "invalid username or password", | ||
"data": null | ||
"message": "User with id '99999' not found" | ||
} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters