tees
is a complex of E2E test framework, it's based on jest
as test runner.
- Getting Started
- Additional Configuration
- Tutorial
- Advanced Guides
- API Reference
- Benchmark Results
- Contribution Guide
- Initialize tees by cli:
npx tees init yourProjectName
- Tees will ask you a few questions and will create a basic configuration file and an example file. Press Enter key to choose the default configuration.
- Running from the command line, there is a folder "yourProjectName" under the current path:
cd yourProjectName
Run yarn install to install the necessary dependencies. It will take you several minutes.
yarn install
Run your E2E case:
npx tees run ./src/example.spec.js
Based on your project, there are several things need to config in e2e.config.js
file.
Add params in e2e.config.js
, such as the project name, the type of your project.
module.exports = {
params: {
projects: {
//project name
'example': {
//uri or extension
type: 'uri',
//if your project is an extension, you need to add source path
location: 'https://cn.bing.com/',
}
}
},
//...
};
Change the selectorLabel to what you are using, eg. class, id, or any other tag name.
module.exports = {
selectorLabel: 'class',
//...
};
The default execution timeout for each test case is 2 minutes. If you want to change it to 20 minutes, you can add timeout in e2e.config.
module.exports = {
timeout: 1000 * 60 * 20,
//...
};
A simplest command can be: npx tees run yourTestFilePath
Use CLI params to control the test you are running:
Reference | Short key | Params | default |
---|---|---|---|
--params | -P | -P {} | None |
--drivers | -D | -D {drivers} | all drivers |
--sandbox | -S | -S | disable |
--debugger | -X | -X | disable |
--headless | -H | -H | disable |
--exclude | -E | -E {filePath} | disable |
--verbose | -A | -A | false |
--retry | -T | -T {retryNumber} | 0 |
--report | -R | -R | disable |
--testerCLI | -C | -C | disable |
Run all cases which met all these params.
-P '{brands:["rc"],levels:["p0","p1"],tags:[["widgets"]]}'
Run case on specific driver
-D puppeteer
or use ',' to split difference drivers
-D puppeteer,chrome
supported drivers:
- puppeteer
- chrome
- firefox
- edge
- ie
- safari
- enyzme
With sandbox mode, every case will start a totally new driver. Without sandbox mode, every run will only start a driver.
With debugger mode, some additional debug message will output. Default OFF.
Headless default OFF.
Use exclude to ignore some unnecessary path.
-E ./node_modules/
to ignore more than one path
-E ./node_modules/ ./__temp__/
Enable verbose to get more imformation when debugging.
Rerun case when there are some error occur. The default value of retry time is 0. The maximum retry times is 10.
-T 3
Enable reporter will push your console output to an on-line web.
Jest CLI. Pass params to jest via this testerCLI.
-C '--findRelatedTests path/to/fileA.js path/to/fileB.js'
Note: And you can append all these commands together.
The command below will run test file 1 and 2 in puppeteer on sandbox and headless mode. Example:
npx tees run yourTestFilePath1 yourTestFilePath2 -D puppeteer -S -H
Reference | Description | type | default |
---|---|---|---|
--params | Run E2E test case with some params filtering. | object | None |
--sandbox | Run E2E test case with 'sandbox' mode. | disable | |
--debugger | Run E2E test case with 'debugger' mode. | disable | |
--headless | Run E2E test case with 'headless' mode. | disable | |
--exclude | Run E2E test case exclude some files. | disable | |
--verbose | Run E2E test case with verbose log. | false | |
--retry | Run E2E test case with retry times. | 0 |
Reference | Description | type |
---|---|---|
lookupConfig | Look up executive config from this config file. | function |
params | Setting project basic information. | object |
Reference | Description | arguments |
---|---|---|
goto | Current page goto a new page with a url. | (config) |
clear | Clear the value of this element. | (selector, options) |
newPage | Create a new page in a default browser context. | () |
closePage | Closes the current window. | () |
Reference | Description | arguments |
---|---|---|
getText | Get text from a selector. | (selector[, options]) |
goto | Current page goto a new page with a url. | (config) |
click | left-click with the mouse. | (selector, options) |
type | Enter a value on the selector. | (selector, value, options) |
waitForSelector | Wait for the selector to appear in page. | (selector, options) |
waitForFrames | Wait for the iframes to appear in page and return a frame. | (frameSelector) |
screenshot | Takes a screenshot of the current page. | (path) |
execute | Executes JavaScript in sandbox env. | (...args) |
Reference | Description | callback arguments |
---|---|---|
driver.addAfterHook | After each case ends. | - |
example:
context.driver.addAfterHook(async () => {
await process.exec(Logout);
});
// device and environmental information
Drivers | cases | threads | sandbox | performance | stability |
---|---|---|---|---|---|
puppeteer/Firefox/Chrome/Safari | 1600 | 1 | 1312.125s | ✅ | |
puppeteer | 400 | 8 | 96.44s | ✅ | |
puppeteer | 400 | 1 | 237.614s | ✅ | |
puppeteer | 400 | 8 | ✅ | 289.44s | ✅ |
Chrome | 400 | 8 | 103.665s | ✅ | |
Firefox | 400 | 8 | 415.726s | ✅ | |
puppeteer/Firefox/Chrome | 1200 | 8 | 630.503s | ||
Safari | 400 | 8 | - | ❌ | |
Enzyme | 400 | 1 | ✅ | 374.998s | ✅ |
Enzyme | 400 | 8 | ✅ | 149.882s | ✅ |
Enzyme | 400 | 1 | - | ❌ |
Chrome
is selenium webdriver's Chrome.
Selenium webdriver multithreading operation is not stable.
Selenium Webdriver Safari does not support multithreading.
Enzyme does not support non-sandbox mode(Default forced sandbox mode).
Read our contribution guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Tees.
Tees is MIT licensed.