From 6fba4d1136b58643a99dd5890f91e22786b0af11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AA=97=E4=BD=A0=E6=98=AF=E5=B0=8F=E7=8C=AB=E5=92=AA?= Date: Fri, 23 Oct 2020 18:50:46 +0800 Subject: [PATCH] test: demo -> ui test (#24475) * test: demo -> ui test * improve comment image width * use argos-ci * use by cicleci * fix circle run * rebase master * try pipeline var * use another branch var * fix commit id * ignore image test file * remove useless report * fix test coverage --- .gitignore | 3 ++ .jest.image.js | 3 +- .jest.js | 3 +- azure-pipelines.yml | 41 +----------------- components/affix/__tests__/image.test.ts | 5 +++ components/alert/__tests__/image.test.ts | 5 +++ components/anchor/__tests__/image.test.ts | 5 +++ .../auto-complete/__tests__/image.test.ts | 5 +++ components/avatar/__tests__/image.test.ts | 5 +++ components/back-top/__tests__/image.test.ts | 5 +++ components/badge/__tests__/image.test.ts | 5 +++ components/breadcrumb/__tests__/image.test.ts | 5 +++ ...image-screenshot-should-correct-1-snap.png | Bin 6797 -> 0 bytes components/button/__tests__/image.test.js | 14 ------ components/button/__tests__/image.test.ts | 5 +++ components/calendar/__tests__/image.test.ts | 5 +++ components/card/__tests__/image.test.ts | 5 +++ components/carousel/__tests__/image.test.ts | 5 +++ components/cascader/__tests__/image.test.ts | 5 +++ components/checkbox/__tests__/image.test.ts | 5 +++ components/collapse/__tests__/image.test.ts | 5 +++ components/comment/__tests__/image.test.ts | 5 +++ .../config-provider/__tests__/image.test.ts | 5 +++ .../date-picker/__tests__/image.test.ts | 5 +++ .../descriptions/__tests__/image.test.ts | 5 +++ components/divider/__tests__/image.test.ts | 5 +++ components/drawer/__tests__/image.test.ts | 5 +++ components/dropdown/__tests__/image.test.ts | 5 +++ components/empty/__tests__/image.test.ts | 5 +++ components/form/__tests__/image.test.ts | 5 +++ ...image-screenshot-should-correct-1-snap.png | Bin 6750 -> 0 bytes components/grid/__tests__/image.test.js | 37 ---------------- components/grid/__tests__/image.test.ts | 5 +++ components/icon/__tests__/image.test.ts | 5 +++ .../input-number/__tests__/image.test.ts | 5 +++ components/input/__tests__/image.test.ts | 5 +++ components/layout/__tests__/image.test.ts | 5 +++ components/list/__tests__/image.test.ts | 5 +++ components/mentions/__tests__/image.test.ts | 5 +++ components/menu/__tests__/image.test.ts | 5 +++ components/message/__tests__/image.test.ts | 5 +++ components/modal/__tests__/image.test.ts | 5 +++ .../notification/__tests__/image.test.ts | 5 +++ .../page-header/__tests__/image.test.ts | 5 +++ components/pagination/__tests__/image.test.ts | 5 +++ components/popconfirm/__tests__/image.test.ts | 5 +++ components/popover/__tests__/image.test.ts | 5 +++ components/progress/__tests__/image.test.ts | 5 +++ components/radio/__tests__/image.test.ts | 5 +++ components/rate/__tests__/image.test.ts | 5 +++ components/result/__tests__/image.test.ts | 5 +++ components/select/__tests__/image.test.ts | 5 +++ components/skeleton/__tests__/image.test.ts | 5 +++ components/slider/__tests__/image.test.ts | 5 +++ components/space/__tests__/image.test.ts | 5 +++ components/statistic/__tests__/image.test.ts | 5 +++ components/steps/__tests__/image.test.ts | 5 +++ components/switch/__tests__/image.test.ts | 5 +++ components/table/__tests__/image.test.ts | 5 +++ components/tabs/__tests__/image.test.ts | 5 +++ components/tag/__tests__/image.test.ts | 5 +++ .../time-picker/__tests__/image.test.ts | 5 +++ components/timeline/__tests__/image.test.ts | 5 +++ components/tooltip/__tests__/image.test.ts | 5 +++ components/transfer/__tests__/image.test.ts | 5 +++ .../tree-select/__tests__/image.test.ts | 5 +++ components/tree/__tests__/image.test.ts | 5 +++ components/typography/__tests__/image.test.ts | 5 +++ components/upload/__tests__/image.test.ts | 5 +++ docker-compose.yml | 5 ++- package.json | 5 ++- tests/index.html | 6 ++- tests/shared/imageTest.ts | 29 ++++++++++++- 73 files changed, 353 insertions(+), 98 deletions(-) create mode 100644 components/affix/__tests__/image.test.ts create mode 100644 components/alert/__tests__/image.test.ts create mode 100644 components/anchor/__tests__/image.test.ts create mode 100644 components/auto-complete/__tests__/image.test.ts create mode 100644 components/avatar/__tests__/image.test.ts create mode 100644 components/back-top/__tests__/image.test.ts create mode 100644 components/badge/__tests__/image.test.ts create mode 100644 components/breadcrumb/__tests__/image.test.ts delete mode 100644 components/button/__tests__/__image_snapshots__/image-test-js-button-image-image-test-component-image-screenshot-should-correct-1-snap.png delete mode 100644 components/button/__tests__/image.test.js create mode 100644 components/button/__tests__/image.test.ts create mode 100644 components/calendar/__tests__/image.test.ts create mode 100644 components/card/__tests__/image.test.ts create mode 100644 components/carousel/__tests__/image.test.ts create mode 100644 components/cascader/__tests__/image.test.ts create mode 100644 components/checkbox/__tests__/image.test.ts create mode 100644 components/collapse/__tests__/image.test.ts create mode 100644 components/comment/__tests__/image.test.ts create mode 100644 components/config-provider/__tests__/image.test.ts create mode 100644 components/date-picker/__tests__/image.test.ts create mode 100644 components/descriptions/__tests__/image.test.ts create mode 100644 components/divider/__tests__/image.test.ts create mode 100644 components/drawer/__tests__/image.test.ts create mode 100644 components/dropdown/__tests__/image.test.ts create mode 100644 components/empty/__tests__/image.test.ts create mode 100644 components/form/__tests__/image.test.ts delete mode 100644 components/grid/__tests__/__image_snapshots__/image-test-js-grid-image-image-test-component-image-screenshot-should-correct-1-snap.png delete mode 100644 components/grid/__tests__/image.test.js create mode 100644 components/grid/__tests__/image.test.ts create mode 100644 components/icon/__tests__/image.test.ts create mode 100644 components/input-number/__tests__/image.test.ts create mode 100644 components/input/__tests__/image.test.ts create mode 100644 components/layout/__tests__/image.test.ts create mode 100644 components/list/__tests__/image.test.ts create mode 100644 components/mentions/__tests__/image.test.ts create mode 100644 components/menu/__tests__/image.test.ts create mode 100644 components/message/__tests__/image.test.ts create mode 100644 components/modal/__tests__/image.test.ts create mode 100644 components/notification/__tests__/image.test.ts create mode 100644 components/page-header/__tests__/image.test.ts create mode 100644 components/pagination/__tests__/image.test.ts create mode 100644 components/popconfirm/__tests__/image.test.ts create mode 100644 components/popover/__tests__/image.test.ts create mode 100644 components/progress/__tests__/image.test.ts create mode 100644 components/radio/__tests__/image.test.ts create mode 100644 components/rate/__tests__/image.test.ts create mode 100644 components/result/__tests__/image.test.ts create mode 100644 components/select/__tests__/image.test.ts create mode 100644 components/skeleton/__tests__/image.test.ts create mode 100644 components/slider/__tests__/image.test.ts create mode 100644 components/space/__tests__/image.test.ts create mode 100644 components/statistic/__tests__/image.test.ts create mode 100644 components/steps/__tests__/image.test.ts create mode 100644 components/switch/__tests__/image.test.ts create mode 100644 components/table/__tests__/image.test.ts create mode 100644 components/tabs/__tests__/image.test.ts create mode 100644 components/tag/__tests__/image.test.ts create mode 100644 components/time-picker/__tests__/image.test.ts create mode 100644 components/timeline/__tests__/image.test.ts create mode 100644 components/tooltip/__tests__/image.test.ts create mode 100644 components/transfer/__tests__/image.test.ts create mode 100644 components/tree-select/__tests__/image.test.ts create mode 100644 components/tree/__tests__/image.test.ts create mode 100644 components/typography/__tests__/image.test.ts create mode 100644 components/upload/__tests__/image.test.ts diff --git a/.gitignore b/.gitignore index f59fe24f3bdb..1f29c5a1241b 100644 --- a/.gitignore +++ b/.gitignore @@ -61,4 +61,7 @@ components/version/version.tsx # Image snapshot diff __diff_output__/ +__image_snapshots__/ /jest-stare +/imageSnapshots +/imageDiffSnapshots diff --git a/.jest.image.js b/.jest.image.js index 9d5b93df08eb..b04f37496e6f 100644 --- a/.jest.image.js +++ b/.jest.image.js @@ -11,7 +11,7 @@ module.exports = { '\\.md$': './node_modules/@ant-design/tools/lib/jest/demoPreprocessor', '\\.(jpg|png|gif|svg)$': './node_modules/@ant-design/tools/lib/jest/imagePreprocessor', }, - testRegex: 'image\\.test\\.js$', + testRegex: 'image\\.test\\.(j|t)s$', testEnvironment: 'node', transformIgnorePatterns, snapshotSerializers: ['enzyme-to-json/serializer'], @@ -20,5 +20,4 @@ module.exports = { tsConfigFile: './tsconfig.test.json', }, }, - reporters: ['default', 'jest-stare'], }; diff --git a/.jest.js b/.jest.js index 42ccb8e678f8..7199b1262b62 100644 --- a/.jest.js +++ b/.jest.js @@ -27,7 +27,7 @@ module.exports = { '^react-dnd-test-utils$': 'react-dnd-test-utils/dist/cjs', '\\.(css|less)$': 'identity-obj-proxy', }, - testPathIgnorePatterns: ['/node_modules/', 'dekko', 'node', 'image.test.js'], + testPathIgnorePatterns: ['/node_modules/', 'dekko', 'node', 'image.test.js', 'image.test.ts'], transform: { '\\.tsx?$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor', '\\.js$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor', @@ -42,6 +42,7 @@ module.exports = { '!components/*/locale/index.tsx', '!components/*/__tests__/type.test.tsx', '!components/**/*/interface.{ts,tsx}', + '!components/*/__tests__/image.test.{ts,tsx}', ], transformIgnorePatterns, snapshotSerializers: ['enzyme-to-json/serializer'], diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c15ad8efe554..9663eb376e0c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -74,44 +74,7 @@ stages: versionSpec: '14.7.0' - script: npm install displayName: 'Install modules' - - script: | - node ./scripts/azure-github-comment.js -ui "[![UI Testing](https://user-images.githubusercontent.com/14831261/82744255-6bfc8800-9da8-11ea-9017-857933e8433b.gif)](https://dev.azure.com/ant-design/ant-design/_build/results?buildId=$(Build.BuildId))" - displayName: 'Comment on github' - script: npm run test-image displayName: 'UI Test' - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(System.DefaultWorkingDirectory)/jest-stare - artifactName: jestStare - condition: failed() - - script: | - node ./scripts/azure-github-comment.js -ui "[](https://dev.azure.com/ant-design/ant-design/_build/results?buildId=$(Build.BuildId))" - displayName: 'Update comment on github' - - job: UI_Test_Failed - dependsOn: UI_Test - condition: failed() - steps: - - checkout: self - displayName: 'Checkout' - clean: true - fetchDepth: 1 - - task: NodeTool@0 - displayName: 'Install Node.js' - inputs: - versionSpec: '14.7.0' - - script: npm install - displayName: 'Install modules' - - task: DownloadPipelineArtifact@2 - inputs: - artifact: jestStare - path: './jest-stare' - - script: ls -al ./jest-stare - displayName: 'List report' - - script: | - export DEPLOY_DOMAIN=https://ui-test-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ant-design.surge.sh - echo "Deploy to $DEPLOY_DOMAIN" - npx surge --project ./jest-stare --domain $DEPLOY_DOMAIN - displayName: 'Deploy Report Site' - - script: | - node ./scripts/azure-github-comment.js -ui "[](https://ui-test-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ant-design.surge.sh)" - displayName: 'Update comment on github' + - script: npm run argos -- --token $ARGOS_TOKEN --branch $(Build.SourceBranch) --commit $(Build.SourceVersion) + displayName: 'Upload to argos-ci' diff --git a/components/affix/__tests__/image.test.ts b/components/affix/__tests__/image.test.ts new file mode 100644 index 000000000000..4ff20f8783eb --- /dev/null +++ b/components/affix/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Affix image', () => { + imageDemoTest('affix'); +}); diff --git a/components/alert/__tests__/image.test.ts b/components/alert/__tests__/image.test.ts new file mode 100644 index 000000000000..26d429d4f5a5 --- /dev/null +++ b/components/alert/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Alert image', () => { + imageDemoTest('alert'); +}); diff --git a/components/anchor/__tests__/image.test.ts b/components/anchor/__tests__/image.test.ts new file mode 100644 index 000000000000..b071a85f4f78 --- /dev/null +++ b/components/anchor/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Anchor image', () => { + imageDemoTest('anchor'); +}); diff --git a/components/auto-complete/__tests__/image.test.ts b/components/auto-complete/__tests__/image.test.ts new file mode 100644 index 000000000000..890e81f267df --- /dev/null +++ b/components/auto-complete/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('AutoComplete image', () => { + imageDemoTest('auto-complete'); +}); diff --git a/components/avatar/__tests__/image.test.ts b/components/avatar/__tests__/image.test.ts new file mode 100644 index 000000000000..70718b3108fa --- /dev/null +++ b/components/avatar/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Avatar image', () => { + imageDemoTest('avatar'); +}); diff --git a/components/back-top/__tests__/image.test.ts b/components/back-top/__tests__/image.test.ts new file mode 100644 index 000000000000..2651ed880e1d --- /dev/null +++ b/components/back-top/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('BackTop image', () => { + imageDemoTest('back-top'); +}); diff --git a/components/badge/__tests__/image.test.ts b/components/badge/__tests__/image.test.ts new file mode 100644 index 000000000000..f34cf6c438cb --- /dev/null +++ b/components/badge/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Badge image', () => { + imageDemoTest('badge'); +}); diff --git a/components/breadcrumb/__tests__/image.test.ts b/components/breadcrumb/__tests__/image.test.ts new file mode 100644 index 000000000000..35450d3b3dbb --- /dev/null +++ b/components/breadcrumb/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Breadcrumb image', () => { + imageDemoTest('breadcrumb', { skip: ['router-4.md'] }); +}); diff --git a/components/button/__tests__/__image_snapshots__/image-test-js-button-image-image-test-component-image-screenshot-should-correct-1-snap.png b/components/button/__tests__/__image_snapshots__/image-test-js-button-image-image-test-component-image-screenshot-should-correct-1-snap.png deleted file mode 100644 index 9254f31b0afd89bf25ac096531ac7ae17d4bbe29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6797 zcmeH~`CpRR-^TCuRc*danWfo`q|;=XTA8WXG>ztH(u|d9E;TM#ZX}rt3Qd+anW8wU z1j3Z1Gr3d}kg`?g!nmbYCW@peWNZqG0s`Ng=Xw5%$DhvfI``{7uXC=?b-m9YCj))W z)^1%30Dzg_@ngRNz_J|xu=MQemEg?1tJe`=vjq98?@^$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Bii^vP(4vo@=j=tXBVmf=a4iC-FtbZ|f8&rK2$V+9BXicEgS^+Zy zX&+Et1k%7G7R!syzk1HJ*Y`ESCSB{K6j)PJQ;JSTujX*PEj*`=$X^HxD++5WEA8Sx z)DDhLMm#xH1N(+INR%a+n`|HpjP(E*47PIBD%Wi7OaSrFbj*qoISC6UfQw%W=(^s#Sef}`Yj>Z&6uW=hA0&*8ky3)HuOYpfITOCQ$R6%?-V;18$E z-~D5W7G^{Ztz)VSEfX;4AF6tL@jh+yVvK@Vwd~^ zGJ{d<-hUV=%u^4IPSYAi134M0JB2Len5x5xlcg*BQUOZdgs4d`Mspp{KHb6nfW61R z`uofp2V#-QMKh$&+ERLdvXmh(U=4R(ZnG&XfkE9Jh=`-4EG5^30472<;lOh$bwWip zX4Ny~P1eXx=f*FOYf{vMaPTA%c{-2TcR{KNCycvg7~<6}+jvs|@=d1}czE)mb=K4? zcU7k=^37MieX+6{pGH8yY)6%YOZ*J8BlhcQx-cNVegFy3!@;qF90U3jGN;lDywb5Xx(s z|MY%(EF;=S^6eGiT5)FA^7fW>bKDBCZ4o1wHj!*=E$cn0_u32qQk$Q>SH$nno*>f< zPty=S8_4_4Dqu$14Z#)dVJicaw&rOh-TG#&P|5!Wd z763#LmandSz3Z4=)QUAACi5b^do6#v^QN)M#lQfX&x z2&E51V#pwzoZZ*oPto7Y1!>|+YASVsmMCD8JdI{jl$OS3vt_%z{`YZ{#7zWU%oN*I z0eI!w*zLf1#oLcyH6hc})1S9F$5N@(nBf { - imageTest( - <> - - - - - , - ); -}); diff --git a/components/button/__tests__/image.test.ts b/components/button/__tests__/image.test.ts new file mode 100644 index 000000000000..69d7f68c78ac --- /dev/null +++ b/components/button/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Button image', () => { + imageDemoTest('button', { skip: ['loading.md'] }); +}); diff --git a/components/calendar/__tests__/image.test.ts b/components/calendar/__tests__/image.test.ts new file mode 100644 index 000000000000..bc0534991f7e --- /dev/null +++ b/components/calendar/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Calendar image', () => { + imageDemoTest('calendar'); +}); diff --git a/components/card/__tests__/image.test.ts b/components/card/__tests__/image.test.ts new file mode 100644 index 000000000000..5c86506cf8ea --- /dev/null +++ b/components/card/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Card image', () => { + imageDemoTest('card'); +}); diff --git a/components/carousel/__tests__/image.test.ts b/components/carousel/__tests__/image.test.ts new file mode 100644 index 000000000000..30d204a801e7 --- /dev/null +++ b/components/carousel/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Carousel image', () => { + imageDemoTest('carousel'); +}); diff --git a/components/cascader/__tests__/image.test.ts b/components/cascader/__tests__/image.test.ts new file mode 100644 index 000000000000..914c240bb138 --- /dev/null +++ b/components/cascader/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Cascader image', () => { + imageDemoTest('cascader'); +}); diff --git a/components/checkbox/__tests__/image.test.ts b/components/checkbox/__tests__/image.test.ts new file mode 100644 index 000000000000..3b650fa093c0 --- /dev/null +++ b/components/checkbox/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Checkbox image', () => { + imageDemoTest('checkbox'); +}); diff --git a/components/collapse/__tests__/image.test.ts b/components/collapse/__tests__/image.test.ts new file mode 100644 index 000000000000..7f93282a8ce3 --- /dev/null +++ b/components/collapse/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Collapse image', () => { + imageDemoTest('collapse'); +}); diff --git a/components/comment/__tests__/image.test.ts b/components/comment/__tests__/image.test.ts new file mode 100644 index 000000000000..0ab96e709fc8 --- /dev/null +++ b/components/comment/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Comment image', () => { + imageDemoTest('comment'); +}); diff --git a/components/config-provider/__tests__/image.test.ts b/components/config-provider/__tests__/image.test.ts new file mode 100644 index 000000000000..4983a439707a --- /dev/null +++ b/components/config-provider/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('ConfigProvider image', () => { + imageDemoTest('config-provider', { skip: ['direction.md'] }); +}); diff --git a/components/date-picker/__tests__/image.test.ts b/components/date-picker/__tests__/image.test.ts new file mode 100644 index 000000000000..4e5e4fd254c3 --- /dev/null +++ b/components/date-picker/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('DatePicker image', () => { + imageDemoTest('date-picker'); +}); diff --git a/components/descriptions/__tests__/image.test.ts b/components/descriptions/__tests__/image.test.ts new file mode 100644 index 000000000000..2057666ade38 --- /dev/null +++ b/components/descriptions/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Descriptions image', () => { + imageDemoTest('descriptions'); +}); diff --git a/components/divider/__tests__/image.test.ts b/components/divider/__tests__/image.test.ts new file mode 100644 index 000000000000..d72e2b5211bb --- /dev/null +++ b/components/divider/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Divider image', () => { + imageDemoTest('divider'); +}); diff --git a/components/drawer/__tests__/image.test.ts b/components/drawer/__tests__/image.test.ts new file mode 100644 index 000000000000..4550635f961b --- /dev/null +++ b/components/drawer/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Drawer image', () => { + imageDemoTest('drawer'); +}); diff --git a/components/dropdown/__tests__/image.test.ts b/components/dropdown/__tests__/image.test.ts new file mode 100644 index 000000000000..19c1b959f803 --- /dev/null +++ b/components/dropdown/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Dropdown image', () => { + imageDemoTest('dropdown'); +}); diff --git a/components/empty/__tests__/image.test.ts b/components/empty/__tests__/image.test.ts new file mode 100644 index 000000000000..5533c301d131 --- /dev/null +++ b/components/empty/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Empty image', () => { + imageDemoTest('empty'); +}); diff --git a/components/form/__tests__/image.test.ts b/components/form/__tests__/image.test.ts new file mode 100644 index 000000000000..6df9ac70d4d6 --- /dev/null +++ b/components/form/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Form image', () => { + imageDemoTest('form', { skip: ['complex-form-control.md'] }); +}); diff --git a/components/grid/__tests__/__image_snapshots__/image-test-js-grid-image-image-test-component-image-screenshot-should-correct-1-snap.png b/components/grid/__tests__/__image_snapshots__/image-test-js-grid-image-image-test-component-image-screenshot-should-correct-1-snap.png deleted file mode 100644 index fbb723ee814b14324736569f05b4036cb0c67496..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6750 zcmeHLYgAKby52|?9kon{HBbei9jLTNAyp7a0As5IrHFLujG$c0C4hhdf(aoB!FDOr zQb33WFH8 zxM%t55)+_TckkZKqN1X+US7iQSHaT84~tX5U-%olA?UO6_dE_CK3s>BjjgP$p@M_o z2@MU!OO<=9t*z}`TnZQr#)?uY>Aa@j95?ZR&=Ltj!1!SL^W(M4z@f2`K@a|;V+{rpDfeM<*E$zgFgxi)_Q=bWgwKbXN{v%~Rt)i>#W^cbdEO}qep zJ>?Y@J~bd?YU@jMw5W)~;e4Bs5&p#&?@GAETo7EsS{AY;%s}MBLu}6wN$Bwl+SiR&<}RVGa&i5-g*auP94w#cV6qV zxf;6Y>-&kfw|9AYd3E$#jq@%L)H$k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?m@w_EfeN6BueB)x6>1JdH+U<`nmi3DBByrdBOM zMkFUAfD89M)Vj4cs<>uI3_f&a=TO>~UNr4_$ZfROay-#@)DN!jjf#%$?}v31fFe@x z>9Kx{wT7A*Z}J8YAu<-c{X7q;4Sb7x^#4a!0jH+j816^__Qhpug@<3`M*zJjO0!65 z8Xp?p08e+=)E`2TJ4Y^|A|hybg}9y`sN#MEs&0_a&!^MrPiui2w#qLoB#lNF+t*~EtL&Vd*6Fobq=is04fX1j77&892bisL!mgf7 zLcT~isFBo$h8PjUwXm=dj2->J?r@5c#Xz;EAAW75OQ+5?8K*&7goC{`* z@Se;=2h7bmi^5i&iSeR3%*+my<`)#OIy+B+=y^|{es?acd5%3wO2dP;WkhNRQ zGRCIP9H^Jlkp4Y>Uz+xS@Lwh$>!+xaeFYq>Z-i9iISU*;`d3bD+uL4$%H7V{cFtbw zv&eSAY!}RS!TgHviQA2{-8kEg^P4q}DoB*~uRK{h))F{I$m7rF&QyOK{N;ZGf@yXk diff --git a/components/grid/__tests__/image.test.js b/components/grid/__tests__/image.test.js deleted file mode 100644 index 4c308e158c3b..000000000000 --- a/components/grid/__tests__/image.test.js +++ /dev/null @@ -1,37 +0,0 @@ -import React from 'react'; -import { Col, Row } from '..'; -import imageTest from '../../../tests/shared/imageTest'; - -describe('Grid image', () => { - imageTest( - <> - - col - - - col - col - col - col - - - col - - - col-12 - col-12 - - - col-8 - col-8 - col-8 - - - col-6 - col-6 - col-6 - col-6 - - , - ); -}); diff --git a/components/grid/__tests__/image.test.ts b/components/grid/__tests__/image.test.ts new file mode 100644 index 000000000000..231401ca9f0e --- /dev/null +++ b/components/grid/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Grid image', () => { + imageDemoTest('grid'); +}); diff --git a/components/icon/__tests__/image.test.ts b/components/icon/__tests__/image.test.ts new file mode 100644 index 000000000000..775b6adc2c62 --- /dev/null +++ b/components/icon/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Icon image', () => { + imageDemoTest('icon', { skip: ['basic.md'] }); +}); diff --git a/components/input-number/__tests__/image.test.ts b/components/input-number/__tests__/image.test.ts new file mode 100644 index 000000000000..8e7fa672f158 --- /dev/null +++ b/components/input-number/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('InputNumber image', () => { + imageDemoTest('input-number'); +}); diff --git a/components/input/__tests__/image.test.ts b/components/input/__tests__/image.test.ts new file mode 100644 index 000000000000..9db299c0f4d9 --- /dev/null +++ b/components/input/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Input image', () => { + imageDemoTest('input', { skip: ['search-input-loading.md'] }); +}); diff --git a/components/layout/__tests__/image.test.ts b/components/layout/__tests__/image.test.ts new file mode 100644 index 000000000000..15deaf9ed1e8 --- /dev/null +++ b/components/layout/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Layout image', () => { + imageDemoTest('layout', { skip: ['countdown.md '] }); +}); diff --git a/components/list/__tests__/image.test.ts b/components/list/__tests__/image.test.ts new file mode 100644 index 000000000000..3fbdae2afe53 --- /dev/null +++ b/components/list/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('List image', () => { + imageDemoTest('list'); +}); diff --git a/components/mentions/__tests__/image.test.ts b/components/mentions/__tests__/image.test.ts new file mode 100644 index 000000000000..984ebf91deda --- /dev/null +++ b/components/mentions/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Mentions image', () => { + imageDemoTest('mentions'); +}); diff --git a/components/menu/__tests__/image.test.ts b/components/menu/__tests__/image.test.ts new file mode 100644 index 000000000000..b85720783143 --- /dev/null +++ b/components/menu/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Menu image', () => { + imageDemoTest('menu'); +}); diff --git a/components/message/__tests__/image.test.ts b/components/message/__tests__/image.test.ts new file mode 100644 index 000000000000..eb57916a01d8 --- /dev/null +++ b/components/message/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Message image', () => { + imageDemoTest('message'); +}); diff --git a/components/modal/__tests__/image.test.ts b/components/modal/__tests__/image.test.ts new file mode 100644 index 000000000000..c2efcaff436c --- /dev/null +++ b/components/modal/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Modal image', () => { + imageDemoTest('modal'); +}); diff --git a/components/notification/__tests__/image.test.ts b/components/notification/__tests__/image.test.ts new file mode 100644 index 000000000000..d5199da21031 --- /dev/null +++ b/components/notification/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Notification image', () => { + imageDemoTest('notification'); +}); diff --git a/components/page-header/__tests__/image.test.ts b/components/page-header/__tests__/image.test.ts new file mode 100644 index 000000000000..3571e54408ac --- /dev/null +++ b/components/page-header/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('PageHeader image', () => { + imageDemoTest('page-header'); +}); diff --git a/components/pagination/__tests__/image.test.ts b/components/pagination/__tests__/image.test.ts new file mode 100644 index 000000000000..a9f56d1d1ba9 --- /dev/null +++ b/components/pagination/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Pagination image', () => { + imageDemoTest('pagination'); +}); diff --git a/components/popconfirm/__tests__/image.test.ts b/components/popconfirm/__tests__/image.test.ts new file mode 100644 index 000000000000..73d392ad282c --- /dev/null +++ b/components/popconfirm/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Popconfirm image', () => { + imageDemoTest('popconfirm'); +}); diff --git a/components/popover/__tests__/image.test.ts b/components/popover/__tests__/image.test.ts new file mode 100644 index 000000000000..cf5ab59c616d --- /dev/null +++ b/components/popover/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Popover image', () => { + imageDemoTest('popover'); +}); diff --git a/components/progress/__tests__/image.test.ts b/components/progress/__tests__/image.test.ts new file mode 100644 index 000000000000..ba763d18ecee --- /dev/null +++ b/components/progress/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Progress image', () => { + imageDemoTest('progress'); +}); diff --git a/components/radio/__tests__/image.test.ts b/components/radio/__tests__/image.test.ts new file mode 100644 index 000000000000..273c34aaa9f6 --- /dev/null +++ b/components/radio/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Radio image', () => { + imageDemoTest('radio'); +}); diff --git a/components/rate/__tests__/image.test.ts b/components/rate/__tests__/image.test.ts new file mode 100644 index 000000000000..b6facd64a3ea --- /dev/null +++ b/components/rate/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Rate image', () => { + imageDemoTest('rate'); +}); diff --git a/components/result/__tests__/image.test.ts b/components/result/__tests__/image.test.ts new file mode 100644 index 000000000000..1a65e3d7ddbb --- /dev/null +++ b/components/result/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Result image', () => { + imageDemoTest('result'); +}); diff --git a/components/select/__tests__/image.test.ts b/components/select/__tests__/image.test.ts new file mode 100644 index 000000000000..09111e33026e --- /dev/null +++ b/components/select/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Select image', () => { + imageDemoTest('select', { skip: ['basic.md'] }); +}); diff --git a/components/skeleton/__tests__/image.test.ts b/components/skeleton/__tests__/image.test.ts new file mode 100644 index 000000000000..9b0f874f0356 --- /dev/null +++ b/components/skeleton/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Skeleton image', () => { + imageDemoTest('skeleton'); +}); diff --git a/components/slider/__tests__/image.test.ts b/components/slider/__tests__/image.test.ts new file mode 100644 index 000000000000..192491ad017e --- /dev/null +++ b/components/slider/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Slider image', () => { + imageDemoTest('slider'); +}); diff --git a/components/space/__tests__/image.test.ts b/components/space/__tests__/image.test.ts new file mode 100644 index 000000000000..4961777607f8 --- /dev/null +++ b/components/space/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Space image', () => { + imageDemoTest('space'); +}); diff --git a/components/statistic/__tests__/image.test.ts b/components/statistic/__tests__/image.test.ts new file mode 100644 index 000000000000..ebb4c4880852 --- /dev/null +++ b/components/statistic/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Statistic image', () => { + imageDemoTest('statistic', { skip: ['countdown.md'] }); +}); diff --git a/components/steps/__tests__/image.test.ts b/components/steps/__tests__/image.test.ts new file mode 100644 index 000000000000..e1a6249b881f --- /dev/null +++ b/components/steps/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Steps image', () => { + imageDemoTest('steps', { skip: ['icon.md'] }); +}); diff --git a/components/switch/__tests__/image.test.ts b/components/switch/__tests__/image.test.ts new file mode 100644 index 000000000000..56f6f6c880cc --- /dev/null +++ b/components/switch/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Switch image', () => { + imageDemoTest('switch', { skip: ['loading.md'] }); +}); diff --git a/components/table/__tests__/image.test.ts b/components/table/__tests__/image.test.ts new file mode 100644 index 000000000000..b9f0dc5d5775 --- /dev/null +++ b/components/table/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Table image', () => { + imageDemoTest('table'); +}); diff --git a/components/tabs/__tests__/image.test.ts b/components/tabs/__tests__/image.test.ts new file mode 100644 index 000000000000..6f0dd492c5e7 --- /dev/null +++ b/components/tabs/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Tabs image', () => { + imageDemoTest('tabs'); +}); diff --git a/components/tag/__tests__/image.test.ts b/components/tag/__tests__/image.test.ts new file mode 100644 index 000000000000..d042353c1ff4 --- /dev/null +++ b/components/tag/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Tag image', () => { + imageDemoTest('tag', { skip: ['status.md'] }); +}); diff --git a/components/time-picker/__tests__/image.test.ts b/components/time-picker/__tests__/image.test.ts new file mode 100644 index 000000000000..13ffd17d6326 --- /dev/null +++ b/components/time-picker/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('TimePicker image', () => { + imageDemoTest('time-picker'); +}); diff --git a/components/timeline/__tests__/image.test.ts b/components/timeline/__tests__/image.test.ts new file mode 100644 index 000000000000..bb41590e0be6 --- /dev/null +++ b/components/timeline/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Timeline image', () => { + imageDemoTest('timeline', { skip: ['pending.md'] }); +}); diff --git a/components/tooltip/__tests__/image.test.ts b/components/tooltip/__tests__/image.test.ts new file mode 100644 index 000000000000..b3f04c9c40fd --- /dev/null +++ b/components/tooltip/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Tooltip image', () => { + imageDemoTest('tooltip'); +}); diff --git a/components/transfer/__tests__/image.test.ts b/components/transfer/__tests__/image.test.ts new file mode 100644 index 000000000000..f1977b199003 --- /dev/null +++ b/components/transfer/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Transfer image', () => { + imageDemoTest('transfer'); +}); diff --git a/components/tree-select/__tests__/image.test.ts b/components/tree-select/__tests__/image.test.ts new file mode 100644 index 000000000000..28056614dd13 --- /dev/null +++ b/components/tree-select/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('TreeSelect image', () => { + imageDemoTest('tree-select'); +}); diff --git a/components/tree/__tests__/image.test.ts b/components/tree/__tests__/image.test.ts new file mode 100644 index 000000000000..f92d2ca5ecf3 --- /dev/null +++ b/components/tree/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Tree image', () => { + imageDemoTest('tree'); +}); diff --git a/components/typography/__tests__/image.test.ts b/components/typography/__tests__/image.test.ts new file mode 100644 index 000000000000..cab748238927 --- /dev/null +++ b/components/typography/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Typography image', () => { + imageDemoTest('typography'); +}); diff --git a/components/upload/__tests__/image.test.ts b/components/upload/__tests__/image.test.ts new file mode 100644 index 000000000000..c441f46a8951 --- /dev/null +++ b/components/upload/__tests__/image.test.ts @@ -0,0 +1,5 @@ +import { imageDemoTest } from '../../../tests/shared/imageTest'; + +describe('Upload image', () => { + imageDemoTest('upload'); +}); diff --git a/docker-compose.yml b/docker-compose.yml index 978e24c3a16d..0ce9f0c75610 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,4 +9,7 @@ services: - './tests:/app/tests' - './jest-stare:/app/jest-stare' - './dist:/app/dist' - entrypoint: "jest --config .jest.image.js --no-cache" + - '.jest.image.js:/app/.jest.image.js' + - './imageSnapshots:/app/imageSnapshots' + - './imageDiffSnapshots:/app/imageDiffSnapshots' + entrypoint: "jest --config .jest.image.js --no-cache -i" diff --git a/package.json b/package.json index 925936cec238..53bca5d1015a 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,8 @@ "tsc": "tsc --noEmit", "site:test": "jest --config .jest.site.js --cache=false", "test-image": "npm run compile:less && docker-compose run tests", - "version": "node ./scripts/generate-version" + "version": "node ./scripts/generate-version", + "argos": "argos upload imageSnapshots" }, "husky": { "hooks": { @@ -176,6 +177,7 @@ "antd-img-crop": "^3.1.1", "antd-pro-merge-less": "^3.0.9", "antd-theme-generator": "^1.2.3", + "argos-cli": "^0.3.0", "array-move": "^3.0.0", "babel-eslint": "^10.0.1", "babel-plugin-add-react-displayname": "^0.0.5", @@ -222,7 +224,6 @@ "intersection-observer": "^0.11.0", "jest": "^26.0.0", "jest-image-snapshot": "^4.0.0", - "jest-stare": "^2.0.1", "jquery": "^3.4.1", "jsdom": "^16.0.0", "jsonml.js": "^0.1.0", diff --git a/tests/index.html b/tests/index.html index c4f924ec86cb..89c7f593ad46 100644 --- a/tests/index.html +++ b/tests/index.html @@ -4,7 +4,11 @@ Amazing Antd - +
diff --git a/tests/shared/imageTest.ts b/tests/shared/imageTest.ts index 60bcb7ffc800..2eeb21ceb88d 100644 --- a/tests/shared/imageTest.ts +++ b/tests/shared/imageTest.ts @@ -2,8 +2,14 @@ import React from 'react'; // Reference: https://github.com/ant-design/ant-design/pull/24003#discussion_r427267386 // eslint-disable-next-line import/no-unresolved import puppeteer, { Browser, Page } from 'puppeteer'; -import { toMatchImageSnapshot } from 'jest-image-snapshot'; +import { configureToMatchImageSnapshot } from 'jest-image-snapshot'; import ReactDOMServer from 'react-dom/server'; +import glob from 'glob'; + +const toMatchImageSnapshot = configureToMatchImageSnapshot({ + customSnapshotsDir: `${process.cwd()}/imageSnapshots`, + customDiffDir: `${process.cwd()}/imageDiffSnapshots`, +}); expect.extend({ toMatchImageSnapshot }); @@ -45,3 +51,24 @@ export default function imageTest(component: React.ReactElement) { }); }); } + +type Options = { + skip?: boolean | string[]; +}; + +// eslint-disable-next-line jest/no-export +export function imageDemoTest(component: string, options: Options = {}) { + let testMethod = options.skip === true ? describe.skip : describe; + const files = glob.sync(`./components/${component}/demo/*.md`); + + files.forEach(file => { + if (Array.isArray(options.skip) && options.skip.some(c => file.includes(c))) { + testMethod = test.skip; + } + testMethod(`Test ${file} image`, () => { + // eslint-disable-next-line global-require,import/no-dynamic-require + const demo = require(`../.${file}`).default; + imageTest(demo); + }); + }); +}