cypress_task 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/.github/workflows/cyemial.yaml +98 -0
  2. package/Daily_Tracker.xlsx +0 -0
  3. package/Mannual_testcases.xlsx +0 -0
  4. package/clean_mochawesome.js +26 -0
  5. package/cleanupOutput.js +16 -0
  6. package/cleanupReports.js +15 -0
  7. package/cypress/e2e/Cart_Testcases/07_verify_Adding_single_item_to_cart.cy.js +40 -0
  8. package/cypress/e2e/Cart_Testcases/08_verify_removing_item_from_the_cart.cy.js +55 -0
  9. package/cypress/e2e/Cart_Testcases/09_verify_updating_of_cart_after_adding_multiple_item.cy.js +75 -0
  10. package/cypress/e2e/Checkout_Testcases/04_verify_complete_successful_purchase_of_single_item.cy.js +83 -0
  11. package/cypress/e2e/Checkout_Testcases/05_verify_checkout_with_missing_firstname_fails.cy.js +78 -0
  12. package/cypress/e2e/Checkout_Testcases/06_verify_user_can_cancel_checkout_and redirected_to_cart.cy.js +79 -0
  13. package/cypress/e2e/Login_Testcases/01_Verify_Valid_Login.cy.js +30 -0
  14. package/cypress/e2e/Login_Testcases/02_Verify_Invalid_Login_by_wrong_password.cy.js +29 -0
  15. package/cypress/e2e/Login_Testcases/03_Verify_Lockout_user_failed_login.cy.js +30 -0
  16. package/cypress/e2e/Regression_Suit/10_Verify_successful_purchase_multiple_items.cy.js +98 -0
  17. package/cypress/e2e/Regression_Suit/11_testfail.cy.js +98 -0
  18. package/cypress/e2e/Smoke_Suit/SMK001_Verify user can log in with valid credentials.cy.js +32 -0
  19. package/cypress/e2e/Smoke_Suit/SMK002_Verify product list loads after login.cy.js +34 -0
  20. package/cypress/e2e/Smoke_Suit/SMK003_Verify user can add a product to cart.cy.js +49 -0
  21. package/cypress/failed-specs.json +3 -0
  22. package/cypress/fixtures/Cart/01_Adding_product_to_cart.json +6 -0
  23. package/cypress/fixtures/Cart/02_Removing_product_from_cart.json +6 -0
  24. package/cypress/fixtures/Cart/03_Updating_of_cart_icon.json +7 -0
  25. package/cypress/fixtures/Checkout/01_purchase_of_single_product.json +10 -0
  26. package/cypress/fixtures/Checkout/02_missing_info_fail_purchase.json +8 -0
  27. package/cypress/fixtures/Checkout/03_cancel_purcahse_redirect_to_cart.json +9 -0
  28. package/cypress/fixtures/Login_Data/01_Valid_login.json +5 -0
  29. package/cypress/fixtures/Login_Data/02_Invalid_Login.json +6 -0
  30. package/cypress/fixtures/Login_Data/03_Lockout_user.json +6 -0
  31. package/cypress/fixtures/regression_data/01_regression_data.json +12 -0
  32. package/cypress/fixtures/smoke_test_data/SMK001_Verify user can log in with valid credentials.json +5 -0
  33. package/cypress/fixtures/smoke_test_data/SMK002_Verify product list loads after login.json +6 -0
  34. package/cypress/fixtures/smoke_test_data/SMK003_Verify user can add a product to cart.json +6 -0
  35. package/cypress/results/fail_2025-12-19T160847+0530-11_testfail.json +110 -0
  36. package/cypress/results/fail_2025-12-19T160936+0530-11_testfail.json +110 -0
  37. package/cypress/results/pass_2025-12-19T160750+0530-04_verify_complete_successful_purchase_of_single_item.json +106 -0
  38. package/cypress/results/pass_2025-12-19T160756+0530-05_verify_checkout_with_missing_firstname_fails.json +106 -0
  39. package/cypress/results/pass_2025-12-19T160802+0530-06_verify_user_can_cancel_checkout_and redirected_to_cart.json +106 -0
  40. package/cypress/results/pass_2025-12-19T160806+0530-07_verify_Adding_single_item_to_cart.json +106 -0
  41. package/cypress/results/pass_2025-12-19T160809+0530-08_verify_removing_item_from_the_cart.json +106 -0
  42. package/cypress/results/pass_2025-12-19T160814+0530-09_verify_updating_of_cart_after_adding_multiple_item.json +106 -0
  43. package/cypress/results/pass_2025-12-19T160822+0530-10_Verify_successful_purchase_multiple_items.json +106 -0
  44. package/cypress/results/pass_2025-12-19T160850+0530-SMK001_Verify user can log in with valid credentials.json +106 -0
  45. package/cypress/results/pass_2025-12-19T160854+0530-SMK002_Verify product list loads after login.json +106 -0
  46. package/cypress/results/pass_2025-12-19T160857+0530-SMK003_Verify user can add a product to cart.json +106 -0
  47. package/cypress/results/pass_2025-12-19T160900+0530-01_Verify_Valid_Login.json +106 -0
  48. package/cypress/results/pass_2025-12-19T160903+0530-02_Verify_Invalid_Login_by_wrong_password.json +106 -0
  49. package/cypress/results/pass_2025-12-19T160905+0530-03_Verify_Lockout_user_failed_login.json +106 -0
  50. package/cypress/screenshots/11_testfail.cy.js/11_failed -- 02_failed (failed) (attempt 2).png +0 -0
  51. package/cypress/screenshots/11_testfail.cy.js/11_failed -- 02_failed (failed).png +0 -0
  52. package/cypress/support/Locators/Common_Locators.js +57 -0
  53. package/cypress/support/commands.js +25 -0
  54. package/cypress/support/e2e.js +43 -0
  55. package/cypress/support/encryption.js +45 -0
  56. package/cypress/support/env.js +31 -0
  57. package/cypress/support/interface.js +6 -0
  58. package/cypress/support/pageObjects/CartPage.js +56 -0
  59. package/cypress/support/pageObjects/CheckoutPage.js +111 -0
  60. package/cypress/support/pageObjects/GenerateRandomData.js +62 -0
  61. package/cypress/support/pageObjects/Homepage.js +92 -0
  62. package/cypress/support/pageObjects/navigationPage.js +44 -0
  63. package/cypress.config.js +44 -0
  64. package/mochawesome-report/assets/MaterialIcons-Regular.woff +0 -0
  65. package/mochawesome-report/assets/MaterialIcons-Regular.woff2 +0 -0
  66. package/mochawesome-report/assets/app.css +14 -0
  67. package/mochawesome-report/assets/app.js +2 -0
  68. package/mochawesome-report/assets/app.js.LICENSE.txt +55 -0
  69. package/mochawesome-report/assets/roboto-light-webfont.woff +0 -0
  70. package/mochawesome-report/assets/roboto-light-webfont.woff2 +0 -0
  71. package/mochawesome-report/assets/roboto-medium-webfont.woff +0 -0
  72. package/mochawesome-report/assets/roboto-medium-webfont.woff2 +0 -0
  73. package/mochawesome-report/assets/roboto-regular-webfont.woff +0 -0
  74. package/mochawesome-report/assets/roboto-regular-webfont.woff2 +0 -0
  75. package/mochawesome-report/output.html +2 -0
  76. package/output.json +864 -0
  77. package/package.json +43 -0
  78. package/run-parallel-cypress.js +57 -0
  79. package/runAllSteps.js +47 -0
  80. package/syncTestResultsToExcel.js +219 -0
@@ -0,0 +1,98 @@
1
+ name: Cypress Tests
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ schedule:
6
+ - cron: '30 3 * * *' # 9:00 AM IST
7
+ push:
8
+ branches:
9
+ - main
10
+ pull_request:
11
+ branches:
12
+ - main
13
+
14
+ jobs:
15
+ cypress-tests:
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - name: Checkout code
20
+ uses: actions/checkout@v3
21
+
22
+ - name: Set up Node.js 18
23
+ uses: actions/setup-node@v3
24
+ with:
25
+ node-version: '18'
26
+
27
+ - name: Install dependencies cleanly
28
+ run: |
29
+ rm -rf node_modules package-lock.json
30
+ npm install
31
+
32
+ - name: Generate Excel report
33
+ if: always()
34
+ run: npm run Run_and_update_Result_sheet
35
+
36
+ - name: Generate combined Mochawesome report (JSON + HTML)
37
+ if: always()
38
+ run: |
39
+ npm run getMochawesomeReport
40
+ npm run getHTMLReport
41
+
42
+ - name: Install jq for JSON parsing
43
+ if: always()
44
+ run: sudo apt-get update && sudo apt-get install -y jq
45
+
46
+ - name: Extract test summary stats from output.json
47
+ if: always()
48
+ id: extract_results
49
+ run: |
50
+ if [ -f output.json ]; then
51
+ total_passed=$(jq '[.results[].suites[] | .. | objects | select(has("state")) | select(.state == "passed")] | length' output.json)
52
+ total_failed=$(jq '[.results[].suites[] | .. | objects | select(has("state")) | select(.state == "failed")] | length' output.json)
53
+ total_pending=$(jq '[.results[].suites[] | .. | objects | select(has("state")) | select(.state == "pending")] | length' output.json)
54
+ failed_cases=$(jq -r '[.results[].suites[] | .. | objects | select(has("state")) | select(.state == "failed") | .title] | join(", ")' output.json)
55
+ total_tests=$((total_passed + total_failed + total_pending))
56
+
57
+ echo "TOTAL_TESTS=$total_tests" >> $GITHUB_ENV
58
+ echo "TOTAL_PASSED=$total_passed" >> $GITHUB_ENV
59
+ echo "TOTAL_FAILED=$total_failed" >> $GITHUB_ENV
60
+ echo "TOTAL_PENDING=$total_pending" >> $GITHUB_ENV
61
+ echo "FAILED_CASES=$failed_cases" >> $GITHUB_ENV
62
+ else
63
+ echo "output.json not found, skipping stats extraction."
64
+ fi
65
+
66
+ - name: Get current date for email subject
67
+ run: echo "DATE=$(date +'%d-%m-%Y')" >> $GITHUB_ENV
68
+
69
+ - name: Send test results via email with attachments
70
+ if: always()
71
+ uses: dawidd6/action-send-mail@v3
72
+ with:
73
+ server_address: smtp.gmail.com
74
+ server_port: 465
75
+ secure: true
76
+ username: siddhantsourceandcode@gmail.com
77
+ password: jfgt antr xuzj dish
78
+ to: vaibhavps0595@gmail.com, siddhantgadakh121@gmail.com, jadhavamol.j2@gmail.com
79
+ from: siddhantsourceandcode@gmail.com
80
+ subject: "Cypress Test Results - Run #${{ github.run_number }} on ${{ env.DATE }}"
81
+ attachments: |
82
+ output.json
83
+ mochawesome-report/output.html
84
+ Daily_Tracker.xlsx
85
+ body: |
86
+ Dear Team,
87
+
88
+ Here are the Cypress test results from the latest run:
89
+ - Total Testcases: ${{ env.TOTAL_TESTS }}
90
+ - Passed: ${{ env.TOTAL_PASSED }}
91
+ - Failed: ${{ env.TOTAL_FAILED }}
92
+ - Pending: ${{ env.TOTAL_PENDING }}
93
+ - Failed Test Cases: ${{ env.FAILED_CASES }}
94
+
95
+ Please find the attached reports.
96
+
97
+ Regards,
98
+ Automation Team
Binary file
Binary file
@@ -0,0 +1,26 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const folderPath = path.join(__dirname, 'mochawesome-report');
5
+
6
+ if (fs.existsSync(folderPath)) {
7
+ const files = fs.readdirSync(folderPath);
8
+
9
+ files.forEach(file => {
10
+ const filePath = path.join(folderPath, file);
11
+ const stats = fs.lstatSync(filePath);
12
+
13
+ if (stats.isDirectory()) {
14
+ // Delete folder recursively
15
+ fs.rmSync(filePath, { recursive: true, force: true });
16
+ console.log(`Deleted folder: ${filePath}`);
17
+ } else {
18
+ // Delete file
19
+ fs.unlinkSync(filePath);
20
+ console.log(`Deleted file: ${filePath}`);
21
+ }
22
+ });
23
+ console.log('✅ Mochawesome report folder cleaned.');
24
+ } else {
25
+ console.log('⚠️ Folder not found:', folderPath);
26
+ }
@@ -0,0 +1,16 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ // Construct the absolute path to output.json
5
+ const filePath = path.join(__dirname, 'output.json');
6
+
7
+ if (fs.existsSync(filePath)) {
8
+ try {
9
+ fs.unlinkSync(filePath);
10
+ console.log('✅ output.json deleted.');
11
+ } catch (error) {
12
+ console.error('❌ Error deleting output.json:', error);
13
+ }
14
+ } else {
15
+ console.log('⚠️ File not found:', filePath);
16
+ }
@@ -0,0 +1,15 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const folderPath = path.join('./cypress/results');
5
+
6
+ if (fs.existsSync(folderPath)) {
7
+ const files = fs.readdirSync(folderPath);
8
+ files.forEach(file => {
9
+ const filePath = path.join(folderPath, file);
10
+ fs.unlinkSync(filePath);
11
+ });
12
+ console.log('✅ Old report files deleted.');
13
+ } else {
14
+ console.log('⚠️ Folder not found:', folderPath);
15
+ }
@@ -0,0 +1,40 @@
1
+ import { NavigationPage } from "../../support/pageObjects/navigationPage"
2
+ import { homepage } from "../../support/pageObjects/Homepage"
3
+
4
+ let User
5
+ let Bagpack
6
+ describe("07_verify_Adding_single_item_to_cart", function () {
7
+
8
+
9
+ beforeEach(function () {
10
+ cy.fixture("Cart/01_Adding_product_to_cart.json").then((data) => {
11
+ this.data = data
12
+ User = this.data.User
13
+ Bagpack = this.data.Bagpack
14
+
15
+ }).then(() => {
16
+ cy.clearCookies()
17
+ cy.clearLocalStorage()
18
+ //navigate to the url
19
+ NavigationPage.navigateToUrl()
20
+ //login with valid user
21
+ NavigationPage.loginWithCredentials(User)
22
+ //verify the home is visble
23
+ homepage.verifyHomepage()
24
+ })
25
+ })
26
+
27
+ it("01_verify_Adding_single_item_to_cart", function () {
28
+
29
+ //add Sauce Labs Backpack in the cart
30
+ homepage.AddingItemtoCart(Bagpack)
31
+ //verify the item count added to cart
32
+ homepage.verifyCartIconQuantity(1)
33
+ //verify remove item button is visible for the same product
34
+ homepage.verifyRemovefromCartButton(Bagpack)
35
+ })
36
+
37
+ afterEach(() => {
38
+ homepage.logout()
39
+ })
40
+ })
@@ -0,0 +1,55 @@
1
+ import { NavigationPage } from "../../support/pageObjects/navigationPage"
2
+ import { homepage } from "../../support/pageObjects/Homepage"
3
+ import { cartpage } from "../../support/pageObjects/CartPage"
4
+
5
+ let User
6
+ let Bike_light
7
+ describe("08_verify_removing_item_from_the_cart", function () {
8
+
9
+
10
+ beforeEach(function () {
11
+ cy.fixture("Cart/02_Removing_product_from_cart.json").then((data) => {
12
+ this.data = data
13
+ User = this.data.User
14
+ Bike_light = this.data.Bike_light
15
+
16
+ }).then(() => {
17
+ cy.clearCookies()
18
+ cy.clearLocalStorage()
19
+ //navigate to the url
20
+ NavigationPage.navigateToUrl()
21
+ //login with valid user
22
+ NavigationPage.loginWithCredentials(User)
23
+ //verify the home is visble
24
+ homepage.verifyHomepage()
25
+ })
26
+ })
27
+
28
+ it("02_verify_removing_item_from_the_cart", function () {
29
+
30
+ //add Sauce Labs Bike Light in the cart
31
+ homepage.AddingItemtoCart(Bike_light)
32
+ //verify the item count added to cart
33
+ homepage.verifyCartIconQuantity(1)
34
+ //verify remove item button is visible for the same product
35
+ homepage.verifyRemovefromCartButton(Bike_light)
36
+ //click on the cart icon
37
+ homepage.ClickonCartBtn()
38
+ //verify the product is added in to the cart
39
+ cartpage.verifytheCartpageOpened()
40
+ //verify the item is added to the cart
41
+ cartpage.VerifyAddedItemtoCart(Bike_light)
42
+ //verify the item count added to cart
43
+ homepage.verifyCartIconQuantity(1)
44
+ //remove the item form the container
45
+ cartpage.RemoveItemfromCart(Bike_light)
46
+ //verify the item count added to cart
47
+ homepage.verifyCartIconQuantity(0)
48
+ //verify no item present in the cart
49
+ cartpage.VerifyAddedItemtoCart(Bike_light)
50
+ })
51
+
52
+ afterEach(() => {
53
+ homepage.logout()
54
+ })
55
+ })
@@ -0,0 +1,75 @@
1
+ import { NavigationPage } from "../../support/pageObjects/navigationPage"
2
+ import { homepage } from "../../support/pageObjects/Homepage"
3
+ import { cartpage } from "../../support/pageObjects/CartPage"
4
+
5
+ let User
6
+ let Bike_light
7
+ let Bagpack
8
+ describe("09_verify_updating_of_cart_after_adding_multiple_item", function () {
9
+
10
+ beforeEach(function () {
11
+ cy.fixture("Cart/03_Updating_of_cart_icon.json").then((data) => {
12
+ this.data = data
13
+ User = this.data.User
14
+ Bike_light = this.data.Bike_light
15
+ Bagpack = this.data.Bagpack
16
+
17
+ }).then(() => {
18
+ cy.clearCookies()
19
+ cy.clearLocalStorage()
20
+ //navigate to the url
21
+ NavigationPage.navigateToUrl()
22
+ //login with valid user
23
+ NavigationPage.loginWithCredentials(User)
24
+ //verify the home is visble
25
+ homepage.verifyHomepage()
26
+ })
27
+ })
28
+
29
+ it("03_verify_updating_of_cart_after_adding_multiple_item", function () {
30
+
31
+ //verify the no item count added to cart
32
+ homepage.verifyCartIconQuantity(0)
33
+ //add Sauce Labs Bike Light in the cart
34
+ homepage.AddingItemtoCart(Bike_light)
35
+ //verify the item count added to cart
36
+ homepage.verifyCartIconQuantity(1)
37
+ cy.wait(1000)
38
+ //add Sauce Labs Backpack in the cart
39
+ homepage.AddingItemtoCart(Bagpack)
40
+ //verify the item count added to cart
41
+ homepage.verifyCartIconQuantity(2)
42
+ //click on the cart icon
43
+ homepage.ClickonCartBtn()
44
+ //verify the product is added in to the cart
45
+ cartpage.verifytheCartpageOpened()
46
+ //verify the item is added to the cart
47
+ cartpage.VerifyAddedItemtoCart(Bagpack)
48
+ //verify the item count added to cart
49
+ homepage.verifyCartIconQuantity(2)
50
+ //verify the item is added to the cart
51
+ cartpage.VerifyAddedItemtoCart(Bike_light)
52
+ //verify remove item button is visible for the same product
53
+ homepage.verifyRemovefromCartButton(Bike_light)
54
+ //verify remove item button is visible for the same product
55
+ homepage.verifyRemovefromCartButton(Bagpack)
56
+ //remove the item form the container
57
+ cartpage.RemoveItemfromCart(Bike_light)
58
+ //verify the item count added to cart
59
+ homepage.verifyCartIconQuantity(1)
60
+ //verify bike light item not present in the cart
61
+ cartpage.VerifyAddedItemtoCart(Bike_light)
62
+ //remove the item form the container
63
+ cartpage.RemoveItemfromCart(Bagpack)
64
+ //remove the item form the container
65
+ cartpage.RemoveItemfromCart(Bike_light)
66
+ //verify the item count added to cart
67
+ homepage.verifyCartIconQuantity(0)
68
+ //verify no item present in the cart
69
+ cartpage.VerifyAddedItemtoCart(Bike_light)
70
+ })
71
+
72
+ afterEach(() => {
73
+ homepage.logout()
74
+ })
75
+ })
@@ -0,0 +1,83 @@
1
+ import { NavigationPage } from "../../support/pageObjects/navigationPage"
2
+ import { homepage } from "../../support/pageObjects/Homepage"
3
+ import { cartpage } from "../../support/pageObjects/CartPage"
4
+ import { checkout_page } from "../../support/pageObjects/CheckoutPage"
5
+ import { Common_Locators } from "../../support/Locators/Common_Locators"
6
+ import { generateRandomData } from "../../support/pageObjects/GenerateRandomData"
7
+
8
+ let User
9
+ let Bike_light, Price;
10
+ let checkout_Info_Parameter
11
+ let First_Name = generateRandomData.genraterandomString(5, {includeUppercase:true,includeLowercase :true,includeNumbers :false,includeSymbols : false, excludeSimilar: true });
12
+ let Last_Name = generateRandomData.genraterandomString(5, {includeUppercase:true,includeLowercase :true,includeNumbers :false,includeSymbols : false, excludeSimilar: true });
13
+ let Zip_Code = generateRandomData.genraterandomString(5, {includeUppercase:false,includeLowercase :false,includeNumbers :true,includeSymbols : false, excludeSimilar: true });
14
+
15
+ describe("04_verify_complete_successful_purchase_of_single_item", function () {
16
+
17
+ beforeEach(function () {
18
+ cy.fixture("Checkout/01_purchase_of_single_product.json").then((data) => {
19
+ this.data = data
20
+ User = this.data.User
21
+ Bike_light = this.data.Bike_light
22
+ Price = this.data.Price
23
+ checkout_Info_Parameter = {
24
+ [Common_Locators.Checkout_page_locators.firstname]: First_Name,
25
+ [Common_Locators.Checkout_page_locators.lastname]: Last_Name,
26
+ [Common_Locators.Checkout_page_locators.zip]:Zip_Code,
27
+ }
28
+
29
+
30
+ }).then(() => {
31
+ cy.clearCookies()
32
+ cy.clearLocalStorage()
33
+ //navigate to the url
34
+ NavigationPage.navigateToUrl()
35
+ //login with valid user
36
+ NavigationPage.loginWithCredentials(User)
37
+ //verify the home is visble
38
+ homepage.verifyHomepage()
39
+ })
40
+ })
41
+
42
+ it("01_verify_complete_successful_purchase_of_single_item", function () {
43
+
44
+ //verify the no item count added to cart
45
+ homepage.verifyCartIconQuantity(0)
46
+ //add Sauce Labs Bike Light in the cart
47
+ homepage.AddingItemtoCart(Bike_light)
48
+ //click on the cart icon
49
+ homepage.ClickonCartBtn()
50
+ //verify the product is added in to the cart
51
+ cartpage.verifytheCartpageOpened()
52
+ //verify the item is added to the cart
53
+ cartpage.VerifyAddedItemtoCart(Bike_light)
54
+ //verify the item count added to cart
55
+ homepage.verifyCartIconQuantity(1)
56
+ //click on checkout button
57
+ cartpage.clickOnCheckoutButton()
58
+ //verify checkout page open
59
+ checkout_page.verifytheCheckoutpageOpened()
60
+ //enter your information for checkout
61
+ checkout_page.enterDetailsforCheckout(checkout_Info_Parameter)
62
+ //verify the item count added to cart
63
+ homepage.verifyCartIconQuantity(1)
64
+ //click on Continue button
65
+ checkout_page.clickOnContinueButton()
66
+ //verify the item is added to the cart
67
+ checkout_page.VerifyProductNameAndPriceInFinalStep(Bike_light, Price)
68
+ //verify total Price to pay after tax
69
+ checkout_page.verifyTotalPriceToPay()
70
+ //click on Finish Button
71
+ checkout_page.clickOnFinishButton()
72
+ //verify Purchase was successful
73
+ checkout_page.VerifyPurchase_Success()
74
+ //verify the item count added to cart
75
+ homepage.verifyCartIconQuantity(0)
76
+
77
+
78
+ })
79
+
80
+ afterEach(() => {
81
+ homepage.logout()
82
+ })
83
+ })
@@ -0,0 +1,78 @@
1
+ import { NavigationPage } from "../../support/pageObjects/navigationPage"
2
+ import { homepage } from "../../support/pageObjects/Homepage"
3
+ import { cartpage } from "../../support/pageObjects/CartPage"
4
+ import { checkout_page } from "../../support/pageObjects/CheckoutPage"
5
+ import { Datacells } from "../../support/interface"
6
+ import { Common_Locators } from "../../support/Locators/Common_Locators"
7
+ import { generateRandomData } from "../../support/pageObjects/GenerateRandomData"
8
+
9
+ let User
10
+ let Bike_light
11
+ let checkout_Info_Parameter
12
+
13
+ let Last_Name = generateRandomData.genraterandomString(5, {includeUppercase:true,includeLowercase :true,includeNumbers :false,includeSymbols : false, excludeSimilar: true });
14
+ let Zip_Code = generateRandomData.genraterandomString(5, {includeUppercase:false,includeLowercase :false,includeNumbers :true,includeSymbols : false, excludeSimilar: true });
15
+
16
+ describe("05_verify_checkout_with_missing_firstname_fails.cy.js", function () {
17
+
18
+ beforeEach(function () {
19
+ cy.fixture("Checkout/02_missing_info_fail_purchase.json").then((data) => {
20
+ this.data = data
21
+ User = this.data.User
22
+ Bike_light = this.data.Bike_light
23
+ checkout_Info_Parameter = {
24
+ [Common_Locators.Checkout_page_locators.lastname]: Last_Name,
25
+ [Common_Locators.Checkout_page_locators.zip]: Zip_Code,
26
+ }
27
+
28
+
29
+ }).then(() => {
30
+ cy.clearCookies()
31
+ cy.clearLocalStorage()
32
+ //navigate to the url
33
+ NavigationPage.navigateToUrl()
34
+ //login with valid user
35
+ NavigationPage.loginWithCredentials(User)
36
+ //verify the home is visble
37
+ homepage.verifyHomepage()
38
+ })
39
+ })
40
+
41
+ it("02_verify_checkout_with_missing_firstname_fails.cy.js", function () {
42
+
43
+ //verify the no item count added to cart
44
+ homepage.verifyCartIconQuantity(0)
45
+ //add Sauce Labs Bike Light in the cart
46
+ homepage.AddingItemtoCart(Bike_light)
47
+ //click on the cart icon
48
+ homepage.ClickonCartBtn()
49
+ //verify the product is added in to the cart
50
+ cartpage.verifytheCartpageOpened()
51
+ //verify the item is added to the cart
52
+ cartpage.VerifyAddedItemtoCart(Bike_light)
53
+ //verify the item count added to cart
54
+ homepage.verifyCartIconQuantity(1)
55
+ //click on checkout button
56
+ cartpage.clickOnCheckoutButton()
57
+ //verify checkout page open
58
+ checkout_page.verifytheCheckoutpageOpened()
59
+ //enter your information for checkout
60
+ checkout_page.enterDetailsforCheckout(checkout_Info_Parameter)
61
+ //verify the item count added to cart
62
+ homepage.verifyCartIconQuantity(1)
63
+ //click on Continue button
64
+ checkout_page.clickOnContinueButton()
65
+ //verify error is displayed
66
+ checkout_page.VerifyError_Pop_up()
67
+ //verify Item Still added to cart
68
+ homepage.verifyCartIconQuantity(1)
69
+ //verify still on checkout page
70
+ checkout_page.verifytheCheckoutpageOpened()
71
+
72
+
73
+ })
74
+
75
+ afterEach(() => {
76
+ homepage.logout()
77
+ })
78
+ })
@@ -0,0 +1,79 @@
1
+ import { NavigationPage } from "../../support/pageObjects/navigationPage"
2
+ import { homepage } from "../../support/pageObjects/Homepage"
3
+ import { cartpage } from "../../support/pageObjects/CartPage"
4
+ import { checkout_page } from "../../support/pageObjects/CheckoutPage"
5
+ import { Datacells } from "../../support/interface"
6
+ import { Common_Locators } from "../../support/Locators/Common_Locators"
7
+ import { generateRandomData } from "../../support/pageObjects/GenerateRandomData"
8
+
9
+ let User
10
+ let Bike_light
11
+
12
+ let checkout_Info_Parameter
13
+
14
+ let First_Name = generateRandomData.genraterandomString(5, {includeUppercase:true,includeLowercase :true,includeNumbers :false,includeSymbols : false, excludeSimilar: true });
15
+ let Last_Name = generateRandomData.genraterandomString(5, {includeUppercase:true,includeLowercase :true,includeNumbers :false,includeSymbols : false, excludeSimilar: true });
16
+ let Zip_Code = generateRandomData.genraterandomString(5, {includeUppercase:false,includeLowercase :false,includeNumbers :true,includeSymbols : false, excludeSimilar: true });
17
+
18
+ describe("06_verify_user_can_cancel_checkout_and redirected_to_cart.cy.js", function () {
19
+
20
+ beforeEach(function () {
21
+ cy.fixture("Checkout/03_cancel_purcahse_redirect_to_cart.json").then((data) => {
22
+ this.data = data
23
+ User = this.data.User
24
+ Bike_light = this.data.Bike_light
25
+ checkout_Info_Parameter = {
26
+ [Common_Locators.Checkout_page_locators.firstname]:First_Name,
27
+ [Common_Locators.Checkout_page_locators.lastname]: Last_Name,
28
+ [Common_Locators.Checkout_page_locators.zip]: Zip_Code,
29
+ }
30
+
31
+
32
+ }).then(() => {
33
+ cy.clearCookies()
34
+ cy.clearLocalStorage()
35
+ //navigate to the url
36
+ NavigationPage.navigateToUrl()
37
+ //login with valid user
38
+ NavigationPage.loginWithCredentials(User)
39
+ //verify the home is visble
40
+ homepage.verifyHomepage()
41
+ })
42
+ })
43
+
44
+ it("03_verify_user_can_cancel_checkout_and redirected_to_cart.cy.js", function () {
45
+
46
+ //verify the no item count added to cart
47
+ homepage.verifyCartIconQuantity(0)
48
+ //add Sauce Labs Bike Light in the cart
49
+ homepage.AddingItemtoCart(Bike_light)
50
+ //click on the cart icon
51
+ homepage.ClickonCartBtn()
52
+ //verify the product is added in to the cart
53
+ cartpage.verifytheCartpageOpened()
54
+ //verify the item is added to the cart
55
+ cartpage.VerifyAddedItemtoCart(Bike_light)
56
+ //verify the item count added to cart
57
+ homepage.verifyCartIconQuantity(1)
58
+ //click on checkout button
59
+ cartpage.clickOnCheckoutButton()
60
+ //verify checkout page open
61
+ checkout_page.verifytheCheckoutpageOpened()
62
+ //enter your information for checkout
63
+ checkout_page.enterDetailsforCheckout(checkout_Info_Parameter)
64
+ //verify the item count added to cart
65
+ homepage.verifyCartIconQuantity(1)
66
+ //click on cancel button
67
+ checkout_page.clickOnCancelButton()
68
+ //verify the product is added in to the cart
69
+ cartpage.verifytheCartpageOpened()
70
+ //verify the item is added to the cart
71
+ cartpage.VerifyAddedItemtoCart(Bike_light)
72
+ //verify the item count added to cart
73
+ homepage.verifyCartIconQuantity(1)
74
+ })
75
+
76
+ afterEach(() => {
77
+ homepage.logout()
78
+ })
79
+ })
@@ -0,0 +1,30 @@
1
+ import { NavigationPage } from "../../support/pageObjects/navigationPage"
2
+ import { homepage } from "../../support/pageObjects/Homepage"
3
+
4
+ let User
5
+ describe("01_Verify_Valid_Login", function () {
6
+
7
+
8
+ beforeEach(function () {
9
+ cy.fixture("Login_Data/01_Valid_login.json").then((data) => {
10
+ this.data = data
11
+ User = this.data.User
12
+
13
+ })
14
+ cy.clearCookies()
15
+ cy.clearLocalStorage()
16
+ //navigate to the url
17
+ NavigationPage.navigateToUrl()
18
+
19
+ })
20
+
21
+ it("01_Verify_Valid_Login", function () {
22
+ //login with valid user
23
+ NavigationPage.loginWithCredentials(User)
24
+ //verify the home is visble
25
+ homepage.verifyHomepage()
26
+ })
27
+ afterEach(() => {
28
+ homepage.logout()
29
+ })
30
+ })
@@ -0,0 +1,29 @@
1
+ import { NavigationPage } from "../../support/pageObjects/navigationPage"
2
+ import { homepage } from "../../support/pageObjects/Homepage"
3
+
4
+ let Invalid_User
5
+ let ErrorText
6
+ describe("02_Verify_Invalid_Login_by_wrong_password", function () {
7
+
8
+
9
+ beforeEach(function () {
10
+ cy.fixture("Login_Data/02_Invalid_Login.json").then((data) => {
11
+ this.data = data
12
+ Invalid_User = this.data.Invalid_User
13
+ ErrorText = this.data.ErrorText
14
+
15
+ })
16
+ cy.clearCookies()
17
+ cy.clearLocalStorage()
18
+ //navigate to the url
19
+ NavigationPage.navigateToUrl()
20
+
21
+ })
22
+
23
+ it("02_Verify_Invalid_Login_by_wrong_password", function () {
24
+ //login with valid user
25
+ NavigationPage.loginWithCredentials(Invalid_User)
26
+ //verify the home is visble
27
+ NavigationPage.verifyLoginErrorPopup(ErrorText)
28
+ })
29
+ })
@@ -0,0 +1,30 @@
1
+ import { NavigationPage } from "../../support/pageObjects/navigationPage"
2
+ import { homepage } from "../../support/pageObjects/Homepage"
3
+
4
+ let Locket_out_User
5
+ let ErrorText
6
+ describe("03_Verify_Lockout_user_failed_login", function () {
7
+
8
+
9
+ beforeEach(function () {
10
+ cy.fixture("Login_Data/03_Lockout_user.json").then((data) => {
11
+ this.data = data
12
+ Locket_out_User = this.data.Locket_out_User
13
+ ErrorText = this.data.ErrorText
14
+ })
15
+ cy.clearCookies()
16
+ cy.clearLocalStorage()
17
+ //navigate to the url
18
+ NavigationPage.navigateToUrl()
19
+
20
+ })
21
+
22
+ it("03_Verify_Lockout_user_failed_login", function () {
23
+ //login with valid user
24
+ NavigationPage.loginWithCredentials(Locket_out_User)
25
+ //verify the home is visble
26
+ NavigationPage.verifyLoginErrorPopup(ErrorText)
27
+ })
28
+
29
+
30
+ })