Browse Source

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
pull/27332/head
骗你是小猫咪 4 years ago
committed by GitHub
parent
commit
6fba4d1136
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .gitignore
  2. 3
      .jest.image.js
  3. 3
      .jest.js
  4. 41
      azure-pipelines.yml
  5. 5
      components/affix/__tests__/image.test.ts
  6. 5
      components/alert/__tests__/image.test.ts
  7. 5
      components/anchor/__tests__/image.test.ts
  8. 5
      components/auto-complete/__tests__/image.test.ts
  9. 5
      components/avatar/__tests__/image.test.ts
  10. 5
      components/back-top/__tests__/image.test.ts
  11. 5
      components/badge/__tests__/image.test.ts
  12. 5
      components/breadcrumb/__tests__/image.test.ts
  13. BIN
      components/button/__tests__/__image_snapshots__/image-test-js-button-image-image-test-component-image-screenshot-should-correct-1-snap.png
  14. 14
      components/button/__tests__/image.test.js
  15. 5
      components/button/__tests__/image.test.ts
  16. 5
      components/calendar/__tests__/image.test.ts
  17. 5
      components/card/__tests__/image.test.ts
  18. 5
      components/carousel/__tests__/image.test.ts
  19. 5
      components/cascader/__tests__/image.test.ts
  20. 5
      components/checkbox/__tests__/image.test.ts
  21. 5
      components/collapse/__tests__/image.test.ts
  22. 5
      components/comment/__tests__/image.test.ts
  23. 5
      components/config-provider/__tests__/image.test.ts
  24. 5
      components/date-picker/__tests__/image.test.ts
  25. 5
      components/descriptions/__tests__/image.test.ts
  26. 5
      components/divider/__tests__/image.test.ts
  27. 5
      components/drawer/__tests__/image.test.ts
  28. 5
      components/dropdown/__tests__/image.test.ts
  29. 5
      components/empty/__tests__/image.test.ts
  30. 5
      components/form/__tests__/image.test.ts
  31. BIN
      components/grid/__tests__/__image_snapshots__/image-test-js-grid-image-image-test-component-image-screenshot-should-correct-1-snap.png
  32. 37
      components/grid/__tests__/image.test.js
  33. 5
      components/grid/__tests__/image.test.ts
  34. 5
      components/icon/__tests__/image.test.ts
  35. 5
      components/input-number/__tests__/image.test.ts
  36. 5
      components/input/__tests__/image.test.ts
  37. 5
      components/layout/__tests__/image.test.ts
  38. 5
      components/list/__tests__/image.test.ts
  39. 5
      components/mentions/__tests__/image.test.ts
  40. 5
      components/menu/__tests__/image.test.ts
  41. 5
      components/message/__tests__/image.test.ts
  42. 5
      components/modal/__tests__/image.test.ts
  43. 5
      components/notification/__tests__/image.test.ts
  44. 5
      components/page-header/__tests__/image.test.ts
  45. 5
      components/pagination/__tests__/image.test.ts
  46. 5
      components/popconfirm/__tests__/image.test.ts
  47. 5
      components/popover/__tests__/image.test.ts
  48. 5
      components/progress/__tests__/image.test.ts
  49. 5
      components/radio/__tests__/image.test.ts
  50. 5
      components/rate/__tests__/image.test.ts
  51. 5
      components/result/__tests__/image.test.ts
  52. 5
      components/select/__tests__/image.test.ts
  53. 5
      components/skeleton/__tests__/image.test.ts
  54. 5
      components/slider/__tests__/image.test.ts
  55. 5
      components/space/__tests__/image.test.ts
  56. 5
      components/statistic/__tests__/image.test.ts
  57. 5
      components/steps/__tests__/image.test.ts
  58. 5
      components/switch/__tests__/image.test.ts
  59. 5
      components/table/__tests__/image.test.ts
  60. 5
      components/tabs/__tests__/image.test.ts
  61. 5
      components/tag/__tests__/image.test.ts
  62. 5
      components/time-picker/__tests__/image.test.ts
  63. 5
      components/timeline/__tests__/image.test.ts
  64. 5
      components/tooltip/__tests__/image.test.ts
  65. 5
      components/transfer/__tests__/image.test.ts
  66. 5
      components/tree-select/__tests__/image.test.ts
  67. 5
      components/tree/__tests__/image.test.ts
  68. 5
      components/typography/__tests__/image.test.ts
  69. 5
      components/upload/__tests__/image.test.ts
  70. 5
      docker-compose.yml
  71. 5
      package.json
  72. 6
      tests/index.html
  73. 29
      tests/shared/imageTest.ts

3
.gitignore

@ -61,4 +61,7 @@ components/version/version.tsx
# Image snapshot diff
__diff_output__/
__image_snapshots__/
/jest-stare
/imageSnapshots
/imageDiffSnapshots

3
.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'],
};

3
.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'],

41
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 "[<img width="306" src="https://user-images.githubusercontent.com/14831261/82744259-6e5ee200-9da8-11ea-8479-685f6e280b77.jpg">](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 "[<img width="306" src="https://user-images.githubusercontent.com/14831261/82744257-6dc64b80-9da8-11ea-80cf-05b2279a5602.jpg">](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'

5
components/affix/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Affix image', () => {
imageDemoTest('affix');
});

5
components/alert/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Alert image', () => {
imageDemoTest('alert');
});

5
components/anchor/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Anchor image', () => {
imageDemoTest('anchor');
});

5
components/auto-complete/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('AutoComplete image', () => {
imageDemoTest('auto-complete');
});

5
components/avatar/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Avatar image', () => {
imageDemoTest('avatar');
});

5
components/back-top/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('BackTop image', () => {
imageDemoTest('back-top');
});

5
components/badge/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Badge image', () => {
imageDemoTest('badge');
});

5
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'] });
});

BIN
components/button/__tests__/__image_snapshots__/image-test-js-button-image-image-test-component-image-screenshot-should-correct-1-snap.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

14
components/button/__tests__/image.test.js

@ -1,14 +0,0 @@
import React from 'react';
import Button from '..';
import imageTest from '../../../tests/shared/imageTest';
describe('Button image', () => {
imageTest(
<>
<Button type="primary">Primary</Button>
<Button>Default</Button>
<Button type="dashed">Dashed</Button>
<Button type="link">Link</Button>
</>,
);
});

5
components/button/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Button image', () => {
imageDemoTest('button', { skip: ['loading.md'] });
});

5
components/calendar/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Calendar image', () => {
imageDemoTest('calendar');
});

5
components/card/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Card image', () => {
imageDemoTest('card');
});

5
components/carousel/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Carousel image', () => {
imageDemoTest('carousel');
});

5
components/cascader/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Cascader image', () => {
imageDemoTest('cascader');
});

5
components/checkbox/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Checkbox image', () => {
imageDemoTest('checkbox');
});

5
components/collapse/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Collapse image', () => {
imageDemoTest('collapse');
});

5
components/comment/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Comment image', () => {
imageDemoTest('comment');
});

5
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'] });
});

5
components/date-picker/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('DatePicker image', () => {
imageDemoTest('date-picker');
});

5
components/descriptions/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Descriptions image', () => {
imageDemoTest('descriptions');
});

5
components/divider/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Divider image', () => {
imageDemoTest('divider');
});

5
components/drawer/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Drawer image', () => {
imageDemoTest('drawer');
});

5
components/dropdown/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Dropdown image', () => {
imageDemoTest('dropdown');
});

5
components/empty/__tests__/image.test.ts

@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Empty image', () => {
imageDemoTest('empty');
});

5
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'] });
});