- Documentation Version: 1.0
- Language: Node.js
- Tools: Cypress
- Demo automation ecommerce site automation
- Capture all redirection links and other details and save to a file
This is demo automation project using Cypress. In this project I have used http://automationexercise.com site to automate the test case. I have completed below steps on this project,
- Launch browser(Chrome/Firefox)
- Navigate to url 'http://automationexercise.com'
- Verify that home page is visible successfully
- Add products to cart
- Click 'Cart' button
- Verify that cart page is displayed
- Click Proceed To Checkout
- Click 'Register / Login' button
- Fill all details in Sign up and create account
- Verify 'ACCOUNT CREATED!' and click 'Continue' button
- Verify 'Logged in as username' at top
- Click 'Cart' button
- Click 'Proceed To Checkout' button
- Verify Address Details and Review Your Order
- Enter description in comment text area and click 'Place Order'
- Enter payment details: Name on Card, Card Number, CVC, Expiration date
- Click 'Pay and Confirm Order' button
- Verify the success message 'Your order has been placed successfully!'
I followed a recommended design pattern for this project.
- I have used Page Object Model (POM) design pattern (in reusable commands also object oriented approach)
- [ In Cypress we do not have to use the object-oriented PageObject implementation. We can also move typical logic into reusable Cypress Custom Commands that do not have any internal state and just allow us to reuse code. ]
- I have created a separate file for each test case.
- I have used Cypress fixtures to store the test data.
- I have used Cypress commands to create custom commands.
- I have used Cypress environment variables to store the environment variables.
- I have used a Cypress Mochawesome reporter to generate the report.
Install the following.
- Install Node.js >16^ recommended
- Install Docker (Optional: If you want to run the test in docker container)
- Git
- After completing the installation, clone the repository.
git clone https://github.com/sraskin/automationexercise-with-cypress.git
-
Verify that you are in the master branch.
-
Then run,
npm install
- To run in interactive mode, open terminal > go to the project and type
npx cypress open
- Then choose E2E testing > Choose browser > choose the spec you wanted to run or run the entire folder
- To run into the docker container,
docker compose build
docker compose up