예제 #1
0
    def close_test_container(self):
        self.marionette.set_context(self.marionette.CONTEXT_CONTENT)

        result = self.marionette.execute_async_script("""
if((navigator.mozSettings == undefined) || (navigator.mozSettings == null) || (navigator.mozApps == undefined) || (navigator.mozApps == null)) {
    marionetteScriptFinished(false);
    return;
}
let setReq = navigator.mozSettings.createLock().set({'lockscreen.enabled': false});
setReq.onsuccess = function() {
    let appsReq = navigator.mozApps.mgmt.getAll();
    appsReq.onsuccess = function() {
        let apps = appsReq.result;
        for (let i = 0; i < apps.length; i++) {
            let app = apps[i];
            if (app.manifest.name === 'Test Container') {
                let manager = window.wrappedJSObject.appWindowManager || window.wrappedJSObject.AppWindowManager;
                if (!manager) {
                    marionetteScriptFinished(false);
                    return;
                }
                manager.kill(app.origin);
                marionetteScriptFinished(true);
                return;
            }
        }
        marionetteScriptFinished(false);
    }
    appsReq.onerror = function() {
        marionetteScriptFinished(false);
    }
}
setReq.onerror = function() {
    marionetteScriptFinished(false);
}""",
                                                      script_timeout=60000)

        if not result:
            raise Exception('Failed to close Test Container app')

        Wait(self.marionette, timeout=10, interval=0.2).until(
            element_not_present(
                'css selector',
                'iframe[src*="app://test-container.gaiamobile.org/index.html"]'
            ))
예제 #2
0
    def close_test_container(self):
        self.marionette.set_context(self.marionette.CONTEXT_CONTENT)

        result = self.marionette.execute_async_script("""
if((navigator.mozSettings == undefined) || (navigator.mozSettings == null) || (navigator.mozApps == undefined) || (navigator.mozApps == null)) {
    marionetteScriptFinished(false);
    return;
}
let setReq = navigator.mozSettings.createLock().set({'lockscreen.enabled': false});
setReq.onsuccess = function() {
    let appsReq = navigator.mozApps.mgmt.getAll();
    appsReq.onsuccess = function() {
        let apps = appsReq.result;
        for (let i = 0; i < apps.length; i++) {
            let app = apps[i];
            if (app.manifest.name === 'Test Container') {
                let manager = window.wrappedJSObject.appWindowManager || window.wrappedJSObject.AppWindowManager;
                if (!manager) {
                    marionetteScriptFinished(false);
                    return;
                }
                manager.kill(app.origin);
                marionetteScriptFinished(true);
                return;
            }
        }
        marionetteScriptFinished(false);
    }
    appsReq.onerror = function() {
        marionetteScriptFinished(false);
    }
}
setReq.onerror = function() {
    marionetteScriptFinished(false);
}""", script_timeout=60000)

        if not result:
            raise Exception('Failed to close Test Container app')

        Wait(self.marionette, timeout=10, interval=0.2).until(element_not_present(
            'css selector',
            'iframe[src*="app://test-container.gaiamobile.org/index.html"]'
        ))
예제 #3
0
 def test_elements_not_present_func(self):
     r = expected.element_not_present(no_such_elements)(self.marionette)
     self.assertIsInstance(r, bool)
     self.assertTrue(r)
예제 #4
0
 def test_element_not_present_is_present(self):
     self.marionette.navigate(static_element)
     r = expected.element_not_present(p)(self.marionette)
     self.assertIsInstance(r, bool)
     self.assertFalse(r)
예제 #5
0
 def test_element_not_present_locator(self):
     r = expected.element_not_present(By.ID, "nosuchelement")(self.marionette)
     self.assertIsInstance(r, bool)
     self.assertTrue(r)
예제 #6
0
 def test_element_not_present_is_present(self):
     self.marionette.navigate(static_element)
     r = expected.element_not_present(p)(self.marionette)
     self.assertIsInstance(r, bool)
     self.assertFalse(r)
예제 #7
0
 def test_element_not_present_locator(self):
     r = expected.element_not_present(By.ID,
                                      "nosuchelement")(self.marionette)
     self.assertIsInstance(r, bool)
     self.assertTrue(r)
예제 #8
0
 def test_element_not_present_func(self):
     r = expected.element_not_present(no_such_element)(self.marionette)
     self.assertIsInstance(r, bool)
     self.assertTrue(r)