Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #20548 from RudyLu/settings/Bug1024695-waitFor_key…
Browse files Browse the repository at this point in the history
…board_settings_frame

Bug 1024695 - Intermittent keyboard_settings_test.js |
r=evanxd.
(cherry picked from commit 7b4665c)
a=test-only
  • Loading branch information
RudyLu committed Jun 27, 2014
1 parent 8df0226 commit e91a2f6
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions apps/settings/test/marionette/app/keyboard_app.js
Expand Up @@ -27,6 +27,43 @@ KeyboardApp.prototype = {
this.client.switchToFrame();
var settingsFrame = this.client.findElement(
'iframe[src*="' + KeyboardApp.SETTINGS_LAUNCH_PATH + '"]');

/**
* XXX: Workaround to wait for the frame is ready after switching to the
* keyboard app's settings page. We should use
* this.client.apps.switchToApp(KeyboardApp.SETTINGS_LAUNCH_PATH)
* instead of the logic below after Bug 1027994 is fixed.
*
* Add swithToApp waiting logic here, see Bug 1003788 for a similar
* technique we implemented in marionette-apps plugin.
*/

// Wait for the iframe is rendered.
this.client.waitFor(function() {
var frameClass = settingsFrame.scriptWith(function(el) {
return el.parentNode.getAttribute('class');
});

if (frameClass !== null) {
return frameClass.indexOf('render') !== -1;
} else {
return true;
}
});

// Wait for the iframe is displayed on screen.
this.client.waitFor(function() {
var transitionState = settingsFrame.scriptWith(function(el) {
return el.parentNode.getAttribute('transition-state');
});

if (transitionState !== null) {
return transitionState === 'opened';
} else {
return settingsFrame.displayed();
}
});

this.client.switchToFrame(settingsFrame);
},

Expand Down

0 comments on commit e91a2f6

Please sign in to comment.