Adding functionality to skip specific stories to skip DOM parsing
This commit is contained in:
Родитель
58c5df0f9d
Коммит
55240b832e
|
@ -275,7 +275,10 @@ export class PlayWrightExecutor {
|
|||
path: screenshotPath,
|
||||
});
|
||||
console.log(`saving snapshot`);
|
||||
if(this.options.parseDom){
|
||||
|
||||
console.log(`this.options.skipDomParsing: ${this.options.skipDomParsing}`);
|
||||
console.log(`testName: ${this.ssNamePrefix.split(" ")[0]}`);
|
||||
if(this.options.parseDom && !this.options.skipDomParsing.includes(this.ssNamePrefix.split(" ")[0])){
|
||||
await parseWebPage(this.page, screenshotPath.replace(".png", "") + ".txt", "html", this.options.compressDom);
|
||||
}
|
||||
} catch (err) {
|
||||
|
@ -294,7 +297,9 @@ export class PlayWrightExecutor {
|
|||
await element.screenshot({
|
||||
path: screenshotPath,
|
||||
});
|
||||
if(this.options.parseDom){
|
||||
console.log(`this.options.skipDomParsing: ${this.options.skipDomParsing}`);
|
||||
console.log(`testName: ${this.ssNamePrefix.split(" ")[0]}`);
|
||||
if(this.options.parseDom && !this.options.skipDomParsing.includes(this.ssNamePrefix.split(" ")[0])){
|
||||
await parseWebPage(this.page, screenshotPath.replace(".png", "") + ".txt" , selector, this.options.compressDom);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -5,6 +5,7 @@ export interface StoryWrightOptions {
|
|||
url: string;
|
||||
screenShotDestPath: string;
|
||||
browsers: Array<string>;
|
||||
skipDomParsing: Array<string>;
|
||||
parseDom: boolean;
|
||||
compressDom: boolean;
|
||||
headless: boolean;
|
||||
|
|
11
src/main.ts
11
src/main.ts
|
@ -36,6 +36,16 @@ const args = argv
|
|||
},
|
||||
choices: [BrowserName.Chromium, BrowserName.Firefox, BrowserName.Webkit],
|
||||
})
|
||||
.option("skipDomParsing", {
|
||||
alias: "skipDomParsing",
|
||||
default: [],
|
||||
describe: "Comma seperated list of Story names to skip DOM parsing",
|
||||
nargs: 1,
|
||||
type: "array",
|
||||
coerce: (array) => {
|
||||
return array.flatMap((v) => v.split(","));
|
||||
},
|
||||
})
|
||||
.option("parseDom", {
|
||||
alias: "parseDom",
|
||||
default: false,
|
||||
|
@ -129,6 +139,7 @@ const storyWrightOptions: StoryWrightOptions = {
|
|||
url: url,
|
||||
screenShotDestPath: args.destpath,
|
||||
browsers: args.browsers,
|
||||
skipDomParsing: args.skipDomParsing,
|
||||
parseDom: args.parseDom,
|
||||
compressDom: args.compressDom,
|
||||
headless: args.headless,
|
||||
|
|
Загрузка…
Ссылка в новой задаче