Skip to content

Commit

Permalink
Merge pull request #49 from AbuBakkar32/abu-bakkar
Browse files Browse the repository at this point in the history
API Call
  • Loading branch information
AbuBakkar32 authored Jun 28, 2024
2 parents 419b03c + 3980c3d commit 4d033a3
Show file tree
Hide file tree
Showing 34 changed files with 2,076 additions and 0 deletions.
115 changes: 115 additions & 0 deletions cypress/reports/.jsons/mochawesome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"stats": {
"suites": 1,
"tests": 1,
"passes": 0,
"pending": 0,
"failures": 1,
"start": "2024-06-28T12:22:22.433Z",
"end": "2024-06-28T12:23:38.516Z",
"duration": 76083,
"testsRegistered": 1,
"passPercent": 0,
"pendingPercent": 0,
"other": 0,
"hasOther": false,
"skipped": 0,
"hasSkipped": false
},
"results": [
{
"uuid": "34181922-e6e6-4e72-a284-c330db63fc91",
"title": "",
"fullFile": "cypress\\e2e\\add_product_cart.cy.js",
"file": "cypress\\e2e\\add_product_cart.cy.js",
"beforeHooks": [],
"afterHooks": [],
"tests": [],
"suites": [
{
"uuid": "8d0cf83d-baf8-4adb-b11c-8afd34c32f06",
"title": "Test Case 12: Add Products in Cart",
"fullFile": "",
"file": "",
"beforeHooks": [],
"afterHooks": [],
"tests": [
{
"title": "Add Products in Cart",
"fullTitle": "Test Case 12: Add Products in Cart Add Products in Cart",
"timedOut": null,
"duration": 60799,
"state": "failed",
"speed": null,
"pass": false,
"fail": true,
"pending": false,
"context": "{\n \"title\": \"cypress-mochawesome-reporter-screenshots\",\n \"value\": [\n [\n \"\\\\add_product_cart.cy.js\\\\Test Case 12 Add Products in Cart -- Add Products in Cart (failed) (2).png\"\n ]\n ]\n}",
"code": "// Step 1: Launch browser\n// Cypress automatically launches the browser\n// Step 2: Navigate to url 'http://automationexercise.com'\ncy.visit('http://automationexercise.com');\n// Step 3: Verify that home page is visible successfully\ncy.url().should('include', 'automationexercise');\n// Step 4: Click 'Products' button\ncy.get('#header > div > div > div > div.col-sm-8 > div > ul > li:nth-child(2) > a').click();\n// Step 5: Hover over first product and click 'Add to cart'\ncy.xpath('/html/body/section[2]/div/div/div[2]/div/div[2]/div/div[1]').trigger('mouseover').xpath('/html/body/section[2]/div/div/div[2]/div/div[2]/div/div[1]/div[1]/a').click();\n// Step 6: Click 'Continue Shopping' button\ncy.get('#cartModal > div > div > div.modal-footer > button').click();\n// Step 7: Hover over second product and click 'Add to cart'\ncy.xpath('/html/body/section[2]/div/div/div[2]/div/div[3]/div/div[1]').trigger('mouseover').xpath('/html/body/section[2]/div/div/div[2]/div/div[3]/div/div[1]/div[1]/a').click();\ncy.get('#cartModal > div > div > div.modal-footer > button').click();\n// Step 8: Click 'View Cart' button\ncy.get('#header > div > div > div > div.col-sm-8 > div > ul > li:nth-child(3) > a').click();\n// Step 9: Verify both products are added to Cart\ncy.get('#cart_info_table > tbody').find('.cart_product').should('have.length', 2);\n// Step 10: Verify their prices, quantity and total price\n// Assuming each product has a 'price' class and the total price has a 'total-price' class\ncy.get('tbody > tr').each($el => {\n const price = parseFloat($el.find('.cart_price').text().replace(/[^0-9.-]+/g, \"\")) * 1000;\n const quantity = parseInt($el.find('.cart_quantity').text());\n const totalPrice = price * quantity;\n // Find total price of each product and match is equal to price * quantity\n const total = parseFloat($el.find('.cart_total_price').text().replace(/[^0-9.-]+/g, \"\")) * 1000;\n expect(total).to.equal(totalPrice);\n});",
"err": {
"message": "CypressError: Timed out after waiting `60000ms` for your remote page to load.\n\nYour page did not fire its `load` event within `60000ms`.\n\nYou can try increasing the `pageLoadTimeout` value in `cypress.config.js` to wait longer.\n\nBrowsers will not fire the `load` event until all stylesheets and scripts are done downloading.\n\nWhen this `load` event occurs, Cypress will continue running commands.",
"estack": "CypressError: Timed out after waiting `60000ms` for your remote page to load.\n\nYour page did not fire its `load` event within `60000ms`.\n\nYou can try increasing the `pageLoadTimeout` value in `cypress.config.js` to wait longer.\n\nBrowsers will not fire the `load` event until all stylesheets and scripts are done downloading.\n\nWhen this `load` event occurs, Cypress will continue running commands.\n at timedOutWaitingForPageLoad (https://automationexercise.com/__cypress/runner/cypress_runner.js:130511:64)\n at <unknown> (https://automationexercise.com/__cypress/runner/cypress_runner.js:131497:16)\n at tryCatcher (https://automationexercise.com/__cypress/runner/cypress_runner.js:1807:23)\n at <unknown> (https://automationexercise.com/__cypress/runner/cypress_runner.js:4186:41)\n at tryCatcher (https://automationexercise.com/__cypress/runner/cypress_runner.js:1807:23)\n at Promise._settlePromiseFromHandler (https://automationexercise.com/__cypress/runner/cypress_runner.js:1519:31)\n at Promise._settlePromise (https://automationexercise.com/__cypress/runner/cypress_runner.js:1576:18)\n at Promise._settlePromise0 (https://automationexercise.com/__cypress/runner/cypress_runner.js:1621:10)\n at Promise._settlePromises (https://automationexercise.com/__cypress/runner/cypress_runner.js:1697:18)\n at _drainQueueStep (https://automationexercise.com/__cypress/runner/cypress_runner.js:2407:12)\n at _drainQueue (https://automationexercise.com/__cypress/runner/cypress_runner.js:2400:9)\n at Async._drainQueues (https://automationexercise.com/__cypress/runner/cypress_runner.js:2416:5)\n at Async.drainQueues (https://automationexercise.com/__cypress/runner/cypress_runner.js:2286:14)\nFrom Your Spec Code:\n at Context.eval (webpack:///./cypress/e2e/add_product_cart.cy.js:7:11)",
"diff": null
},
"uuid": "56937d6b-4873-4018-b4d4-438ebdd32f89",
"parentUUID": "8d0cf83d-baf8-4adb-b11c-8afd34c32f06",
"isHook": false,
"skipped": false
}
],
"suites": [],
"passes": [],
"failures": [
"56937d6b-4873-4018-b4d4-438ebdd32f89"
],
"pending": [],
"skipped": [],
"duration": 60799,
"root": false,
"rootEmpty": false,
"_timeout": 2000
}
],
"passes": [],
"failures": [],
"pending": [],
"skipped": [],
"duration": 0,
"root": true,
"rootEmpty": true,
"_timeout": 2000
}
],
"meta": {
"mocha": {
"version": "7.0.1"
},
"mochawesome": {
"options": {
"quiet": false,
"reportFilename": "mochawesome",
"saveHtml": false,
"saveJson": true,
"consoleReporter": "spec",
"useInlineDiffs": false,
"code": true
},
"version": "7.1.3"
},
"marge": {
"options": {
"id": "default",
"charts": true,
"reportPageTitle": "custom-title",
"reportDir": "cypress\\reports\\.jsons",
"embeddedScreenshots": true,
"inlineAssets": true,
"saveAllAttempts": true,
"overwrite": false,
"html": false,
"json": true
},
"version": "6.2.0"
}
}
}
111 changes: 111 additions & 0 deletions cypress/reports/.jsons/mochawesome_001.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"stats": {
"suites": 1,
"tests": 1,
"passes": 1,
"pending": 0,
"failures": 0,
"start": "2024-06-28T12:23:45.830Z",
"end": "2024-06-28T12:25:26.058Z",
"duration": 100228,
"testsRegistered": 1,
"passPercent": 100,
"pendingPercent": 0,
"other": 0,
"hasOther": false,
"skipped": 0,
"hasSkipped": false
},
"results": [
{
"uuid": "b2d1dbfc-f1d7-4f14-bd9d-c33198eb3f4e",
"title": "",
"fullFile": "cypress\\e2e\\add_review_on_product.cy.js",
"file": "cypress\\e2e\\add_review_on_product.cy.js",
"beforeHooks": [],
"afterHooks": [],
"tests": [],
"suites": [
{
"uuid": "8618d823-c014-4dfe-8cff-1bca15e2dbf9",
"title": "Add review on product",
"fullFile": "",
"file": "",
"beforeHooks": [],
"afterHooks": [],
"tests": [
{
"title": "adds a review and verifies success message",
"fullTitle": "Add review on product adds a review and verifies success message",
"timedOut": null,
"duration": 92624,
"state": "passed",
"speed": "slow",
"pass": true,
"fail": false,
"pending": false,
"context": null,
"code": "cy.visit('http://automationexercise.com');\n// Click on 'Products' button\ncy.get('a[href=\"/products\"]').click();\n// Verify user is navigated to ALL PRODUCTS page\ncy.contains('All Products').should('be.visible');\n// Select a product (replace with logic to choose a product)\n// ... your logic to select a product ...\n// Click on 'View Product' button\ncy.get('a[href=\"/product_details/1\"]').click(); // Assuming the first product\n// Verify 'Write Your Review' is visible\ncy.contains('Write Your Review').should('be.visible');\n// Enter name, email and review\nconst reviewerName = 'Test User';\nconst reviewerEmail = '[email protected]';\nconst reviewText = 'This is a great product!';\ncy.get('#name').type(reviewerName);\ncy.get('#email').type(reviewerEmail);\ncy.get('#button-review').type(reviewText);\n// Verify success message 'Thank you for your review.'\ncy.get('#review-section div > span').should('contain', 'Thank you for your review.');",
"err": {},
"uuid": "28ee1eeb-8125-43e9-8ddc-a791605d7266",
"parentUUID": "8618d823-c014-4dfe-8cff-1bca15e2dbf9",
"isHook": false,
"skipped": false
}
],
"suites": [],
"passes": [
"28ee1eeb-8125-43e9-8ddc-a791605d7266"
],
"failures": [],
"pending": [],
"skipped": [],
"duration": 92624,
"root": false,
"rootEmpty": false,
"_timeout": 2000
}
],
"passes": [],
"failures": [],
"pending": [],
"skipped": [],
"duration": 0,
"root": true,
"rootEmpty": true,
"_timeout": 2000
}
],
"meta": {
"mocha": {
"version": "7.0.1"
},
"mochawesome": {
"options": {
"quiet": false,
"reportFilename": "mochawesome",
"saveHtml": false,
"saveJson": true,
"consoleReporter": "spec",
"useInlineDiffs": false,
"code": true
},
"version": "7.1.3"
},
"marge": {
"options": {
"id": "default",
"charts": true,
"reportPageTitle": "custom-title",
"reportDir": "cypress\\reports\\.jsons",
"embeddedScreenshots": true,
"inlineAssets": true,
"saveAllAttempts": true,
"overwrite": false,
"html": false,
"json": true
},
"version": "6.2.0"
}
}
}
111 changes: 111 additions & 0 deletions cypress/reports/.jsons/mochawesome_002.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"stats": {
"suites": 1,
"tests": 1,
"passes": 1,
"pending": 0,
"failures": 0,
"start": "2024-06-28T12:25:31.573Z",
"end": "2024-06-28T12:25:57.948Z",
"duration": 26375,
"testsRegistered": 1,
"passPercent": 100,
"pendingPercent": 0,
"other": 0,
"hasOther": false,
"skipped": 0,
"hasSkipped": false
},
"results": [
{
"uuid": "880ade31-e320-4640-9fee-e5d1fffa50ca",
"title": "",
"fullFile": "cypress\\e2e\\add_to_cart_from_recommended_items.cy.js",
"file": "cypress\\e2e\\add_to_cart_from_recommended_items.cy.js",
"beforeHooks": [],
"afterHooks": [],
"tests": [],
"suites": [
{
"uuid": "6da04ade-bea3-481d-a98d-fea2643f8e17",
"title": "Add to cart from Recommended items",
"fullFile": "",
"file": "",
"beforeHooks": [],
"afterHooks": [],
"tests": [
{
"title": "adds a recommended product to cart and verifies",
"fullTitle": "Add to cart from Recommended items adds a recommended product to cart and verifies",
"timedOut": null,
"duration": 18132,
"state": "passed",
"speed": "slow",
"pass": true,
"fail": false,
"pending": false,
"context": null,
"code": "cy.visit('http://automationexercise.com');\n// Scroll to bottom of page\ncy.scrollTo('bottom');\n// Verify 'RECOMMENDED ITEMS' are visible\ncy.contains('recommended items').should('be.visible');\n// Click on 'Add To Cart' on the first Recommended product (adjust selector if needed)\ncy.get('#recommended-item-carousel div > a').first().click({\n force: true\n}); // Assuming \"Add To Cart\" is next to product title\ncy.wait(2000);\n// Click on 'Continue Shopping' button\ncy.get('#cartModal > div > div > div.modal-footer > button').click({\n force: true\n});\ncy.wait(1000);\n// Click on 'View Cart' button\ncy.get('.nav a[href=\"/view_cart\"]').click();\n// Verify that product is displayed in cart page and display none\ncy.get('#cart_info_table').should('be.visible').and('not.have.css', 'display', 'none');",
"err": {},
"uuid": "1d6ec18e-8d74-4307-911b-2cff5fed109f",
"parentUUID": "6da04ade-bea3-481d-a98d-fea2643f8e17",
"isHook": false,
"skipped": false
}
],
"suites": [],
"passes": [
"1d6ec18e-8d74-4307-911b-2cff5fed109f"
],
"failures": [],
"pending": [],
"skipped": [],
"duration": 18132,
"root": false,
"rootEmpty": false,
"_timeout": 2000
}
],
"passes": [],
"failures": [],
"pending": [],
"skipped": [],
"duration": 0,
"root": true,
"rootEmpty": true,
"_timeout": 2000
}
],
"meta": {
"mocha": {
"version": "7.0.1"
},
"mochawesome": {
"options": {
"quiet": false,
"reportFilename": "mochawesome",
"saveHtml": false,
"saveJson": true,
"consoleReporter": "spec",
"useInlineDiffs": false,
"code": true
},
"version": "7.1.3"
},
"marge": {
"options": {
"id": "default",
"charts": true,
"reportPageTitle": "custom-title",
"reportDir": "cypress\\reports\\.jsons",
"embeddedScreenshots": true,
"inlineAssets": true,
"saveAllAttempts": true,
"overwrite": false,
"html": false,
"json": true
},
"version": "6.2.0"
}
}
}
Loading

0 comments on commit 4d033a3

Please sign in to comment.