Skip to content

Commit

Permalink
feat: next pageIframe (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuineng authored Nov 7, 2023
1 parent 8a10dc2 commit 2e26538
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
9 changes: 9 additions & 0 deletions lib/next/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
'use strict';

module.exports = wd => {
[
'pageIframe',
].forEach(method => {
wd.addPromiseChainMethod(method, function(...params) {
const [ index, func, ...args ] = params;
return this.next(method, [{ index, func, args }]);
});
});

[
'page',
'pagePopup',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macaca-wd",
"version": "4.3.2",
"version": "4.3.3",
"description": "Macaca webdirver API for Node.js",
"keywords": [
"macaca",
Expand Down
16 changes: 16 additions & 0 deletions test/utility.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,22 @@ describe('test/utility.test.js', function() {
});
});
});
/**
* https://macacajs.github.io/macaca-wd/#pageIframe
*/
describe('pageIframe', async () => {
it('should work', async () => {
await driver.pageIframe('url');
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: '',
});
});
});

/**
* https://macacajs.github.io/macaca-wd/#browser
*/
Expand Down

0 comments on commit 2e26538

Please sign in to comment.