forked from mate-academy/layout_product-cards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Робенко Олександр Олександрович
authored and
Робенко Олександр Олександрович
committed
Aug 31, 2023
0 parents
commit ba650a9
Showing
30 changed files
with
6,046 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"><title>Product cards</title><link rel="stylesheet" href="styles.43d14d00.css"><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com"><link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet"></head><body> <div class="card" data-qa="card"> <img src="imac.2690641a.jpeg" alt="APPLE A1419 iMac 27 Retina 5K Monoblock" class="card__img"> <h2 class="card__title">APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)</h2> <h2 class="card__code">Product code: 195434</h2> <div class="card__stars"> <div class="stars"> <div class="stars__star"></div> <div class="stars__star"></div> <div class="stars__star"></div> <div class="stars__star"></div> <div class="stars__star"></div> </div> <p class="card__review-text">Reviews: 5</p> </div> <div class="card__price"> <p class="card__price-text">Price:</p> <p class="card__price-amaunt">$2,199</p> </div> <div class="card__button"> <a href="#" class="card__link" data-qa="hover"> Buy </a> </div> </div> </body></html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"testSuite": "BackstopJS", | ||
"tests": [ | ||
{ | ||
"pair": { | ||
"reference": "..\\bitmaps_reference\\Card_with_data-qa_card.png", | ||
"test": "..\\bitmaps_test\\20230831-154723\\Card_with_data-qa_card.png", | ||
"selector": "[data-qa=\"card\"]", | ||
"fileName": "Card_with_data-qa_card.png", | ||
"label": "Card with data-qa_card", | ||
"requireSameDimensions": false, | ||
"misMatchThreshold": 1, | ||
"url": "http://localhost:3001/index.html", | ||
"referenceUrl": "https://mate-academy.github.io/layout_solutions/product-cards/", | ||
"expect": 0, | ||
"viewportLabel": "tablet_h", | ||
"diff": { | ||
"isSameDimensions": false, | ||
"dimensionDifference": { | ||
"width": 0, | ||
"height": -2 | ||
}, | ||
"misMatchPercentage": "0.89", | ||
"analysisTime": 11 | ||
} | ||
}, | ||
"status": "pass" | ||
}, | ||
{ | ||
"pair": { | ||
"reference": "..\\bitmaps_reference\\Link_with_data-qa_hover.png", | ||
"test": "..\\bitmaps_test\\20230831-154723\\Link_with_data-qa_hover.png", | ||
"selector": "[data-qa=\"card\"]", | ||
"fileName": "Link_with_data-qa_hover.png", | ||
"label": "Link with data-qa_hover", | ||
"requireSameDimensions": false, | ||
"misMatchThreshold": 1, | ||
"url": "http://localhost:3001/index.html", | ||
"referenceUrl": "https://mate-academy.github.io/layout_solutions/product-cards/", | ||
"expect": 0, | ||
"viewportLabel": "tablet_h", | ||
"diff": { | ||
"isSameDimensions": false, | ||
"dimensionDifference": { | ||
"width": 0, | ||
"height": -2 | ||
}, | ||
"misMatchPercentage": "0.91", | ||
"analysisTime": 14 | ||
} | ||
}, | ||
"status": "pass" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"domain": ".www.yourdomain.com", | ||
"path": "/", | ||
"name": "yourCookieName", | ||
"value": "yourCookieValue", | ||
"expirationDate": 1798790400, | ||
"hostOnly": false, | ||
"httpOnly": false, | ||
"secure": false, | ||
"session": false, | ||
"sameSite": "no_restriction" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module.exports = async (page, scenario) => { | ||
var hoverSelector = scenario.hoverSelectors || scenario.hoverSelector; | ||
var clickSelector = scenario.clickSelectors || scenario.clickSelector; | ||
var keyPressSelector = scenario.keyPressSelectors || scenario.keyPressSelector; | ||
var scrollToSelector = scenario.scrollToSelector; | ||
var postInteractionWait = scenario.postInteractionWait; // selector [str] | ms [int] | ||
|
||
if (keyPressSelector) { | ||
for (const keyPressSelectorItem of [].concat(keyPressSelector)) { | ||
await page.waitFor(keyPressSelectorItem.selector); | ||
await page.type(keyPressSelectorItem.selector, keyPressSelectorItem.keyPress); | ||
} | ||
} | ||
|
||
if (hoverSelector) { | ||
for (const hoverSelectorIndex of [].concat(hoverSelector)) { | ||
await page.waitFor(hoverSelectorIndex); | ||
await page.hover(hoverSelectorIndex); | ||
} | ||
} | ||
|
||
if (clickSelector) { | ||
for (const clickSelectorIndex of [].concat(clickSelector)) { | ||
await page.waitFor(clickSelectorIndex); | ||
await page.click(clickSelectorIndex); | ||
} | ||
} | ||
|
||
if (postInteractionWait) { | ||
await page.waitFor(postInteractionWait); | ||
} | ||
|
||
if (scrollToSelector) { | ||
await page.waitFor(scrollToSelector); | ||
await page.evaluate(scrollToSelector => { | ||
document.querySelector(scrollToSelector).scrollIntoView(); | ||
}, scrollToSelector); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var fs = require('fs'); | ||
|
||
module.exports = async (page, scenario) => { | ||
var cookies = []; | ||
var cookiePath = scenario.cookiePath; | ||
|
||
// READ COOKIES FROM FILE IF EXISTS | ||
if (fs.existsSync(cookiePath)) { | ||
cookies = JSON.parse(fs.readFileSync(cookiePath)); | ||
} | ||
|
||
// MUNGE COOKIE DOMAIN | ||
cookies = cookies.map(cookie => { | ||
cookie.url = 'https://' + cookie.domain; | ||
delete cookie.domain; | ||
return cookie; | ||
}); | ||
|
||
// SET COOKIES | ||
const setCookies = async () => { | ||
return Promise.all( | ||
cookies.map(async (cookie) => { | ||
await page.setCookie(cookie); | ||
}) | ||
); | ||
}; | ||
await setCookies(); | ||
console.log('Cookie state restored with:', JSON.stringify(cookies, null, 2)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = async (page, scenario, vp) => { | ||
await require('./loadCookies')(page, scenario); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = async (page, scenario, vp) => { | ||
console.log('SCENARIO > ' + scenario.label); | ||
await require('./clickAndHoverHelper')(page, scenario); | ||
|
||
// add more ready handlers here... | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
report({ | ||
"testSuite": "BackstopJS", | ||
"tests": [ | ||
{ | ||
"pair": { | ||
"reference": "..\\bitmaps_reference\\Card_with_data-qa_card.png", | ||
"test": "..\\bitmaps_test\\20230831-154723\\Card_with_data-qa_card.png", | ||
"selector": "[data-qa=\"card\"]", | ||
"fileName": "Card_with_data-qa_card.png", | ||
"label": "Card with data-qa_card", | ||
"requireSameDimensions": false, | ||
"misMatchThreshold": 1, | ||
"url": "http://localhost:3001/index.html", | ||
"referenceUrl": "https://mate-academy.github.io/layout_solutions/product-cards/", | ||
"expect": 0, | ||
"viewportLabel": "tablet_h", | ||
"diff": { | ||
"isSameDimensions": false, | ||
"dimensionDifference": { | ||
"width": 0, | ||
"height": -2 | ||
}, | ||
"misMatchPercentage": "0.89", | ||
"analysisTime": 11 | ||
} | ||
}, | ||
"status": "pass" | ||
}, | ||
{ | ||
"pair": { | ||
"reference": "..\\bitmaps_reference\\Link_with_data-qa_hover.png", | ||
"test": "..\\bitmaps_test\\20230831-154723\\Link_with_data-qa_hover.png", | ||
"selector": "[data-qa=\"card\"]", | ||
"fileName": "Link_with_data-qa_hover.png", | ||
"label": "Link with data-qa_hover", | ||
"requireSameDimensions": false, | ||
"misMatchThreshold": 1, | ||
"url": "http://localhost:3001/index.html", | ||
"referenceUrl": "https://mate-academy.github.io/layout_solutions/product-cards/", | ||
"expect": 0, | ||
"viewportLabel": "tablet_h", | ||
"diff": { | ||
"isSameDimensions": false, | ||
"dimensionDifference": { | ||
"width": 0, | ||
"height": -2 | ||
}, | ||
"misMatchPercentage": "0.91", | ||
"analysisTime": 14 | ||
} | ||
}, | ||
"status": "pass" | ||
} | ||
] | ||
}); |
Oops, something went wrong.