marionette-client
Advanced tools
Comparing version 1.8.1 to 1.9.0
@@ -0,1 +1,4 @@ | ||
# 1.9.0 | ||
- Bug 1200400 - Add support for switchToShadowRoot | ||
# 1.8.0 | ||
@@ -2,0 +5,0 @@ - Bug 1168396 - Adjust Marionette JS client to protocol changes |
@@ -806,3 +806,3 @@ /* global Marionette */ | ||
}.bind(this); | ||
var body = { | ||
@@ -973,2 +973,28 @@ name: 'newSession', | ||
/** | ||
* Switch the current context to the specified host's Shadow DOM. | ||
* Subsequent commands will operate in the context of the specified Shadow | ||
* DOM, if applicable. | ||
* | ||
* @param {Marionette.Element} [host] A reference to the host element | ||
* containing Shadow DOM. This can be an Marionette.Element. If you call | ||
* switchToShadowRoot without an argument, it will switch to the | ||
* parent Shadow DOM or the top-level frame. | ||
* @param {Function} callback called with boolean. | ||
*/ | ||
switchToShadowRoot: function switchToShadowRoot(host, callback) { | ||
if (typeof(host) === 'function') { | ||
callback = host; | ||
host = null; | ||
} | ||
var cmd = { name: 'switchToShadowRoot', parameters: {} }; | ||
if (host instanceof this.Element) { | ||
cmd.parameters.id = host.id; | ||
} | ||
return this._sendCommand(cmd, callback); | ||
}, | ||
/** | ||
* Switches context of window. The current context can be found with | ||
@@ -975,0 +1001,0 @@ * .context. |
@@ -75,3 +75,2 @@ 'use strict'; | ||
try { | ||
debug('probing socket'); | ||
sockit.connect(socketConfig); | ||
@@ -107,2 +106,3 @@ | ||
debug('probing socket'); | ||
probeSocket(); | ||
@@ -109,0 +109,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
{"name":"marionette-client","version":"1.8.1","author":"The Gaia Team <dev-gaia@lists.mozilla.org>","description":"Marionette Javascript Client","main":"lib/marionette/index","dependencies":{"debug":"~0.6","json-wire-protocol":"1.0.0","socket-retry-connect":"0.0.1","sockit-to-me":"0.3.2"},"devDependencies":{"yuidocjs":"~0.3","node-static":"~0.6","chai":"~1.7.2"}} | ||
{"name":"marionette-client","version":"1.9.0","author":"The Gaia Team <dev-gaia@lists.mozilla.org>","description":"Marionette Javascript Client","main":"lib/marionette/index","dependencies":{"debug":"~0.6","json-wire-protocol":"1.0.0","socket-retry-connect":"0.0.1","sockit-to-me":"0.3.2"},"devDependencies":{"yuidocjs":"~0.3","node-static":"~0.6","chai":"~1.7.2"}} |
@@ -1,2 +0,2 @@ | ||
/* global DeviceInteraction, MockDriver, assert, exampleCmds, helper */ | ||
/* global DeviceInteraction, MockDriver, assert, exampleCmds, helper, setup */ | ||
'use strict'; | ||
@@ -292,3 +292,3 @@ suite('marionette/client', function() { | ||
var result; | ||
setup(function() { | ||
@@ -299,7 +299,7 @@ subject.sessionId = 'session'; | ||
}); | ||
test('should be chainable', function() { | ||
assert.strictEqual(result, subject); | ||
}); | ||
test('should add session to cmd', function() { | ||
@@ -313,3 +313,3 @@ assert.deepEqual(driver.sent[0], { | ||
}); | ||
suite('when to: is not given', function() { | ||
@@ -321,3 +321,3 @@ suite('with an actor', function() { | ||
}); | ||
test('should add to:', function() { | ||
@@ -330,3 +330,3 @@ assert.deepEqual(driver.sent[0], { | ||
}); | ||
suite('without an actor', function() { | ||
@@ -336,3 +336,3 @@ setup(function() { | ||
}); | ||
test('should add to', function() { | ||
@@ -410,6 +410,6 @@ assert.deepEqual(driver.sent[0], { | ||
var desiredCapabilities = {desiredCapability: true}; | ||
setup(function(done) { | ||
var firesHook = false; | ||
subject.addHook('startSession', function(complete) { | ||
@@ -419,3 +419,3 @@ firesHook = true; | ||
}); | ||
result = subject.startSession(function() { | ||
@@ -425,13 +425,13 @@ assert.ok(firesHook); | ||
}, desiredCapabilities); | ||
device.shouldSend({parameters: {capabilities: desiredCapabilities}}); | ||
driver.respond(exampleCmds.getMarionetteIDResponse()); | ||
driver.respond(exampleCmds.newSessionResponseProto1()); | ||
}); | ||
test('should be chainable', function() { | ||
assert.strictEqual(result, subject); | ||
}); | ||
test('should have an actor property', function() { | ||
@@ -441,3 +441,3 @@ assert.property(subject, 'actor'); | ||
}); | ||
test('should have a sessionId property', function() { | ||
@@ -521,3 +521,3 @@ assert.property(subject, 'sessionId'); | ||
.callbackReceives('id'); | ||
test('should save actor ID', function() { | ||
@@ -960,2 +960,44 @@ var resp = exampleCmds.getMarionetteIDResponse(); | ||
suite('.switchToShadowRoot', function() { | ||
suite('when given nothing', function() { | ||
device. | ||
issues('switchToShadowRoot'). | ||
shouldSend({ name: 'switchToShadowRoot' }). | ||
serverResponds('ok'). | ||
callbackReceives(); | ||
}); | ||
suite('when given a callback', function() { | ||
setup(function() { | ||
subject.switchToShadowRoot(commandCallback); | ||
}); | ||
device. | ||
shouldSend({ | ||
name: 'switchToShadowRoot' | ||
}). | ||
serverResponds('ok'). | ||
callbackReceives(); | ||
}); | ||
suite('when given an element', function() { | ||
var el; | ||
setup(function() { | ||
el = new Element('78', subject); | ||
subject.switchToShadowRoot(el, commandCallback); | ||
}); | ||
device. | ||
shouldSend({ | ||
name: 'switchToShadowRoot', | ||
parameters: { | ||
id: '78' | ||
} | ||
}). | ||
serverResponds('ok'). | ||
callbackReceives(); | ||
}); | ||
}); | ||
suite('.importScript', function() { | ||
@@ -962,0 +1004,0 @@ device. |
324702
76
7665