From b3f8a304424f1c91ae16b3a288b9f99acadc142d Mon Sep 17 00:00:00 2001 From: yihuineng <471110230@qq.com> Date: Thu, 12 Oct 2023 11:15:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81browser=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E6=96=B9=E6=B3=95=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/next/index.js | 3 ++- test/utility.test.js | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/next/index.js b/lib/next/index.js index cb79e5e1..6cf2194f 100644 --- a/lib/next/index.js +++ b/lib/next/index.js @@ -3,7 +3,8 @@ module.exports = wd => { [ 'page', - 'pagePopup' + 'pagePopup', + 'browser' ].map(method => { wd.addPromiseChainMethod(method, function(...params) { const [ func, ...args ] = params; 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: '' + }); + }); + }); });