diff --git a/README.md b/README.md index 40258f08..ccf69c7f 100644 --- a/README.md +++ b/README.md @@ -23,12 +23,12 @@ Macaca WD Client is inspired by [admc/wd](//github.com/admc/wd), according to [W ## Contributors -|[
xudafeng](https://github.com/xudafeng)
|[
ziczhu](https://github.com/ziczhu)
|[
zhangyuheng](https://github.com/zhangyuheng)
|[
paradite](https://github.com/paradite)
|[
meowtec](https://github.com/meowtec)
|[
Jodeee](https://github.com/Jodeee)
| +|[
xudafeng](https://github.com/xudafeng)
|[
ziczhu](https://github.com/ziczhu)
|[
zhangyuheng](https://github.com/zhangyuheng)
|[
paradite](https://github.com/paradite)
|[
meowtec](https://github.com/meowtec)
|[
yihuineng](https://github.com/yihuineng)
| | :---: | :---: | :---: | :---: | :---: | :---: | -|[
snapre](https://github.com/snapre)
|[
zivyangll](https://github.com/zivyangll)
|[
tsj1107](https://github.com/tsj1107)
|[
yihuineng](https://github.com/yihuineng)
|[
megolee](https://github.com/megolee)
|[
kobe990](https://github.com/kobe990)
| +|[
Jodeee](https://github.com/Jodeee)
|[
snapre](https://github.com/snapre)
|[
zivyangll](https://github.com/zivyangll)
|[
tsj1107](https://github.com/tsj1107)
|[
megolee](https://github.com/megolee)
|[
kobe990](https://github.com/kobe990)
| [
centy720](https://github.com/centy720)
|[
zhuyali](https://github.com/zhuyali)
-This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Wed Jul 26 2023 20:31:43 GMT+0800`. +This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Thu Oct 12 2023 11:41:18 GMT+0800`. diff --git a/lib/next/index.js b/lib/next/index.js index 1366a377..6cf2194f 100644 --- a/lib/next/index.js +++ b/lib/next/index.js @@ -3,15 +3,17 @@ module.exports = wd => { [ 'page', - 'pagePopup' + 'pagePopup', + 'browser' ].map(method => { wd.addPromiseChainMethod(method, function(...params) { - const [func, ...args] = params; - return this.next(method, [{ func, args }]); + const [ func, ...args ] = params; + return this.next(method, [ { func, args } ]); }); }); [ + 'fileChooser', 'elementStatus' ].map(method => { wd.addPromiseChainMethod(method, function(...params) { @@ -19,21 +21,13 @@ module.exports = wd => { }); }); - [ - 'fileChooser' - ].map(method => { - wd.addPromiseChainMethod(method, function(...params) { - return this.next(method, params); - }); - }); - [ 'mouse', 'keyboard' ].map(method => { wd.addPromiseChainMethod(method, function(...params) { - const [type, ...args] = params; - return this.next(method, [{ type, args }]); + const [ type, ...args ] = params; + return this.next(method, [ { type, args } ]); }); }); }; diff --git a/package.json b/package.json index 34949da7..f294b8f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "macaca-wd", - "version": "4.2.2", + "version": "4.2.3", "description": "Macaca webdirver API for Node.js", "keywords": [ "macaca", diff --git a/test/utility.test.js b/test/utility.test.js index a1ab57e1..d4052291 100644 --- a/test/utility.test.js +++ b/test/utility.test.js @@ -213,4 +213,19 @@ describe('test/utility.test.js', function() { }); }); }); + /** + * https://macacajs.github.io/macaca-wd/#browser + */ + describe('browser', async () => { + it('should work', async () => { + await driver.browser('version'); + assert.equal(server.ctx.url, '/wd/hub/session/sessionId/next'); + assert.equal(server.ctx.method, 'POST'); + assert.deepEqual(server.ctx.response.body, { + sessionId: 'sessionId', + status: 0, + value: '' + }); + }); + }); });