make startup take a screenshot for diff
This commit is contained in:
parent
95f4700faa
commit
ac0fc1e9fb
@ -112,8 +112,14 @@ class ChangeDetection extends Scraper {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const timestamp = dateFormat(now, 'yyyymmddHHMM');
|
||||||
|
const screenshotPath = `${this.path}/screenshots/${filename}-${timestamp}`;
|
||||||
|
|
||||||
if (!fs.existsSync(oldFile)) {
|
if (!fs.existsSync(oldFile)) {
|
||||||
fs.writeFileSync(oldFile, innerText.body, 'utf-8');
|
fs.writeFileSync(oldFile, innerText.body, 'utf-8');
|
||||||
|
stats.screenshot = screenshotPath;
|
||||||
|
await this._makeScreenshotV2(this.page, screenshotPath, null);
|
||||||
|
|
||||||
this.stats.set(filename, stats);
|
this.stats.set(filename, stats);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -130,8 +136,6 @@ class ChangeDetection extends Scraper {
|
|||||||
|
|
||||||
if (levenshtein !== 0) {
|
if (levenshtein !== 0) {
|
||||||
logger.info('Changed...');
|
logger.info('Changed...');
|
||||||
const timestamp = dateFormat(now, 'yyyymmddHHMM');
|
|
||||||
const screenshotPath = `${this.path}/screenshots/${filename}-${timestamp}`;
|
|
||||||
|
|
||||||
stats.previousScreenshot = stats.screenshot;
|
stats.previousScreenshot = stats.screenshot;
|
||||||
stats.previousChange = stats.lastSaved;
|
stats.previousChange = stats.lastSaved;
|
||||||
|
Loading…
Reference in New Issue
Block a user