mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
ci: better naming for test-image snapshot filename (#46369)
This commit is contained in:
parent
b05641dd2d
commit
48d430dff7
@ -136,8 +136,8 @@ function generateReportMd(badCases: IBadCase[], targetBranch: string, targetRef:
|
|||||||
reportMdStr += [
|
reportMdStr += [
|
||||||
badCase.filename,
|
badCase.filename,
|
||||||
`![master: ref](${publicPath}/visualRegressionReport/images/base/${filename})`,
|
`![master: ref](${publicPath}/visualRegressionReport/images/base/${filename})`,
|
||||||
`⛔️`,
|
`⛔️⛔️⛔️ Missing ⛔️⛔️⛔️`,
|
||||||
`🚨`,
|
`🚨🚨🚨 Removed 🚨🚨🚨`,
|
||||||
].join(' | ');
|
].join(' | ');
|
||||||
reportMdStr += ' |\n';
|
reportMdStr += ' |\n';
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ export default function imageTest(
|
|||||||
identifier: string,
|
identifier: string,
|
||||||
options: ImageTestOptions,
|
options: ImageTestOptions,
|
||||||
) {
|
) {
|
||||||
function test(name: string, themedComponent: React.ReactElement) {
|
function test(name: string, suffix: string, themedComponent: React.ReactElement) {
|
||||||
it(name, async () => {
|
it(name, async () => {
|
||||||
await jestPuppeteer.resetPage();
|
await jestPuppeteer.resetPage();
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
@ -86,7 +86,7 @@ export default function imageTest(
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(image).toMatchImageSnapshot({
|
expect(image).toMatchImageSnapshot({
|
||||||
customSnapshotIdentifier: `${identifier}-${name.replace(/\s/g, '-')}`,
|
customSnapshotIdentifier: `${identifier}${suffix}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
MockDate.reset();
|
MockDate.reset();
|
||||||
@ -98,12 +98,14 @@ export default function imageTest(
|
|||||||
Object.entries(themes).forEach(([key, algorithm]) => {
|
Object.entries(themes).forEach(([key, algorithm]) => {
|
||||||
test(
|
test(
|
||||||
`component image screenshot should correct ${key}`,
|
`component image screenshot should correct ${key}`,
|
||||||
|
`-${key}`,
|
||||||
<div style={{ background: key === 'dark' ? '#000' : '', padding: `24px 12px` }} key={key}>
|
<div style={{ background: key === 'dark' ? '#000' : '', padding: `24px 12px` }} key={key}>
|
||||||
<ConfigProvider theme={{ algorithm }}>{component}</ConfigProvider>
|
<ConfigProvider theme={{ algorithm }}>{component}</ConfigProvider>
|
||||||
</div>,
|
</div>,
|
||||||
);
|
);
|
||||||
test(
|
test(
|
||||||
`component image screenshot should correct ${key}.css-var`,
|
`[CSS Var] component image screenshot should correct ${key}`,
|
||||||
|
`-${key}.css-var`,
|
||||||
<div style={{ background: key === 'dark' ? '#000' : '', padding: `24px 12px` }} key={key}>
|
<div style={{ background: key === 'dark' ? '#000' : '', padding: `24px 12px` }} key={key}>
|
||||||
<div>CSS Var</div>
|
<div>CSS Var</div>
|
||||||
<ConfigProvider theme={{ algorithm, cssVar: true }}>{component}</ConfigProvider>
|
<ConfigProvider theme={{ algorithm, cssVar: true }}>{component}</ConfigProvider>
|
||||||
@ -113,6 +115,7 @@ export default function imageTest(
|
|||||||
} else {
|
} else {
|
||||||
test(
|
test(
|
||||||
`component image screenshot should correct`,
|
`component image screenshot should correct`,
|
||||||
|
'',
|
||||||
<>
|
<>
|
||||||
{Object.entries(themes).map(([key, algorithm]) => (
|
{Object.entries(themes).map(([key, algorithm]) => (
|
||||||
<div style={{ background: key === 'dark' ? '#000' : '', padding: `24px 12px` }} key={key}>
|
<div style={{ background: key === 'dark' ? '#000' : '', padding: `24px 12px` }} key={key}>
|
||||||
@ -122,7 +125,8 @@ export default function imageTest(
|
|||||||
</>,
|
</>,
|
||||||
);
|
);
|
||||||
test(
|
test(
|
||||||
`component image screenshot should correct.css-var`,
|
`[CSS Var] component image screenshot should correct`,
|
||||||
|
'.css-var',
|
||||||
<>
|
<>
|
||||||
<div>CSS Var</div>
|
<div>CSS Var</div>
|
||||||
{Object.entries(themes).map(([key, algorithm]) => (
|
{Object.entries(themes).map(([key, algorithm]) => (
|
||||||
|
Loading…
Reference in New Issue
Block a user