Uploading DOM and Css snapshots
This commit is contained in:
Родитель
b8e56d2df9
Коммит
98b99e0459
|
@ -126,16 +126,16 @@ const parseHTMLAndKeepRelations = (selector: string) => {
|
|||
|
||||
export const parseWebPage = async (page: Page, filename: string, selector?: any) => {
|
||||
console.log('In paseWebPages');
|
||||
const type = filename.toLowerCase().includes("baseline") ? "BASELINE" : "CANDIDATE";
|
||||
// const type = filename.toLowerCase().includes("baseline") ? "BASELINE" : "CANDIDATE";
|
||||
|
||||
console.log(`\n\n******** PARSING DOM ${type} ********`);
|
||||
// console.log(`\n\n******** PARSING DOM ${type} ********`);
|
||||
const result = await page.evaluate(parseHTMLAndKeepRelations, selector);
|
||||
// console.log(`result: ${JSON.stringify(result, null, 2)}`);
|
||||
console.log(`\n\nHURRAYYY !!!...COMPLETED PARSING ${type}`);
|
||||
// console.log(`\n\nHURRAYYY !!!...COMPLETED PARSING ${type}`);
|
||||
console.log(`filename, selector: ${filename}, ${selector}`);
|
||||
if (!fs.existsSync("dist\\snapshots")){
|
||||
fs.mkdirSync("dist\\snapshots");
|
||||
}
|
||||
// if (!fs.existsSync("dist\\snapshots")){
|
||||
// fs.mkdirSync("dist\\snapshots");
|
||||
// }
|
||||
fs.writeFileSync(filename, JSON.stringify(result[0], null, 2), "utf-8");
|
||||
return result[0];
|
||||
}
|
|
@ -274,6 +274,7 @@ export class PlayWrightExecutor {
|
|||
await this.page.screenshot({
|
||||
path: screenshotPath,
|
||||
});
|
||||
await parseWebPage(this.page, screenshotPath.replace(".png", "") + ".snap", "") ;
|
||||
} catch (err) {
|
||||
console.error("ERROR: PAGE_SCREENSHOT: ", err.message);
|
||||
throw err;
|
||||
|
@ -286,11 +287,11 @@ export class PlayWrightExecutor {
|
|||
let element = await this.page.$(selector);
|
||||
if (await element.isVisible()) {
|
||||
let screenshotPath = this.getScreenshotPath(testName);
|
||||
await parseWebPage(this.page, screenshotPath.replace(".png", "").replace("screenshots\\", "snapshots\\") + ".snap" , selector)
|
||||
await this.checkIfPageIsBusy(screenshotPath);
|
||||
await element.screenshot({
|
||||
path: screenshotPath,
|
||||
});
|
||||
await parseWebPage(this.page, screenshotPath.replace(".png", "") + ".snap" , selector);
|
||||
} else {
|
||||
console.log("ERROR: Element NOT VISIBLE: CAPTURING PAGE");
|
||||
await this.makeScreenshot(testName);
|
||||
|
@ -339,7 +340,7 @@ export class PlayWrightExecutor {
|
|||
|
||||
private done = async () => {
|
||||
try {
|
||||
// await this.page.close();
|
||||
await this.page.close();
|
||||
} catch (err) {
|
||||
console.error("ERROR: completed steps: ", err.message);
|
||||
throw err;
|
||||
|
|
|
@ -52,7 +52,7 @@ export class StoryWrightProcessor {
|
|||
options.totalPartitions
|
||||
);
|
||||
}
|
||||
// await page.close();
|
||||
await page.close();
|
||||
console.log(`${stories.length} stories found`);
|
||||
let storyIndex = 0;
|
||||
let position = 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче