mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-22 17:13:27 +08:00
chore: Improve visual regression screenshot warning (#52053)
* chore: Improve visual regression screenshot warning * chore: update * what?
This commit is contained in:
parent
4fcf3da852
commit
bc28f57977
@ -1,5 +1,7 @@
|
||||
import { imageDemoTest } from '../../../tests/shared/imageTest';
|
||||
|
||||
describe('Affix image', () => {
|
||||
imageDemoTest('affix');
|
||||
imageDemoTest('affix', {
|
||||
onlyViewport: ['debug.tsx'],
|
||||
});
|
||||
});
|
||||
|
@ -8,6 +8,7 @@ import fse from 'fs-extra';
|
||||
import { globSync } from 'glob';
|
||||
import { JSDOM } from 'jsdom';
|
||||
import MockDate from 'mockdate';
|
||||
import rcWarning from 'rc-util/lib/warning';
|
||||
import type { HTTPRequest } from 'puppeteer';
|
||||
import ReactDOMServer from 'react-dom/server';
|
||||
|
||||
@ -202,6 +203,14 @@ export default function imageTest(
|
||||
if (!options.onlyViewport) {
|
||||
// Get scroll height of the rendered page and set viewport
|
||||
const bodyHeight = await page.evaluate(() => document.body.scrollHeight);
|
||||
|
||||
// loooooong image
|
||||
rcWarning(
|
||||
bodyHeight < 4096, // Expected height
|
||||
`[IMAGE TEST] [${identifier}] may cause screenshots to be very long and unacceptable.
|
||||
Please consider using \`onlyViewport: ["filename.tsx"]\`, read more: https://github.com/ant-design/ant-design/pull/52053`,
|
||||
);
|
||||
|
||||
await page.setViewport({ width: 800, height: bodyHeight });
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user