|
1 |
| -### Automation using Cypress automation framework |
2 |
| - |
3 |
| -- This project has automated test scenarios for website - https://www.saucedemo.com/ |
4 |
| -- Used **Cypress** automation framework with **JavaScript** programming language for automation |
5 |
| -- Added **CI workflows** |
6 |
| - - GitHub action for Pull request testing |
7 |
| - - https://github.com/ganeshhubale/swag-lab-ui-tests/blob/master/.github/workflows/pull-request-tester.yaml |
8 |
| - - GitHub action for regression testing |
9 |
| - - https://github.com/ganeshhubale/swag-lab-ui-tests/blob/master/.github/workflows/regression-cron.yaml |
10 |
| - |
11 |
| -#### Steps to install project and run tests locally |
12 |
| - |
13 |
| -1. Install node.js |
14 |
| -2. Clone the repo: `git clone https://github.com/ganeshhubale/swag-lab-ui-tests.git` |
15 |
| -3. Run command: `npm install .` |
16 |
| -4. Open cypress and run tests: `./node_modules/.bin/cypress open` or `npx cypress open` |
17 |
| - |
18 |
| -### Test cases automated |
19 |
| -1. Authentication scenarios |
20 |
| - - Login to Swag Labs application |
21 |
| - - should retain session after page reload |
22 |
| - - should show error message on empty fields |
23 |
| - - should show error message on wrong username and password values |
24 |
| - - Logout from Swag Labs application |
25 |
| - - should logout after session expires |
26 |
| -2. Verify Sorting Functionality (Name: A-Z) |
27 |
| -Steps: |
28 |
| - |
29 |
| -Navigate to the inventory page. |
30 |
| -Select the "Name (A to Z)" option from the sort dropdown. |
31 |
| -Verify that items are sorted alphabetically in ascending order by their names. |
32 |
| -3. Verify Sorting Functionality (Name: Z-A) |
33 |
| -Steps: |
34 |
| - |
35 |
| -Navigate to the inventory page. |
36 |
| -Select the "Name (Z to A)" option from the sort dropdown. |
37 |
| -Verify that items are sorted alphabetically in descending order by their names. |
38 |
| -4. Verify Sorting Functionality (Price: Low to High) |
39 |
| -Steps: |
40 |
| - |
41 |
| -Navigate to the inventory page. |
42 |
| -Select the "Price (Low to High)" option from the sort dropdown. |
43 |
| -Verify that items are sorted in ascending order of their prices. |
44 |
| -5. Verify Sorting Functionality (Price: High to Low) |
45 |
| -Steps: |
46 |
| - |
47 |
| -Navigate to the inventory page. |
48 |
| -Select the "Price (High to Low)" option from the sort dropdown. |
49 |
| -Verify that items are sorted in descending order of their prices. |
50 |
| -6. Add a Single Item to the Cart |
51 |
| -Steps: |
52 |
| - |
53 |
| -Navigate to the inventory page. |
54 |
| -Click the "Add to Cart" button for a specific item. |
55 |
| -Verify the cart count increments to 1. |
56 |
| -Verify the item appears in the cart. |
57 |
| -7. Add Multiple Items to the Cart |
58 |
| -Steps: |
59 |
| - |
60 |
| -Navigate to the inventory page. |
61 |
| -Add multiple items to the cart by clicking "Add to Cart" for several items. |
62 |
| -Verify the cart count matches the number of items added. |
63 |
| -Verify all added items appear in the cart. |
64 |
| -8. Remove an Item from the Cart |
65 |
| -Steps: |
66 |
| - |
67 |
| -Add an item to the cart. |
68 |
| -Navigate to the cart page. |
69 |
| -Click the "Remove" button for the item. |
70 |
| -Verify the cart count decrements. |
71 |
| -Verify the item is no longer in the cart. |
72 |
| -9. Empty the Cart |
73 |
| -Steps: |
74 |
| - |
75 |
| -Add multiple items to the cart. |
76 |
| -Navigate to the cart page. |
77 |
| -Remove all items from the cart. |
78 |
| -Verify the cart count is 0. |
79 |
| -Verify the cart is empty. |
80 |
| -10. Verify Cart Persistence |
81 |
| -Steps: |
82 |
| - |
83 |
| -Add items to the cart. |
84 |
| -Reload the inventory page. |
85 |
| -Verify the cart count and items persist after the reload. |
86 |
| -11. Proceed to Checkout (Standard User) |
87 |
| -Steps: |
88 |
| - |
89 |
| -Add items to the cart. |
90 |
| -Click the cart icon and then "Checkout". |
91 |
| -Enter valid details (First Name, Last Name, Zip Code). |
92 |
| -Verify the user is redirected to the checkout overview page. |
93 |
| -12. Complete a Purchase |
94 |
| -Steps: |
95 |
| - |
96 |
| -Add items to the cart and proceed to checkout. |
97 |
| -Enter valid details on the checkout page. |
98 |
| -Click "Finish" on the checkout overview page. |
99 |
| -Verify the success message and that the cart is empty. |
100 |
| -13. Verify Checkout Validation Messages |
101 |
| -Steps: |
102 |
| - |
103 |
| -Add items to the cart and proceed to checkout. |
104 |
| -Leave the First Name, Last Name, or Zip Code fields blank. |
105 |
| -Click "Continue". |
106 |
| -Verify validation messages appear for required fields. |
107 |
| -14. Verify Removing an Item from Checkout Page |
108 |
| -Steps: |
109 |
| - |
110 |
| -Add multiple items to the cart. |
111 |
| -Proceed to checkout. |
112 |
| -Remove an item from the checkout overview page. |
113 |
| -Verify the total price updates accordingly. |
114 |
| -15. Verify Total Price Calculation |
115 |
| -Steps: |
116 |
| - |
117 |
| -Add multiple items to the cart. |
118 |
| -Proceed to the checkout overview page. |
119 |
| -Verify the total price matches the sum of item prices plus tax. |
120 |
| - |
121 |
| - |
| 1 | +# Automation using Cypress Automation Framework |
| 2 | + |
| 3 | +This project automates test scenarios for the website - [https://www.saucedemo.com/](https://www.saucedemo.com/). |
| 4 | + |
| 5 | +- **Framework**: Cypress Automation Framework |
| 6 | +- **Language**: JavaScript |
| 7 | +- **CI Workflows**: |
| 8 | + - **Pull Request Testing**: [pull-request-tester.yaml](https://github.com/ganeshhubale/swag-lab-ui-tests/blob/master/.github/workflows/pull-request-tester.yaml) |
| 9 | + - **Regression Testing**: [regression-cron.yaml](https://github.com/ganeshhubale/swag-lab-ui-tests/blob/master/.github/workflows/regression-cron.yaml) |
| 10 | + |
| 11 | +## Steps to Install Project and Run Tests Locally |
| 12 | + |
| 13 | +1. Install [Node.js](https://nodejs.org/). |
| 14 | +2. Clone the repository: |
| 15 | + ```bash |
| 16 | + git clone https://github.com/ganeshhubale/swag-lab-ui-tests.git |
| 17 | + ``` |
| 18 | +3. Install project dependencies: |
| 19 | + ```bash |
| 20 | + npm install . |
| 21 | + ``` |
| 22 | +4. Open Cypress and run the tests: |
| 23 | + ```bash |
| 24 | + ./node_modules/.bin/cypress open |
| 25 | + ``` |
| 26 | + or |
| 27 | + ```bash |
| 28 | + npx cypress open |
| 29 | + ``` |
| 30 | + |
| 31 | +## Test Cases Automated |
| 32 | + |
| 33 | +### 1. **Authentication Scenarios** |
| 34 | +- Login to Swag Labs application. |
| 35 | + - Should retain session after page reload. |
| 36 | + - Should show an error message on empty fields. |
| 37 | + - Should show an error message for invalid username and password. |
| 38 | +- Logout from Swag Labs application. |
| 39 | + - Should log out after session expires. |
| 40 | + |
| 41 | +### 2. **Verify Sorting Functionality** |
| 42 | +- **Name: A-Z** |
| 43 | + - Navigate to the inventory page. |
| 44 | + - Select "Name (A to Z)" from the sort dropdown. |
| 45 | + - Verify items are sorted alphabetically in ascending order by name. |
| 46 | +- **Name: Z-A** |
| 47 | + - Navigate to the inventory page. |
| 48 | + - Select "Name (Z to A)" from the sort dropdown. |
| 49 | + - Verify items are sorted alphabetically in descending order by name. |
| 50 | +- **Price: Low to High** |
| 51 | + - Navigate to the inventory page. |
| 52 | + - Select "Price (Low to High)" from the sort dropdown. |
| 53 | + - Verify items are sorted in ascending order of their prices. |
| 54 | +- **Price: High to Low** |
| 55 | + - Navigate to the inventory page. |
| 56 | + - Select "Price (High to Low)" from the sort dropdown. |
| 57 | + - Verify items are sorted in descending order of their prices. |
| 58 | + |
| 59 | +### 3. **Cart Functionality** |
| 60 | +- **Add a Single Item to the Cart** |
| 61 | + - Navigate to the inventory page. |
| 62 | + - Click "Add to Cart" for an item. |
| 63 | + - Verify the cart count increments to 1 and the item appears in the cart. |
| 64 | +- **Add Multiple Items to the Cart** |
| 65 | + - Navigate to the inventory page. |
| 66 | + - Add multiple items by clicking "Add to Cart." |
| 67 | + - Verify the cart count matches the number of added items. |
| 68 | + - Verify all items appear in the cart. |
| 69 | +- **Remove an Item from the Cart** |
| 70 | + - Add an item to the cart. |
| 71 | + - Navigate to the cart page. |
| 72 | + - Click "Remove" for the item. |
| 73 | + - Verify the cart count decrements and the item is removed. |
| 74 | +- **Empty the Cart** |
| 75 | + - Add multiple items to the cart. |
| 76 | + - Navigate to the cart page. |
| 77 | + - Remove all items from the cart. |
| 78 | + - Verify the cart count is 0 and the cart is empty. |
| 79 | +- **Verify Cart Persistence** |
| 80 | + - Add items to the cart. |
| 81 | + - Reload the inventory page. |
| 82 | + - Verify the cart count and items persist after the reload. |
| 83 | + |
| 84 | +### 4. **Checkout Functionality** |
| 85 | +- **Proceed to Checkout (Standard User)** |
| 86 | + - Add items to the cart. |
| 87 | + - Click the cart icon and then "Checkout." |
| 88 | + - Enter valid details (First Name, Last Name, Zip Code). |
| 89 | + - Verify redirection to the checkout overview page. |
| 90 | +- **Complete a Purchase** |
| 91 | + - Add items to the cart and proceed to checkout. |
| 92 | + - Enter valid details on the checkout page. |
| 93 | + - Click "Finish" on the checkout overview page. |
| 94 | + - Verify the success message and that the cart is empty. |
| 95 | +- **Verify Checkout Validation Messages** |
| 96 | + - Add items to the cart and proceed to checkout. |
| 97 | + - Leave required fields blank (e.g., First Name, Last Name, Zip Code). |
| 98 | + - Click "Continue." |
| 99 | + - Verify validation messages appear for required fields. |
| 100 | +- **Verify Removing an Item from Checkout Page** |
| 101 | + - Add multiple items to the cart. |
| 102 | + - Proceed to checkout. |
| 103 | + - Remove an item from the checkout overview page. |
| 104 | + - Verify the total price updates accordingly. |
| 105 | +- **Verify Total Price Calculation** |
| 106 | + - Add multiple items to the cart. |
| 107 | + - Proceed to the checkout overview page. |
| 108 | + - Verify the total price matches the sum of item prices plus tax. |
0 commit comments