Skip to content

Commit

Permalink
feat: 支持browser对象方法调用
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuineng committed Oct 12, 2023
1 parent ddcf2a4 commit b3f8a30
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/next/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
module.exports = wd => {
[
'page',
'pagePopup'
'pagePopup',
'browser'
].map(method => {
wd.addPromiseChainMethod(method, function(...params) {
const [ func, ...args ] = params;
Expand Down
15 changes: 15 additions & 0 deletions test/utility.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: ''
});
});
});
});

0 comments on commit b3f8a30

Please sign in to comment.