Skip to content

Commit

Permalink
test: demo -> ui test (ant-design#24475)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
shaodahong authored Oct 23, 2020
1 parent 06b25b4 commit 6fba4d1
Show file tree
Hide file tree
Showing 73 changed files with 353 additions and 98 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,7 @@ components/version/version.tsx

# Image snapshot diff
__diff_output__/
__image_snapshots__/
/jest-stare
/imageSnapshots
/imageDiffSnapshots
3 changes: 1 addition & 2 deletions .jest.image.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -20,5 +20,4 @@ module.exports = {
tsConfigFile: './tsconfig.test.json',
},
},
reporters: ['default', 'jest-stare'],
};
3 changes: 2 additions & 1 deletion .jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'],
Expand Down
41 changes: 2 additions & 39 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 5 additions & 0 deletions components/affix/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Affix image', () => {
imageDemoTest('affix');
});
5 changes: 5 additions & 0 deletions components/alert/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Alert image', () => {
imageDemoTest('alert');
});
5 changes: 5 additions & 0 deletions components/anchor/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Anchor image', () => {
imageDemoTest('anchor');
});
5 changes: 5 additions & 0 deletions components/auto-complete/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('AutoComplete image', () => {
imageDemoTest('auto-complete');
});
5 changes: 5 additions & 0 deletions components/avatar/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Avatar image', () => {
imageDemoTest('avatar');
});
5 changes: 5 additions & 0 deletions components/back-top/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('BackTop image', () => {
imageDemoTest('back-top');
});
5 changes: 5 additions & 0 deletions components/badge/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Badge image', () => {
imageDemoTest('badge');
});
5 changes: 5 additions & 0 deletions components/breadcrumb/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Breadcrumb image', () => {
imageDemoTest('breadcrumb', { skip: ['router-4.md'] });
});
Binary file not shown.
14 changes: 0 additions & 14 deletions components/button/__tests__/image.test.js

This file was deleted.

5 changes: 5 additions & 0 deletions components/button/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Button image', () => {
imageDemoTest('button', { skip: ['loading.md'] });
});
5 changes: 5 additions & 0 deletions components/calendar/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Calendar image', () => {
imageDemoTest('calendar');
});
5 changes: 5 additions & 0 deletions components/card/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Card image', () => {
imageDemoTest('card');
});
5 changes: 5 additions & 0 deletions components/carousel/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Carousel image', () => {
imageDemoTest('carousel');
});
5 changes: 5 additions & 0 deletions components/cascader/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Cascader image', () => {
imageDemoTest('cascader');
});
5 changes: 5 additions & 0 deletions components/checkbox/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Checkbox image', () => {
imageDemoTest('checkbox');
});
5 changes: 5 additions & 0 deletions components/collapse/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Collapse image', () => {
imageDemoTest('collapse');
});
5 changes: 5 additions & 0 deletions components/comment/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Comment image', () => {
imageDemoTest('comment');
});
5 changes: 5 additions & 0 deletions components/config-provider/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('ConfigProvider image', () => {
imageDemoTest('config-provider', { skip: ['direction.md'] });
});
5 changes: 5 additions & 0 deletions components/date-picker/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('DatePicker image', () => {
imageDemoTest('date-picker');
});
5 changes: 5 additions & 0 deletions components/descriptions/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Descriptions image', () => {
imageDemoTest('descriptions');
});
5 changes: 5 additions & 0 deletions components/divider/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Divider image', () => {
imageDemoTest('divider');
});
5 changes: 5 additions & 0 deletions components/drawer/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Drawer image', () => {
imageDemoTest('drawer');
});
5 changes: 5 additions & 0 deletions components/dropdown/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Dropdown image', () => {
imageDemoTest('dropdown');
});
5 changes: 5 additions & 0 deletions components/empty/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Empty image', () => {
imageDemoTest('empty');
});
5 changes: 5 additions & 0 deletions components/form/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Form image', () => {
imageDemoTest('form', { skip: ['complex-form-control.md'] });
});
Binary file not shown.
37 changes: 0 additions & 37 deletions components/grid/__tests__/image.test.js

This file was deleted.

5 changes: 5 additions & 0 deletions components/grid/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Grid image', () => {
imageDemoTest('grid');
});
5 changes: 5 additions & 0 deletions components/icon/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Icon image', () => {
imageDemoTest('icon', { skip: ['basic.md'] });
});
5 changes: 5 additions & 0 deletions components/input-number/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('InputNumber image', () => {
imageDemoTest('input-number');
});
5 changes: 5 additions & 0 deletions components/input/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Input image', () => {
imageDemoTest('input', { skip: ['search-input-loading.md'] });
});
5 changes: 5 additions & 0 deletions components/layout/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Layout image', () => {
imageDemoTest('layout', { skip: ['countdown.md '] });
});
5 changes: 5 additions & 0 deletions components/list/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('List image', () => {
imageDemoTest('list');
});
5 changes: 5 additions & 0 deletions components/mentions/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Mentions image', () => {
imageDemoTest('mentions');
});
5 changes: 5 additions & 0 deletions components/menu/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Menu image', () => {
imageDemoTest('menu');
});
5 changes: 5 additions & 0 deletions components/message/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Message image', () => {
imageDemoTest('message');
});
5 changes: 5 additions & 0 deletions components/modal/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Modal image', () => {
imageDemoTest('modal');
});
5 changes: 5 additions & 0 deletions components/notification/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Notification image', () => {
imageDemoTest('notification');
});
5 changes: 5 additions & 0 deletions components/page-header/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('PageHeader image', () => {
imageDemoTest('page-header');
});
5 changes: 5 additions & 0 deletions components/pagination/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Pagination image', () => {
imageDemoTest('pagination');
});
5 changes: 5 additions & 0 deletions components/popconfirm/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Popconfirm image', () => {
imageDemoTest('popconfirm');
});
5 changes: 5 additions & 0 deletions components/popover/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Popover image', () => {
imageDemoTest('popover');
});
5 changes: 5 additions & 0 deletions components/progress/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Progress image', () => {
imageDemoTest('progress');
});
5 changes: 5 additions & 0 deletions components/radio/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Radio image', () => {
imageDemoTest('radio');
});
5 changes: 5 additions & 0 deletions components/rate/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Rate image', () => {
imageDemoTest('rate');
});
5 changes: 5 additions & 0 deletions components/result/__tests__/image.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';

describe('Result image', () => {
imageDemoTest('result');
});
Loading

0 comments on commit 6fba4d1

Please sign in to comment.