QA example for testing thepiehut website using Selenium and TestNG
Tests are written in Java using Selenium and TestNG Browser: Mozilla Firefox. :mozzila This project tests the following:
- Login
- Searching products
- Adding products to the cart
- Removing products from the cart
- Checkout process
Pages that are tested in this project are:
- Home page ( https://thepihut.com/)
- Search results page ( https://thepihut.com/pages/search-results?q=YOUR_QUERY)
- Login page (https://thepihut.com/account/login)
- Shopping Cart page (https://thepihut.com/cart )
- Account page (https://thepihut.com/account )
- Product page ( https://thepihut.com/products/PRODUCT_NAME )
- Checkout page
- Shipping page
- Add to cart test ( 4 tests )
- Login test ( 2 tests )
- Checkout test
- Search test ( 3 tests )
Before any test using the cart initialize empty cart.
- Go to home page
- Go to cart
- Check if shopping cart title is displayed correctly
- Get number of items in the cart
- If cart is not empty remove all items from the cart
- Check if shopping cart is now empty
- Go back to home page
- Initialize empty cart.
- Go to home page
- Click on some product and go to product page
- Check if product page is displayed correctly
- Get price of product
- Add the product to the cart
- Go to the cart
- Check if shopping cart title is displayed correctly
- Get price from shopping cart
- Check if prices from shopping cart and product page are the same
- Check if product counter is now set to 1
- Go back to home page
Initialize empty cart. All the steps are the same as the last test except: 5. Add the product to the cart multiple times 10. Check if product counter is now set to number of additions
Before any test using the cart initialize empty cart.
- Go to home page
- Click on some product and go to product page
- Check if product page is displayed correctly
- Get price of product
- Add the product to the cart
- Go back to home page
- Repeat steps 2 - 5
- Go to the cart
- Check if shopping cart title is displayed correctly
- Get price from shopping cart
- Check if prices from shopping cart and product page are the same
- Check if product counter is now set to 2
- Go back to home page
Before any test using the cart initialize empty cart.
- Go to home page
- Click on some product and go to product page
- Check if product page is displayed correctly
- Add the product to the cart
- Go to the cart
- Check if shopping cart title is displayed correctly
- Check if product counter is now set to 2
- Remove all items from cart
- Check if product counter is now set to 2
- Check if empty cart message is displayed
- Go back to home page
#Search test
###Search for invalid item test ( type: negative )
- Go to home page
- Search for some item that doesn't exist
- Check if search page is displayed correctly
- Check if number of results is zero
- Check if the result message is displayed correctly
- Go to home page
- Search for some valid item
- Check if search page is opened and text is correctly displayed
- Get number of results and check if the number is correct
- Select first price range and check if price range is correct
- Check if prices of items displayed are in selected range
- Check if number of results has changed
- Go back to home page
- Go to home page
- Search for some valid item
- Check if search page is opened and text is correctly displayed
- Get the title of some category from sidebar
- Click on that category
- Check if title of the page is the same as category from the sidebar
- Go back to home page
Before any test using the login - If logged in then log out
- Go to home page
- Click on login button and check if login page is opened
- Sign into account
- Check if name, logout button and order history title are displayed correctly
- Click on logout button
- Check if user is returned to home page
- Go to home page
- Click on login button and check if login page is opened
- Sign in with invalid credentials
- Check if error message is displayed correctly
- Return to home page
Combines lot of the tests above and is best described trough this diagram: