Skip to content

Commit

Permalink
Merge dc8261d into ea3dd30
Browse files Browse the repository at this point in the history
  • Loading branch information
paradite committed Mar 17, 2019
2 parents ea3dd30 + dc8261d commit 6ad9b83
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 21 deletions.
47 changes: 39 additions & 8 deletions test/cookie.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,65 @@ describe('test/cookie.test.js', function() {
*/
describe('allCookies', async () => {
it('should work', async () => {

await driver.allCookies();
assert.equal(server.ctx.url, '/wd/hub/session/sessionId/cookie');
assert.equal(server.ctx.method, 'GET');
});
});

/**
/**
* https://macacajs.github.io/macaca-wd/#deleteAllCookies
*/
describe('deleteAllCookies', async () => {
it('should work', async () => {

await driver.deleteAllCookies();
assert.equal(server.ctx.url, '/wd/hub/session/sessionId/cookie');
assert.equal(server.ctx.method, 'DELETE');
assert.deepEqual(server.ctx.request.body, {});
assert.deepEqual(server.ctx.response.body, {
sessionId: 'sessionId',
status: 0,
value: ''
});
});
});

/**
/**
* https://macacajs.github.io/macaca-wd/#deleteCookie
*/
describe('deleteCookie', async () => {
it('should work', async () => {

await driver.deleteCookie('test_cookie');
assert.equal(
server.ctx.url,
'/wd/hub/session/sessionId/cookie/test_cookie'
);
assert.equal(server.ctx.method, 'DELETE');
assert.deepEqual(server.ctx.request.body, {});
assert.deepEqual(server.ctx.response.body, {
sessionId: 'sessionId',
status: 0,
value: ''
});
});
});

/**
/**
* https://macacajs.github.io/macaca-wd/#setCookie
*/
describe('setCookie', async () => {
it('should work', async () => {

await driver.setCookie('test_cookie');
assert.equal(server.ctx.url, '/wd/hub/session/sessionId/cookie');
assert.equal(server.ctx.method, 'POST');
assert.deepEqual(server.ctx.request.body, {
cookie: 'test_cookie'
});
assert.deepEqual(server.ctx.response.body, {
sessionId: 'sessionId',
status: 0,
value: ''
});
});
});
});
});
29 changes: 16 additions & 13 deletions test/utility.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('test/utility.test.js', function() {
assert.deepEqual(server.ctx.response.body, {
sessionId: 'sessionId',
status: 0,
value: '',
value: ''
});
});
});
Expand All @@ -63,7 +63,7 @@ describe('test/utility.test.js', function() {
assert.deepEqual(server.ctx.response.body, {
sessionId: 'sessionId',
status: 0,
value: '',
value: ''
});
});
});
Expand All @@ -80,7 +80,7 @@ describe('test/utility.test.js', function() {
assert.deepEqual(server.ctx.response.body, {
sessionId: 'sessionId',
status: 0,
value: '',
value: ''
});
});
});
Expand All @@ -97,7 +97,7 @@ describe('test/utility.test.js', function() {
assert.deepEqual(server.ctx.response.body, {
sessionId: 'sessionId',
status: 0,
value: '',
value: ''
});
});
});
Expand All @@ -114,30 +114,33 @@ describe('test/utility.test.js', function() {
assert.deepEqual(server.ctx.response.body, {
sessionId: 'sessionId',
status: 0,
value: '',
value: ''
});
});
});

/**
/**
* https://macacajs.github.io/macaca-wd/#initWindow
*/
describe('initWindow', async () => {
it('should work', async () => {
await driver.initWindow({
width: 800,
height: 600,
height: 600
});
assert.equal(server.ctx.url, '/wd/hub/session/sessionId/window/current/size');
assert.equal(
server.ctx.url,
'/wd/hub/session/sessionId/window/current/size'
);
assert.equal(server.ctx.method, 'POST');
assert.deepEqual(server.ctx.request.body, {
width: 800,
height: 600,
height: 600
});
assert.deepEqual(server.ctx.response.body, {
sessionId: 'sessionId',
status: 0,
value: '',
value: ''
});
});
});
Expand All @@ -147,7 +150,7 @@ describe('test/utility.test.js', function() {
*/
describe.skip('openReporter', async () => {
it('should work', async () => {
await driver.openReporter();
await driver.openReporter(false);
});
});

Expand All @@ -156,13 +159,13 @@ describe('test/utility.test.js', function() {
*/
describe('saveScreenshots', async () => {
it('should work', async () => {
await driver.saveScreenshots();
await driver.saveScreenshots(this);
assert.equal(server.ctx.url, '/wd/hub/session/sessionId/screenshot');
assert.equal(server.ctx.method, 'GET');
assert.deepEqual(server.ctx.response.body, {
sessionId: 'sessionId',
status: 0,
value: '',
value: ''
});
});
});
Expand Down

0 comments on commit 6ad9b83

Please sign in to comment.