-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
translate ui-test #151
translate ui-test #151
Conversation
docs/ui-test.en-US.md
Outdated
--- | ||
order: 15 | ||
title: UI Test | ||
type: 进阶 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
漏翻了..
docs/ui-test.en-US.md
Outdated
type: 进阶 | ||
--- | ||
|
||
UI testing is an important part of the project development process. Effective test cases can sort out business needs and ensure the quality and progress of development, It make engineers can refactor the code and add new features without trepidation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it enables developers to refactor the code and add new features safely.
docs/ui-test.en-US.md
Outdated
|
||
UI testing is an important part of the project development process. Effective test cases can sort out business needs and ensure the quality and progress of development, It make engineers can refactor the code and add new features without trepidation. | ||
|
||
Ant Design Pro comes packaged with a handy set of easy-to-use React unit tests and E2E test framework to run test cases by running the following command at the project root. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
easy-to-use 可以删掉
需要断句 -> Ant Design Pro comes packaged with a handy set of React unit tests and E2E test framework, you can run the following command in the root repository to run test cases:
docs/ui-test.en-US.md
Outdated
|
||
<img src="https://gw.alipayobjects.com/zos/rmsportal/bNkhdMosBxuEhhKgnROo.png" width="700" /> | ||
|
||
Now we start a quick introduction to writing your business test cases in your project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we'll give a brief introduction about how to write a test case.
docs/ui-test.en-US.md
Outdated
|
||
## Unit Tests | ||
|
||
Unit tests are used to test the appearance of React UI components。We referenced [create-react-app](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#running-tests), using [jest](http://facebook.github.io/jest/) as a test framework. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
中文句号
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By referencing create-react-app, we take jest as the test framework.
docs/ui-test.en-US.md
Outdated
|
||
Unit tests are used to test the appearance of React UI components。We referenced [create-react-app](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#running-tests), using [jest](http://facebook.github.io/jest/) as a test framework. | ||
|
||
jest is a node-side test framework that uses jsdom to simulate the DOM environment and is suitable for quick testing of the logical behavior of React components. If requiring a real browser, please refer to the E2E test section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
首字母大写
If you care about the performance in a real browser ...
docs/ui-test.en-US.md
Outdated
|
||
### Write a case | ||
|
||
For example, we could create a file `src/routes/Result/Success.test.js` to test the UI appearance of successful page components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... to test the UI appearance of Result/Success.js
.
docs/ui-test.en-US.md
Outdated
}); | ||
``` | ||
|
||
Here [enzyme](http://airbnb.io/enzyme/docs/api/index.html) is used as a test library, which provides a number of useful APIs to help us test React components. Assert part use the jest acquiescence [jasmine2 expect grammar](https://facebook.github.io/jest/docs/en/expect.html#content). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for the assertion library, we choose jasmine2 expect grammar.
docs/ui-test.en-US.md
Outdated
|
||
### Local execution | ||
|
||
Use the following command will be search and execute `* .test.js` format test case file in `src`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Files with suffix * .test.js
in src
will be found out and executed by using the following command:
docs/ui-test.en-US.md
Outdated
$ npm test .test.js | ||
``` | ||
|
||
#### Executes a single or a set of cases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Execute
docs/ui-test.en-US.md
Outdated
|
||
### Test dva wrapped components | ||
|
||
Components wrapped by dva `connect` can use the following way to test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use the following way to test the components wrapped by dva connect
.
}); | ||
``` | ||
|
||
## e2e test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e2e 部分已替换为 Puppeteer,中文文档需要更新,这里先忽略吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@valleykid 这部分文档需要更新
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,我近期提个pr修改下文档
docs/ui-test.en-US.md
Outdated
$ npm test -- --watch | ||
``` | ||
|
||
Add `--watch` configuration can enter the watch mode, when you modify and save the file, Jest will automatically execute the corresponding test cases. Jest's command line tools also provide a variety of convenient shortcuts to execute the use cases you need. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By adding --watch
configuration you can enter the watch mode, in which
when you modify and save the file...
Jest -> jest
docs/ui-test.en-US.md
Outdated
|
||
<img src="https://camo.githubusercontent.com/bd0bbda8e44ea747e4c199d0e212d40563ad2fcb/687474703a2f2f692e696d6775722e636f6d2f356246686e54532e706e67" width="700" /> | ||
|
||
## Focus or ignore use cases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use -> test
docs/ui-test.en-US.md
Outdated
|
||
## Access integration testing services | ||
|
||
If you need access to integrated test environment such as travis, CircleCI, Gitlab CI, you can refer to `.travis.yml` provided by this repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
integrated test -> integration testing
provided by this repository. 给个master的文件链接,中文也加下吧
docs/ui-test.en-US.md
Outdated
|
||
If you need access to integrated test environment such as travis, CircleCI, Gitlab CI, you can refer to `.travis.yml` provided by this repository. | ||
|
||
Note that the e2e test requires integrated environment support, and if not, you can run unit tests separately using `npm test .test.js`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
support electron
并加个链接
docs/ui-test.en-US.md
Outdated
|
||
## Reference link | ||
|
||
For more testing tips and functions, please refer to the following link. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
links
docs/ui-test.en-US.md
Outdated
|
||
Ant Design Pro comes packaged with a handy set of easy-to-use React unit tests and E2E test framework to run test cases by running the following command at the project root. | ||
Ant Design Pro comes packaged with a handy set of React unit tests and E2E test framework, you can run the following command in the root repository to run test cases by running the following command at the project root. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by running the following command at the project root. 重复了
56f4487
to
985b249
Compare
985b249
to
ee504a3
Compare
docs/ui-test.en-US.md
Outdated
|
||
End-to-end testing, also known as smoke testing, is used to test the process and appearance of front-end applications in a real-world browser environment, equivalent to operating application instead of manually. | ||
|
||
We import [puppeteer](https://github.com/googlechrome/puppeteer) as a tool for E2E testing, 测试的工具,puppeteer is a headless Chrome tool which created by Google, it use chrome / chromium as the browser environment by default to runing your application, and provides a very semantic API for describing business logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
测试的工具
乱入...
合并后记得删分支 |
No description provided.