test: improve Visual Regression UI (#47344)

This commit is contained in:
afc163 2024-02-05 13:35:16 +08:00 committed by GitHub
parent a8d951f04a
commit 2455128e73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 14 deletions

View File

@ -27,6 +27,11 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
## Visual-Regression Diff Building...
## 👁 Visual-Regression Diff Building... ⏳
> This PR is under visual-regression-diff building, please wait for the result.
<img src="https://github.com/ant-design/ant-design/assets/507615/5d52d8a2-f74e-4159-9792-c705b7bc1744" width="300" />
<!-- VISUAL_DIFF_REGRESSION_HOOK -->
body-include: '<!-- VISUAL_DIFF_REGRESSION_HOOK -->'

View File

@ -153,29 +153,29 @@ function generateReport(
const passed = badCases.length === 0;
const commonHeader = `
## Visual Regression Report for PR #${prId} ${passed ? 'Passed ✅' : 'Failed ❌'}
> **Target branch:** ${targetBranch} (${targetRef})
## 👁 Visual Regression Report for PR #${prId} ${passed ? 'Passed ✅' : 'Failed ❌'}
> **🎯 Target branch:** ${targetBranch} (${targetRef})
`.trim();
const htmlReportLink = `${publicPath}/visualRegressionReport/report.html`;
const addonFullReportDesc = `\n\nCheck <a href="${htmlReportLink}" target="_blank">Full Report</a> for details`;
const fullReport = `> <a href="${htmlReportLink}" target="_blank">📖 View Full Report↗</a>`;
if (passed) {
const mdStr = [
commonHeader,
'------------------------',
'Congrats! No visual-regression diff found',
fullReport,
'🎊 Congrats! No visual-regression diff found.',
'<img src="https://github.com/ant-design/ant-design/assets/507615/2d1a77dc-dbc6-4b0f-9cbc-19a43d3c29cd" width="300" />',
].join('\n');
return [mdStr, md2Html(mdStr)];
}
const htmlReportLink = `${publicPath}/visualRegressionReport/report.html`;
const addonFullReportDesc = `\n\nCheck <a href="${htmlReportLink}" target="_blank">Full Report</a> for details`;
let reportMdStr = `
${commonHeader}
> <a href="${htmlReportLink}" target="_blank">View Full Report</a> \n
------------------------
| image name | expected | actual | diff |
${fullReport}
| Image name | Expected | Actual | Diff |
| --- | --- | --- | --- |
`.trim();
reportMdStr += '\n';
@ -190,7 +190,7 @@ ${commonHeader}
if (type === 'changed') {
lineReportMdStr += '| ';
lineReportMdStr += [
badCase.filename,
`\`${badCase.filename}\``,
`![${targetBranch}: ${targetRef}](${publicPath}/visualRegressionReport/images/base/${filename})`,
`![current: pr-${prId}](${publicPath}/visualRegressionReport/images/current/${filename})`,
`![diff](${publicPath}/visualRegressionReport/images/diff/${filename})`,
@ -199,7 +199,7 @@ ${commonHeader}
} else if (type === 'removed') {
lineReportMdStr += '| ';
lineReportMdStr += [
badCase.filename,
`\`${badCase.filename}\``,
`![${targetBranch}: ${targetRef}](${publicPath}/visualRegressionReport/images/base/${filename})`,
`⛔️⛔️⛔️ Missing ⛔️⛔️⛔️`,
`🚨🚨🚨 Removed 🚨🚨🚨`,