Skip to content

Commit

Permalink
update screenshot diff failed (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
JackySun9 authored Jun 11, 2024
1 parent b91293a commit 800e576
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libs/screenshot/compare.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'path';
import fs from 'fs';

const S3URL = 'https://s3-sj3.corp.adobe.com/milo';
const ALLOWED_BASE_DIRECTORY = 'screenshots/';
const ALLOWED_BASE_DIRECTORY = 'screenshots';

function sanitizeAndValidateFilePath(filePath) {
if (typeof filePath !== 'string') {
Expand Down
4 changes: 2 additions & 2 deletions libs/screenshot/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { getComparator } = require('playwright-core/lib/utils');
const fs = require('fs');
const path = require('path');

const ALLOWED_BASE_DIRECTORY = 'screenshots/';
const ALLOWED_BASE_DIRECTORY = 'screenshots';

function validatePath(filePath, options = { allowDirectory: false, forWriting: false }) {
if (typeof filePath !== 'string') {
Expand Down Expand Up @@ -64,7 +64,7 @@ function compareScreenshots(stableArray, betaArray) {

if (diffImage) {
result.diff = `${stableArray[i].a}-diff.png`;
fs.writeFileSync(validatePath(`${stableArray[i].a}-diff.png`), diffImage.diff);
fs.writeFileSync(validatePath(`${stableArray[i].a}-diff.png`, { forWriting: true }), diffImage.diff);
console.info('Differences found');
}
result.urls = urls.join(' | ');
Expand Down

0 comments on commit 800e576

Please sign in to comment.