-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
463 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ coverage/ | |
.nyc_output/ | ||
docs/ | ||
.project | ||
reports/ | ||
*.tgz | ||
*.sw* | ||
*.un~ |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
|
||
const { Server } = require('./helper'); | ||
|
||
const wd = require('../lib/macaca-wd'); | ||
|
||
describe('test/browser.test.js', function() { | ||
let driver, server; | ||
before(() => { | ||
server = new Server(); | ||
server.start(); | ||
const remoteConfig = { | ||
host: 'localhost', | ||
port: 3456 | ||
}; | ||
|
||
driver = wd.promiseChainRemote(remoteConfig); | ||
driver.configureHttp({ | ||
timeout: 20 * 1000, | ||
retries: 5, | ||
retryDelay: 5 | ||
}); | ||
}); | ||
|
||
after(() => { | ||
server.stop(); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await driver.init({ | ||
platformName: 'desktop', | ||
browserName: 'chrome' | ||
}); | ||
}); | ||
|
||
/** | ||
* https://macacajs.github.io/macaca-wd/#back | ||
*/ | ||
describe('back', async () => { | ||
it('should work', async () => { | ||
await driver.back(); | ||
assert.equal(server.ctx.url, '/wd/hub/session/sessionId/back'); | ||
assert.equal(server.ctx.method, 'POST'); | ||
assert.deepEqual(server.ctx.response.body, { | ||
sessionId: 'sessionId', | ||
status: 0, | ||
value: '', | ||
}); | ||
}); | ||
}); | ||
|
||
/** | ||
* https://macacajs.github.io/macaca-wd/#forward | ||
*/ | ||
describe('forward', async () => { | ||
it('should work', async () => { | ||
await driver.forward(); | ||
assert.equal(server.ctx.url, '/wd/hub/session/sessionId/forward'); | ||
assert.equal(server.ctx.method, 'POST'); | ||
assert.deepEqual(server.ctx.response.body, { | ||
sessionId: 'sessionId', | ||
status: 0, | ||
value: '', | ||
}); | ||
}); | ||
}); | ||
|
||
/** | ||
* https://macacajs.github.io/macaca-wd/#get | ||
*/ | ||
describe('get', async () => { | ||
it('should work', async () => { | ||
await driver.get('https://github.com'); | ||
assert.equal(server.ctx.url, '/wd/hub/session/sessionId/url'); | ||
assert.equal(server.ctx.method, 'POST'); | ||
assert.deepEqual(server.ctx.request.body.url, 'https://github.com'); | ||
assert.deepEqual(server.ctx.response.body, { | ||
sessionId: 'sessionId', | ||
status: 0, | ||
value: '', | ||
}); | ||
}); | ||
}); | ||
|
||
/** | ||
* https://macacajs.github.io/macaca-wd/#maximize | ||
*/ | ||
describe('maximize', async () => { | ||
it('should work', async () => { | ||
await driver.maximize(); | ||
assert.equal(server.ctx.url, '/wd/hub/session/sessionId/window/current/maximize'); | ||
assert.equal(server.ctx.method, 'POST'); | ||
assert.deepEqual(server.ctx.response.body, { | ||
sessionId: 'sessionId', | ||
status: 0, | ||
value: '', | ||
}); | ||
}); | ||
}); | ||
|
||
/** | ||
* https://macacajs.github.io/macaca-wd/#maximize | ||
*/ | ||
describe('refresh', async () => { | ||
it('should work', async () => { | ||
await driver.refresh(); | ||
assert.equal(server.ctx.url, '/wd/hub/session/sessionId/refresh'); | ||
assert.equal(server.ctx.method, 'POST'); | ||
assert.deepEqual(server.ctx.response.body, { | ||
sessionId: 'sessionId', | ||
status: 0, | ||
value: '', | ||
}); | ||
}); | ||
}); | ||
}); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
|
||
const { Server } = require('./helper'); | ||
|
||
const wd = require('../lib/macaca-wd'); | ||
|
||
describe('test/cookie.test.js', function() { | ||
let driver, server; | ||
before(() => { | ||
server = new Server(); | ||
server.start(); | ||
const remoteConfig = { | ||
host: 'localhost', | ||
port: 3456 | ||
}; | ||
|
||
driver = wd.promiseChainRemote(remoteConfig); | ||
driver.configureHttp({ | ||
timeout: 20 * 1000, | ||
retries: 5, | ||
retryDelay: 5 | ||
}); | ||
}); | ||
|
||
after(() => { | ||
server.stop(); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await driver.init({ | ||
platformName: 'desktop', | ||
browserName: 'chrome' | ||
}); | ||
}); | ||
|
||
/** | ||
* https://macacajs.github.io/macaca-wd/#allCookies | ||
*/ | ||
describe('allCookies', async () => { | ||
it('should work', async () => { | ||
|
||
}); | ||
}); | ||
|
||
/** | ||
* https://macacajs.github.io/macaca-wd/#deleteAllCookies | ||
*/ | ||
describe('deleteAllCookies', async () => { | ||
it('should work', async () => { | ||
|
||
}); | ||
}); | ||
|
||
/** | ||
* https://macacajs.github.io/macaca-wd/#deleteCookie | ||
*/ | ||
describe('deleteCookie', async () => { | ||
it('should work', async () => { | ||
|
||
}); | ||
}); | ||
|
||
/** | ||
* https://macacajs.github.io/macaca-wd/#setCookie | ||
*/ | ||
describe('setCookie', async () => { | ||
it('should work', async () => { | ||
|
||
}); | ||
}); | ||
}); |
Empty file.
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
|
||
const { Server } = require('./helper'); | ||
|
||
const wd = require('../lib/macaca-wd'); | ||
|
||
describe('test/session.test.js', function() { | ||
let driver, server; | ||
before(() => { | ||
server = new Server(); | ||
server.start(); | ||
const remoteConfig = { | ||
host: 'localhost', | ||
port: 3456 | ||
}; | ||
|
||
driver = wd.promiseChainRemote(remoteConfig); | ||
driver.configureHttp({ | ||
timeout: 20 * 1000, | ||
retries: 5, | ||
retryDelay: 5 | ||
}); | ||
}); | ||
|
||
after(() => { | ||
server.stop(); | ||
}); | ||
|
||
/** | ||
* https://macacajs.github.io/macaca-wd/#init | ||
*/ | ||
describe('init', async () => { | ||
it('should work', async () => { | ||
await driver.init({ | ||
platformName: 'desktop', | ||
browserName: 'chrome' | ||
}); | ||
assert.equal(server.ctx.method, 'POST'); | ||
assert.equal(server.ctx.url, '/wd/hub/session'); | ||
assert.deepEqual(server.ctx.request.body, { | ||
desiredCapabilities: { | ||
platformName: 'desktop', | ||
browserName: 'chrome', | ||
version: '', | ||
javascriptEnabled: true, | ||
platform: 'ANY', | ||
}, | ||
}); | ||
assert.deepEqual(server.ctx.response.body, { | ||
sessionId: 'sessionId', | ||
status: 0, | ||
value: '', | ||
}); | ||
}); | ||
}); | ||
|
||
/** | ||
* https://macacajs.github.io/macaca-wd/#quit | ||
*/ | ||
describe('quit', async () => { | ||
beforeEach(async () => { | ||
await driver.init({ | ||
platformName: 'desktop', | ||
browserName: 'chrome' | ||
}); | ||
}); | ||
it('should work', async () => { | ||
await driver.quit(); | ||
assert.equal(server.ctx.method, 'DELETE'); | ||
assert.equal(server.ctx.url, '/wd/hub/session/sessionId'); | ||
assert.deepEqual(server.ctx.response.body, { | ||
sessionId: 'sessionId', | ||
status: 0, | ||
value: '', | ||
}); | ||
}); | ||
}); | ||
|
||
/** | ||
* https://macacajs.github.io/macaca-wd/#sessions | ||
*/ | ||
describe('sessions', async () => { | ||
beforeEach(async () => { | ||
await driver.init({ | ||
platformName: 'desktop', | ||
browserName: 'chrome' | ||
}); | ||
}); | ||
it('should work', async () => { | ||
await driver.sessions(); | ||
assert.equal(server.ctx.method, 'GET'); | ||
assert.equal(server.ctx.url, '/wd/hub/sessions'); | ||
assert.deepEqual(server.ctx.response.body, { | ||
sessionId: 'sessionId', | ||
status: 0, | ||
value: '', | ||
}); | ||
}); | ||
}); | ||
}); |
Empty file.
Empty file.
Empty file.
Oops, something went wrong.