diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml index a55bb723..071e7415 100644 --- a/.github/workflows/docs-build.yml +++ b/.github/workflows/docs-build.yml @@ -7,7 +7,7 @@ on: branches: - master paths: - - 'docs/**' + - '**' jobs: docs-build: diff --git a/README.md b/README.md index 1361c687..5a2c380a 100644 --- a/README.md +++ b/README.md @@ -40,66 +40,6 @@ $ npm i macaca-wd --save-dev ## Documentation -### Usage +https://macacajs.github.io/macaca-wd -```javascript -var wd = require('macaca-wd'); - -var remoteConfig = { - host: 'localhost', - port: 3456 -}; - -var driver = wd.promiseChainRemote(remoteConfig); - -before(function() { - return driver.init({ - platformName: 'desktop', // iOS, Android, Desktop, Playwright - browserName: 'chrome', // chromium, firefox, webkit - app: 'path/to/app', // Only for mobile - }); -}); - -after(function() { - return driver - .sleep(1000) - .quit(); -}); - -it('#1 should', function() { - - ... - -}); - -... - -``` - -### Mixin Helper - -```javascript -import wd from 'macaca-wd'; -import { - extendsMixIn, -} from 'macaca-wd/lib/helper' - -extendsMixIn(wd) -``` - -[see more about helper](./lib/helper.js) - -### Extend WD chain - -```javascript -import wd from 'macaca-wd'; - -wd.addPromiseChainMethod(name, method); -``` - -[API](//macacajs.github.io/macaca-wd/) - -## Demo - -[Macaca Getting Started](//macacajs.github.io/environment-setup) diff --git a/docs/README.md b/docs/README.md index 4273fb72..b4597a2a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -14,3 +14,64 @@ Macaca is an open-source automation test solution for native, hybrid, mobile web ```bash $ npm i macaca-wd -D ``` + +## Usage + +```javascript +const wd = require('macaca-wd'); + +const remoteConfig = { + host: 'localhost', + port: 3456 +}; + +var driver = wd.promiseChainRemote(remoteConfig); + +before(function() { + return driver.init({ + platformName: 'desktop', // iOS, Android, Desktop, Playwright + browserName: 'chrome', // chromium, firefox, webkit + app: 'path/to/app', // Only for mobile + }); +}); + +after(function() { + return driver + .sleep(1000) + .quit(); +}); + +it('#1 should', function() { + + ... + +}); + +... + +``` + +## Mixin Helper + +```javascript +import wd from 'macaca-wd'; +import { + extendsMixIn, +} from 'macaca-wd/lib/helper' + +extendsMixIn(wd) +``` + +## Extend WD chain + +```javascript +import wd from 'macaca-wd'; + +wd.addPromiseChainMethod(name, method); +``` + +[API](//macacajs.github.io/macaca-wd/apis) + +## Demo + +[Macaca Getting Started](//macacajs.github.io/environment-setup) diff --git a/docs/zh/README.md b/docs/zh/README.md index 702bb457..7662be1b 100644 --- a/docs/zh/README.md +++ b/docs/zh/README.md @@ -15,3 +15,64 @@ API 文档 ```bash $ npm i macaca-wd -D ``` + +## 使用 + +```javascript +const wd = require('macaca-wd'); + +const remoteConfig = { + host: 'localhost', + port: 3456 +}; + +var driver = wd.promiseChainRemote(remoteConfig); + +before(function() { + return driver.init({ + platformName: 'desktop', // iOS, Android, Desktop, Playwright + browserName: 'chrome', // chromium, firefox, webkit + app: 'path/to/app', // Only for mobile + }); +}); + +after(function() { + return driver + .sleep(1000) + .quit(); +}); + +it('#1 should', function() { + + ... + +}); + +... + +``` + +## 集成 Helper + +```javascript +import wd from 'macaca-wd'; +import { + extendsMixIn, +} from 'macaca-wd/lib/helper' + +extendsMixIn(wd) +``` + +## 扩展更多 API + +```javascript +import wd from 'macaca-wd'; + +wd.addPromiseChainMethod(name, method); +``` + +[API](//macacajs.github.io/macaca-wd/zh/apis) + +## 示例 + +[Macaca Getting Started](//macacajs.github.io/environment-setup) diff --git a/docs/zh/apis/alert/acceptAlert.md b/docs/zh/apis/alert/acceptAlert.md index f9fde53b..323fe648 100644 --- a/docs/zh/apis/alert/acceptAlert.md +++ b/docs/zh/apis/alert/acceptAlert.md @@ -3,3 +3,9 @@ * 功能描述: 接受当前弹出的 alert 提示框。 * 支持平台: Android iOS * 标准链接: [POST /session/:sessionId/accept_alert](https://w3c.github.io/webdriver/#accept-alert) + +## 示例 + +```javascript +driver.acceptAlert(); +``` \ No newline at end of file