Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move to sha256 #4038

Merged
merged 2 commits into from Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/command/run-multiple.js
Expand Up @@ -124,7 +124,7 @@ function executeRun(runName, runConfig) {
if (browserConfig.outputName) {
outputDir += typeof browserConfig.outputName === 'function' ? browserConfig.outputName() : browserConfig.outputName;
} else {
const hash = crypto.createHash('md5');
const hash = crypto.createHash('sha256');
hash.update(JSON.stringify(browserConfig));
outputDir += hash.digest('hex');
}
Expand Down
4 changes: 2 additions & 2 deletions lib/plugin/stepByStepReport.js
Expand Up @@ -89,8 +89,8 @@ module.exports = function (config) {
const reportDir = config.output ? path.resolve(global.codecept_dir, config.output) : defaultConfig.output;

event.dispatcher.on(event.test.before, (test) => {
const md5hash = crypto.createHash('md5').update(test.file + test.title).digest('hex');
dir = path.join(reportDir, `record_${md5hash}`);
const sha256hash = crypto.createHash('sha256').update(test.file + test.title).digest('hex');
dir = path.join(reportDir, `record_${sha256hash}`);
mkdirp.sync(dir);
stepNum = 0;
error = null;
Expand Down
4 changes: 2 additions & 2 deletions test/acceptance/session_test.js
Expand Up @@ -30,7 +30,7 @@ Scenario('screenshots reflect the current page of current session @Puppeteer @Pl
I.saveScreenshot('session_john_2.png');
});

const [default1Digest, default2Digest, john1Digest, john2Digest] = await I.getMD5Digests([
const [default1Digest, default2Digest, john1Digest, john2Digest] = await I.getSHA256Digests([
`${output_dir}/session_default_1.png`,
`${output_dir}/session_default_2.png`,
`${output_dir}/session_john_1.png`,
Expand Down Expand Up @@ -88,7 +88,7 @@ Scenario('should save screenshot for active session @WebDriverIO @Puppeteer @Pla

const fileName = clearString(this.title);

const [original, failed] = await I.getMD5Digests([
const [original, failed] = await I.getSHA256Digests([
`${output_dir}/original.png`,
`${output_dir}/${fileName}.failed.png`,
]);
Expand Down
4 changes: 2 additions & 2 deletions test/support/ScreenshotSessionHelper.js
Expand Up @@ -17,11 +17,11 @@ class ScreenshotSessionHelper extends Helper {
this.outputPath = output_dir;
}

getMD5Digests(files = []) {
getSHA256Digests(files = []) {
const digests = [];

for (const file of files) {
const hash = crypto.createHash('md5');
const hash = crypto.createHash('sha256');
const data = fs.readFileSync(file);
hash.update(data);

Expand Down