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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: display differentPixels, if available #534

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

KuznetsovRoman
Copy link
Member

@KuznetsovRoman KuznetsovRoman commented Mar 4, 2024

What is done

  • add different pixels value, which is displayed when using hermione >= 8.2.0
image

hermione types fix: gemini-testing/testplane#852

@KuznetsovRoman KuznetsovRoman force-pushed the HERMIONE-1403.html_reporter_diff branch 3 times, most recently from 6b9556b to 0217fb0 Compare March 4, 2024 14:48
lib/static/components/state/index.jsx Outdated Show resolved Hide resolved
lib/static/components/state/index.jsx Outdated Show resolved Hide resolved
Comment on lines 137 to 141
if (percent > 1) {
return percentString.slice(0, 4);
}

return percentString.slice(0, 5);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be written in ternary form, but .slice(0, percent > 1 ? 4 : 5) is ugly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example values:

  • < 0.001% (because 1 pixel out of full hd picture is 0.00004%, which is a lot of digits)
  • 10.4% (because we don't need second digit after ., if percent > 10
  • 5.45% (because in this case second digit could be usefull
  • 0.015% (because usually we would see that much of a difference, if it comes to percent values

return <div className={className} onClick={this.onToggleStateResult}>{image.stateName}</div>;
let displayedText = image.stateName;

if (image.differentPixels && image.diffRatio) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are absent in proptypes so we dont get errors in case they are not defined

return `< ${percentThreshold}`
}

return String(percentRounded);
Copy link
Member Author

@KuznetsovRoman KuznetsovRoman Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrapped in String(), so this method only returns string values

@KuznetsovRoman KuznetsovRoman force-pushed the HERMIONE-1403.html_reporter_diff branch from 31f5984 to 4278c26 Compare March 4, 2024 17:02
@KuznetsovRoman KuznetsovRoman force-pushed the HERMIONE-1403.html_reporter_diff branch from 4278c26 to aeb47d5 Compare March 4, 2024 17:29
@KuznetsovRoman KuznetsovRoman merged commit 316327c into master Mar 4, 2024
5 checks passed
@KuznetsovRoman KuznetsovRoman deleted the HERMIONE-1403.html_reporter_diff branch March 4, 2024 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants