Skip to content

Commit

Permalink
make build
Browse files Browse the repository at this point in the history
  • Loading branch information
SaXoNG committed Dec 16, 2024
0 parents commit 7fc0ad5
Show file tree
Hide file tree
Showing 36 changed files with 2,669 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.15fa37e5.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions index.15fa37e5.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions index.html
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, initial-scale=1.0"><title>Calendar</title><link rel="stylesheet" href="index.15fa37e5.css"></head><body> <div class="calendar calendar--month-length--31 calendar--start-day--sun"> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></div> <div class="calendar__day"></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.
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.
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.
115 changes: 115 additions & 0 deletions report/bitmaps_test/20241217-005954/report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"testSuite": "BackstopJS",
"tests": [
{
"pair": {
"reference": "..\\bitmaps_reference\\Calendar_initial_state.png",
"test": "..\\bitmaps_test\\20241217-005954\\Calendar_initial_state.png",
"selector": "body",
"fileName": "Calendar_initial_state.png",
"label": "Calendar initial state",
"requireSameDimensions": false,
"misMatchThreshold": 0.5,
"url": "http://localhost:3001/index.html",
"referenceUrl": "https://mate-academy.github.io/layout_solutions/calendar/",
"expect": 0,
"viewportLabel": "tablet_h",
"diff": {
"isSameDimensions": true,
"dimensionDifference": {
"width": 0,
"height": 0
},
"rawMisMatchPercentage": 2.5262196858723955,
"misMatchPercentage": "2.53",
"analysisTime": 66
},
"diffImage": "..\\bitmaps_test\\20241217-005954\\failed_diff_Calendar_initial_state.png"
},
"status": "fail"
},
{
"pair": {
"reference": "..\\bitmaps_reference\\Calendar_day_with_hover_effect.png",
"test": "..\\bitmaps_test\\20241217-005954\\Calendar_day_with_hover_effect.png",
"selector": "body",
"fileName": "Calendar_day_with_hover_effect.png",
"label": "Calendar day with hover effect",
"requireSameDimensions": false,
"misMatchThreshold": 0.5,
"url": "http://localhost:3001/index.html",
"referenceUrl": "https://mate-academy.github.io/layout_solutions/calendar/",
"expect": 0,
"viewportLabel": "tablet_h",
"diff": {
"isSameDimensions": true,
"dimensionDifference": {
"width": 0,
"height": 0
},
"rawMisMatchPercentage": 2.7187347412109375,
"misMatchPercentage": "2.72",
"analysisTime": 67
},
"diffImage": "..\\bitmaps_test\\20241217-005954\\failed_diff_Calendar_day_with_hover_effect.png"
},
"status": "fail"
},
{
"pair": {
"reference": "..\\bitmaps_reference\\Calendar_starting_from_Wednesday.png",
"test": "..\\bitmaps_test\\20241217-005954\\Calendar_starting_from_Wednesday.png",
"selector": "body",
"fileName": "Calendar_starting_from_Wednesday.png",
"label": "Calendar starting from Wednesday",
"requireSameDimensions": false,
"misMatchThreshold": 0.5,
"url": "http://localhost:3001/index.html",
"referenceUrl": "https://mate-academy.github.io/layout_solutions/calendar/",
"expect": 0,
"viewportLabel": "tablet_h",
"engineErrorMsg": "Waiting for selector `.calendar--start-day-sun` failed: Waiting failed: 30000ms exceeded",
"diff": {
"isSameDimensions": false,
"dimensionDifference": {
"width": -792,
"height": -588
},
"rawMisMatchPercentage": 5.2913665771484375,
"misMatchPercentage": "5.29",
"analysisTime": 51
},
"diffImage": "..\\bitmaps_test\\20241217-005954\\failed_diff_Calendar_starting_from_Wednesday.png"
},
"status": "fail"
},
{
"pair": {
"reference": "..\\bitmaps_reference\\Calendar_with_length_of_29_days.png",
"test": "..\\bitmaps_test\\20241217-005954\\Calendar_with_length_of_29_days.png",
"selector": "body",
"fileName": "Calendar_with_length_of_29_days.png",
"label": "Calendar with length of 29 days",
"requireSameDimensions": false,
"misMatchThreshold": 0.5,
"url": "http://localhost:3001/index.html",
"referenceUrl": "https://mate-academy.github.io/layout_solutions/calendar/",
"expect": 0,
"viewportLabel": "tablet_h",
"engineErrorMsg": "Waiting for selector `.calendar--month-length-31` failed: Waiting failed: 30000ms exceeded",
"diff": {
"isSameDimensions": false,
"dimensionDifference": {
"width": -792,
"height": -588
},
"rawMisMatchPercentage": 5.2913665771484375,
"misMatchPercentage": "5.29",
"analysisTime": 52
},
"diffImage": "..\\bitmaps_test\\20241217-005954\\failed_diff_Calendar_with_length_of_29_days.png"
},
"status": "fail"
}
]
}
14 changes: 14 additions & 0 deletions report/engine_scripts/cookies.json
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"
}
]
39 changes: 39 additions & 0 deletions report/engine_scripts/puppet/clickAndHoverHelper.js
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.waitForSelector(keyPressSelectorItem.selector);
await page.type(keyPressSelectorItem.selector, keyPressSelectorItem.keyPress);
}
}

if (hoverSelector) {
for (const hoverSelectorIndex of [].concat(hoverSelector)) {
await page.waitForSelector(hoverSelectorIndex);
await page.hover(hoverSelectorIndex);
}
}

if (clickSelector) {
for (const clickSelectorIndex of [].concat(clickSelector)) {
await page.waitForSelector(clickSelectorIndex);
await page.click(clickSelectorIndex);
}
}

if (postInteractionWait) {
await new Promise(resolve => setTimeout(resolve, postInteractionWait));
}

if (scrollToSelector) {
await page.waitForSelector(scrollToSelector);
await page.evaluate(scrollToSelector => {
document.querySelector(scrollToSelector).scrollIntoView();
}, scrollToSelector);
}
};
32 changes: 32 additions & 0 deletions report/engine_scripts/puppet/loadCookies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
let fs = require('fs');

module.exports = async (page, scenario) => {
let cookies = [];
let 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));
};
3 changes: 3 additions & 0 deletions report/engine_scripts/puppet/onBefore.js
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);
};
48 changes: 48 additions & 0 deletions report/engine_scripts/puppet/onReady.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module.exports = async (page, scenario, vp) => {
console.log('SCENARIO > ' + scenario.label);
await require('./clickAndHoverHelper')(page, scenario);

const {
label,
postDOMChangeWait = 0,
} = scenario;

switch (label) {
case 'Calendar starting from Wednesday': {
await page.waitForSelector('.calendar');
await page.waitForSelector('.calendar--start-day-sun');

await page.evaluate(() => {
const calendarElement = document.querySelector('.calendar');
const newClassName = calendarElement.className.replace('calendar--start-day-sun', 'calendar--start-day-wed');

calendarElement.className = newClassName;
});

await page.waitForSelector('.calendar--start-day-wed');
await new Promise(resolve => setTimeout(resolve, postDOMChangeWait));

break;
}

case 'Calendar with length of 29 days': {
await page.waitForSelector('.calendar');
await page.waitForSelector('.calendar--month-length-31');

await page.evaluate(() => {
const calendarElement = document.querySelector('.calendar');
const newClassName = calendarElement.className.replace('calendar--month-length-31', 'calendar--month-length-29');

calendarElement.className = newClassName;
});

await page.waitForSelector('.calendar--month-length-29');
await new Promise(resolve => setTimeout(resolve, postDOMChangeWait));

break;
}

default:
break;
}
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added report/html_report/assets/fonts/Lato-Bold.ttf
Binary file not shown.
Binary file added report/html_report/assets/fonts/Lato-Regular.ttf
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.
Loading

0 comments on commit 7fc0ad5

Please sign in to comment.