From ef670953dd5108ae34960ac07f88e4aa2a781c6f Mon Sep 17 00:00:00 2001 From: yihuineng <471110230@qq.com> Date: Mon, 6 Nov 2023 20:36:14 +0800 Subject: [PATCH] feat: next pageIframe --- lib/next/index.js | 9 +++++++++ package.json | 2 +- test/utility.test.js | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/next/index.js b/lib/next/index.js index 0ec3560..beac1e9 100644 --- a/lib/next/index.js +++ b/lib/next/index.js @@ -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', diff --git a/package.json b/package.json index 0b1b2b1..0b75304 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "macaca-wd", - "version": "4.3.2", + "version": "4.3.3", "description": "Macaca webdirver API for Node.js", "keywords": [ "macaca", diff --git a/test/utility.test.js b/test/utility.test.js index 7fcbc42..9e555db 100644 --- a/test/utility.test.js +++ b/test/utility.test.js @@ -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 */