Skip to content

Commit

Permalink
New scripts for reports
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna Keesman committed Mar 1, 2024
1 parent e762b25 commit 5494493
Show file tree
Hide file tree
Showing 48 changed files with 5,720 additions and 137 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
fixtures
node_modules
node_modules
screenshots
other
49 changes: 25 additions & 24 deletions cypress/e2e/Webdriver/autocomplete-dropdown-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,34 @@ describe("Verify autocomplete dropdownlist via webdriveruni ", () => {
});

it("Select specific product via autocomplete list", () => {
cy.get("#myInput").type("A");
cy.get("#myInputautocomplete-list > *")
.each(($el, index, $list) => {
cy.get('#myInput').type('A')

cy.get('#myInputautocomplete-list > *').each(($el, index, $list) => {
const prod = $el.text();
const productToSelect = "Avocado";
const productToSelect = 'Avacado';

if(prod === productToSelect) {
//$el.click();
$el.trigger("click");

if (prod === productToSelect) {
$el.trigger("click");
cy.get("#submit-button").click();
cy.url().should("include", productToSelect);
cy.get('#submit-button').click();
cy.url().should('include', productToSelect)
}
})
.then(() => {
}).then(() => {
cy.get('#myInput').type('g')

cy.get("#myInput").type('g');

cy.get("#myInputautocomplete-list > *")
.each(($el, index, $list) => {
const prod = $el.text();
const productToSelect = 'Grapes';
cy.get('#myInputautocomplete-list > *').each(($el, index, $list) => {
const prod = $el.text();
const productToSelect = 'Grapes';

if (prod === productToSelect) {
$el.trigger("click");
cy.get("#submit-button").click();
cy.url().should("include", productToSelect);
}
});
});
});
if(prod === productToSelect) {
//$el.click();
$el.trigger("click");

cy.get('#submit-button').click();
cy.url().should('include', productToSelect)
}
})
})
});
})
2 changes: 1 addition & 1 deletion cypress/e2e/Webdriver/radio-buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("Verify radio buttons via webdriveruniversity ", () => {
cy.get('[value="lettuce"]').should('be.checked')
cy.get('[value="pumpkin"]').should('not.be.checked')

cy.get('[value="pumpkin"]').should('be.disabled')
cy.get('[value="cabbage"]').should('be.disabled')
});


Expand Down
107 changes: 107 additions & 0 deletions cypress/results/mochawesome/mochawesome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"stats": {
"suites": 1,
"tests": 1,
"passes": 1,
"pending": 0,
"failures": 0,
"start": "2024-03-01T16:19:47.637Z",
"end": "2024-03-01T16:19:51.202Z",
"duration": 3565,
"testsRegistered": 1,
"passPercent": 100,
"pendingPercent": 0,
"other": 0,
"hasOther": false,
"skipped": 0,
"hasSkipped": false
},
"results": [
{
"uuid": "1e445e89-7b35-412d-ab8d-7c943a9e28d5",
"title": "",
"fullFile": "cypress\\e2e\\AutomationTestStore\\add-multiple-items -to-basket.js",
"file": "cypress\\e2e\\AutomationTestStore\\add-multiple-items -to-basket.js",
"beforeHooks": [],
"afterHooks": [],
"tests": [],
"suites": [
{
"uuid": "c33e5ab2-84f0-4451-89e5-503c980edecf",
"title": "Add multiple items to basket ",
"fullFile": "",
"file": "",
"beforeHooks": [],
"afterHooks": [],
"tests": [
{
"title": "Add specific items to basket",
"fullTitle": "Add multiple items to basket Add specific items to basket",
"timedOut": null,
"duration": 2036,
"state": "passed",
"speed": "fast",
"pass": true,
"fail": false,
"pending": false,
"context": null,
"code": "_AutoStore_HairCare_PO.onAutoStore_HoirCare_PO.addHairCareProductToBasket();",
"err": {},
"uuid": "1dda1114-8572-4479-82d9-3e0af5ac14f8",
"parentUUID": "c33e5ab2-84f0-4451-89e5-503c980edecf",
"isHook": false,
"skipped": false
}
],
"suites": [],
"passes": [
"1dda1114-8572-4479-82d9-3e0af5ac14f8"
],
"failures": [],
"pending": [],
"skipped": [],
"duration": 2036,
"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",
"reportDir": "cypress/results/mochawesome",
"quite": true,
"overwrite": false,
"html": false,
"json": true
},
"version": "6.2.0"
}
}
}
145 changes: 145 additions & 0 deletions cypress/results/mochawesome/mochawesome_001.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"stats": {
"suites": 1,
"tests": 3,
"passes": 3,
"pending": 0,
"failures": 0,
"start": "2024-03-01T16:19:52.223Z",
"end": "2024-03-01T16:19:54.916Z",
"duration": 2693,
"testsRegistered": 3,
"passPercent": 100,
"pendingPercent": 0,
"other": 0,
"hasOther": false,
"skipped": 0,
"hasSkipped": false
},
"results": [
{
"uuid": "ad907122-9f12-48c4-b481-a1a6748ca26d",
"title": "",
"fullFile": "cypress\\e2e\\AutomationTestStore\\alias-invoke.js",
"file": "cypress\\e2e\\AutomationTestStore\\alias-invoke.js",
"beforeHooks": [],
"afterHooks": [],
"tests": [],
"suites": [
{
"uuid": "1e70490b-2c06-4f0f-b0bc-ef7781ee1788",
"title": "Alias and invoke",
"fullFile": "",
"file": "",
"beforeHooks": [],
"afterHooks": [],
"tests": [
{
"title": "Validate a specific hair care product ",
"fullTitle": "Alias and invoke Validate a specific hair care product ",
"timedOut": null,
"duration": 932,
"state": "passed",
"speed": "fast",
"pass": true,
"fail": false,
"pending": false,
"context": null,
"code": "cy.visit(\"https://automationteststore.com/\");\ncy.get(\"a[href*='product/category&path=']\").contains(\"Hair Care\").click();\ncy.get(\".fixed_wrapper .prdocutname\").eq(0).invoke(\"text\").as(\"productThumbnail\");\ncy.get(\"@productThumbnail\").its(\"length\").should(\"be.gt\", 5);\ncy.get(\"@productThumbnail\").should(\"include\", \"Seaweed Conditioner\");",
"err": {},
"uuid": "13dd41e1-c639-4c0f-a19c-ac35ca66bbba",
"parentUUID": "1e70490b-2c06-4f0f-b0bc-ef7781ee1788",
"isHook": false,
"skipped": false
},
{
"title": "Validate product thumbnail",
"fullTitle": "Alias and invoke Validate product thumbnail",
"timedOut": null,
"duration": 250,
"state": "passed",
"speed": "fast",
"pass": true,
"fail": false,
"pending": false,
"context": null,
"code": "cy.visit(\"https://automationteststore.com/\");\ncy.get(\".thumbnail\").as(\"productThumbnail\");\ncy.get(\"@productThumbnail\").should(\"have.length\", 16);\ncy.get(\"@productThumbnail\").find(\".productcart\").invoke(\"attr\", \"title\").should(\"include\", \"Add to Cart\");",
"err": {},
"uuid": "c67babd4-428f-4074-afb7-78ce5fabbc48",
"parentUUID": "1e70490b-2c06-4f0f-b0bc-ef7781ee1788",
"isHook": false,
"skipped": false
},
{
"title": "Calculate of normal and sale product",
"fullTitle": "Alias and invoke Calculate of normal and sale product",
"timedOut": null,
"duration": 425,
"state": "passed",
"speed": "fast",
"pass": true,
"fail": false,
"pending": false,
"context": null,
"code": "cy.visit(\"https://automationteststore.com/\");\ncy.get(\".thumbnail\").as(\"productThumbnail\");\n// cy.get(\"@productThumbnail\").find('.oneprice').each(($el, index, $list) => {\n// cy.log($el.text()) //logging all product price\ncy.get('.thumbnail').find('.oneprice').invoke('text').as('itemPrice');\ncy.get('.thumbnail').find('.pricenew').invoke('text').as('saleItemPrice');\nvar itemsTotal = 0;\ncy.get('@itemPrice').then($linkText => {\n var itemsPriceTotal = 0;\n var itemPrice = $linkText.split('$'); // so whenever there is dollar mark it will split the price form normal and sale \n var i;\n for (i = 0; i < itemPrice.length; i++) {\n //LOOP\n cy.log(itemPrice[i]); //Non sale items\n itemsPriceTotal += Number(itemPrice[i]); //it converts it to a number \n }\n itemsTotal += itemsPriceTotal;\n cy.log(\"Non sale price items total: \" + itemsPriceTotal);\n});\ncy.get('@saleItemPrice').then($linkText => {\n var saleItemsPrice = 0;\n var saleItemPrice = $linkText.split('$');\n var i;\n for (i = 0; i < saleItemPrice.length; i++) {\n cy.log(saleItemPrice[i]);\n saleItemsPrice += Number(saleItemPrice[i]);\n }\n itemsTotal += saleItemsPrice;\n cy.log(\"Sale price items total: \" + saleItemsPrice);\n}).then(() => {\n cy.log(\"The total price of all products: \" + itemsTotal);\n expect(itemsTotal).to.equal(660.5);\n});",
"err": {},
"uuid": "3a23d02e-5f06-42cd-aa53-15658efd7e80",
"parentUUID": "1e70490b-2c06-4f0f-b0bc-ef7781ee1788",
"isHook": false,
"skipped": false
}
],
"suites": [],
"passes": [
"13dd41e1-c639-4c0f-a19c-ac35ca66bbba",
"c67babd4-428f-4074-afb7-78ce5fabbc48",
"3a23d02e-5f06-42cd-aa53-15658efd7e80"
],
"failures": [],
"pending": [],
"skipped": [],
"duration": 1607,
"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",
"reportDir": "cypress/results/mochawesome",
"quite": true,
"overwrite": false,
"html": false,
"json": true
},
"version": "6.2.0"
}
}
}
Loading

0 comments on commit 5494493

Please sign in to comment.