This is an automation framework developed for UI and API testing.
The framework contains the following 10 test cases for the website automationpractice.com/
-
Sign up.
-
Log in.
-
Search for an item using the search bar.
-
Check the best seller's section.
-
Add an item to the wishlist.
-
Subscribe for newsLetters.
-
Add an item to the shopping cart.
-
Remove the item from the shopping cart.
-
Complete the checkout.
-
Log out.
The test cases are documented in the test management platform qatouch.com. To access the test suite, can reach me at: raffy.a.rodriguez@gmail.com
For the API testing it was required to be automated 3 request to the Marvel Comics API Marvel Developer Site.
-
Automate that all the characters can be fetch.
-
Automate that all the comics for Spiderman can be fetch.
-
Automate that all characters for the X-Man comic can be fetch
-
Node.js must be installed in order to run the project.
-
(For locally purposes)
If you are usingwindow's powershell or CMD
as terminal, run the commandnpm run test-windows
or if you are a MacOs or linux user just run from the terminalnpm run test
. -
Go to Marvel's developer website and create an account to get a public and a private API key
(this is required for API testing)
. -
Make sure of getting an email and password for automationpractice.com/.
- Clone the repository from Github.
git clone https://github.com/elraffy/Senior-QA-Challenge-Raffy-Rodriguez.git
- Install all packages and dependencies for the project.
npm install
- Configure the credentials for UI and API:
Go to directory cypress/fixtures
, open the loginData.json file and add the email and password for the website.
{
"email": "myemail@mail.com",
"pass": "mypassword"
}
Go to directory cypress/support/utilities
, open the file apiHelper.js and modify the properties apiData.publicKey
and apiData.privateKey
,
replacing the values with the ones gotten from Marvel's developer website after creating the account.
apiData.publicKey = "my marvel public key goes here";
apiData.privateKey = "my marvel private key goes here";
The required hash and timestamp are being generated by using the MD5 library and programatically on the same apiHelper.js file.
const date = new Date();
apiData.timestamp = date.getTime();
apiData.hash = md5(apiData.timestamp + apiData.privateKey + apiData.publicKey);
- Run the tests using the cypress Test Runner by typing on the terminal the command:
npx cypress open
- Run the tests on headless mode by typing on the terminal the command:
npm run test
This will automatically run all test and generate the report at the end of execution.
- The website automationpractice.com has load issues and this make some of the test fail sometimes.
- For API negative test cases was used
failOnStatusCode: false
, so it can continue and do the assertions. - It was implemented the ESlint linter to ensured the code ebst practices and performance.
-
It was used the POM dessign pattern combined with Javascript and cypress best practices.
-
Reusable features like Login and Logout were created as a custom command for cypress, so can be used when need it.
-
The static data was created on
fixture
but the dynamic data was generated using fakerjs, creating variables in a custom helper file. -
All
validation data for assertions
such as(URLs and confirmation messages )
, were saved in the cypress.json/env. -
The CI pipeline is configured through a Circle CI orbs.
-
All The API successfull requests for positive scenarios were also validated using the postman tool and the collection will be included in the project just in case that is required to validate some information.
-
To test with postman or other third party, will be required to get a hash that can be generated by going to Hash generator and doing the following steps:
-
Go to the Hash generator website.
-
On the text-area field paste the API keys preceded by the number
1
that will works as aTimestamp
.
` 1 + Marvel's API privateKey + Marvel's API publicKey`
- Click the generate button to get the hash required for API testing.
-
Contributions are always welcome!
- Feel free of fork this project, create your own branch, commit your changes and do your pull request.