Skip to content

Commit

Permalink
feat: use get with screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
zivyangll committed Jul 16, 2020
1 parent bb64a0b commit 434720f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 3 additions & 5 deletions test/screenshot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('test/screenshot.test.js', function() {
describe('saveScreenshot', async () => {
it('should work', async () => {
await driver.saveScreenshot();
assert.equal(server.ctx.method, 'POST');
assert.equal(server.ctx.method, 'GET');
assert.equal(server.ctx.url, '/wd/hub/session/screenshot');
assert.deepEqual(server.ctx.request.body, {});
assert.deepEqual(server.ctx.response.body, {
Expand All @@ -50,10 +50,8 @@ describe('test/screenshot.test.js', function() {
*/
describe('takeScreenshot', async () => {
it('should work', async () => {
await driver.takeScreenshot('', {
fullPage: true,
});
assert.equal(server.ctx.method, 'POST');
await driver.takeScreenshot();
assert.equal(server.ctx.method, 'GET');
assert.equal(server.ctx.url, '/wd/hub/session/screenshot');
assert.deepEqual(server.ctx.request.body, {});
assert.deepEqual(server.ctx.response.body, {
Expand Down
5 changes: 2 additions & 3 deletions wd/lib/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -1104,10 +1104,9 @@ commands.takeScreenshot = function() {
var cb = findCallback(arguments);
var params = arguments[0];
this._jsonWireCall({
method: 'POST'
, relPath: '/screenshot'
method: 'GET'
, relPath: `/screenshot${url.format({query: params})}`
, cb: callbackWithData(cb, this)
, data: params
});
};

Expand Down

0 comments on commit 434720f

Please sign in to comment.