Skip to content

Commit

Permalink
chore: update doc site
Browse files Browse the repository at this point in the history
  • Loading branch information
xudafeng committed Jan 20, 2023
1 parent 94b0c1b commit 839270b
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches:
- master
paths:
- 'docs/**'
- '**'

jobs:
docs-build:
Expand Down
62 changes: 1 addition & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

61 changes: 61 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
61 changes: 61 additions & 0 deletions docs/zh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 6 additions & 0 deletions docs/zh/apis/alert/acceptAlert.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
* 功能描述: 接受当前弹出的 alert 提示框。
* 支持平台: Android iOS
* 标准链接: [POST /session/:sessionId/accept_alert](https://w3c.github.io/webdriver/#accept-alert)

## 示例

```javascript
driver.acceptAlert();
```

0 comments on commit 839270b

Please sign in to comment.