Ejemplo n.º 1
0
    def test_no_certificate(self):
        with self.marionette.using_context("content"):
            self.marionette.navigate(self.url)

        # Check the favicon
        # TODO: find a better way to check, e.g., mozmill's isDisplayed
        favicon_hidden = self.marionette.execute_script(
            """
          return arguments[0].hasAttribute("hidden");
        """,
            script_args=[self.browser.navbar.locationbar.identity_icon],
        )
        self.assertFalse(favicon_hidden, "The identity icon is visible")

        # Check that the identity box organization label is blank
        self.assertEqual(
            self.locationbar.identity_organization_label.get_attribute("value"), "", "The organization has no label"
        )

        # Open the identity popup
        self.locationbar.open_identity_popup()

        # Check the idenity popup doorhanger
        self.assertEqual(self.identity_popup.element.get_attribute("connection"), "not-secure")

        # The expander for the security view does not exist
        expected.element_not_present(lambda m: self.identity_popup.main.expander)

        # Only the insecure label is visible
        secure_label = self.identity_popup.view.main.secure_connection_label
        self.assertEqual(secure_label.value_of_css_property("display"), "none")

        insecure_label = self.identity_popup.view.main.insecure_connection_label
        self.assertNotEqual(insecure_label.value_of_css_property("display"), "none")

        self.identity_popup.view.main.expander.click()
        Wait(self.marionette).until(lambda _: self.identity_popup.view.security.selected)

        # Open the Page Info window by clicking the "More Information" button
        page_info = self.browser.open_page_info_window(
            lambda _: self.identity_popup.view.security.more_info_button.click()
        )

        # Verify that the current panel is the security panel
        self.assertEqual(page_info.deck.selected_panel, page_info.deck.security)

        # Check the domain listed on the security panel contains the url's host name
        self.assertIn(urlparse(self.url).hostname, page_info.deck.security.domain.get_attribute("value"))

        # Check the owner label equals localized 'securityNoOwner'
        self.assertEqual(
            page_info.deck.security.owner.get_attribute("value"), page_info.get_property("securityNoOwner")
        )

        # Check the verifier label equals localized 'notset'
        self.assertEqual(page_info.deck.security.verifier.get_attribute("value"), page_info.get_property("notset"))
Ejemplo n.º 2
0
    def test_no_certificate(self):
        with self.marionette.using_context('content'):
            self.marionette.navigate(self.url)

        # Check the favicon
        # TODO: find a better way to check, e.g., mozmill's isDisplayed
        favicon_hidden = self.marionette.execute_script("""
          return arguments[0].hasAttribute("hidden");
        """, script_args=[self.browser.navbar.locationbar.identity_icon])
        self.assertFalse(favicon_hidden, 'The identity icon is visible')

        # Check that the identity box organization label is blank
        self.assertEqual(self.locationbar.identity_organization_label.get_attribute('value'), '',
                         'The organization has no label')

        # Open the identity popup
        self.locationbar.open_identity_popup()

        # Check the idenity popup doorhanger
        self.assertEqual(self.identity_popup.element.get_attribute('connection'), 'not-secure')

        # The expander for the security view does not exist
        expected.element_not_present(lambda m: self.identity_popup.main.expander)

        # Only the insecure label is visible
        secure_label = self.identity_popup.view.main.secure_connection_label
        self.assertEqual(secure_label.value_of_css_property('display'), 'none')

        insecure_label = self.identity_popup.view.main.insecure_connection_label
        self.assertNotEqual(insecure_label.value_of_css_property('display'), 'none')

        self.identity_popup.view.main.expander.click()
        Wait(self.marionette).until(lambda _: self.identity_popup.view.security.selected)

        # Open the Page Info window by clicking the "More Information" button
        page_info = self.browser.open_page_info_window(
            lambda _: self.identity_popup.view.security.more_info_button.click())

        # Verify that the current panel is the security panel
        self.assertEqual(page_info.deck.selected_panel, page_info.deck.security)

        # Check the domain listed on the security panel contains the url's host name
        self.assertIn(urlparse(self.url).hostname,
                      page_info.deck.security.domain.get_attribute('value'))

        # Check the owner label equals localized 'securityNoOwner'
        self.assertEqual(page_info.deck.security.owner.get_attribute('value'),
                         page_info.localize_property('securityNoOwner'))

        # Check the verifier label equals localized 'notset'
        self.assertEqual(page_info.deck.security.verifier.get_attribute('value'),
                         page_info.localize_property('notset'))
Ejemplo n.º 3
0
    def test_buttons(self):
        self.marionette.set_context('content')

        # Load initial web page
        self.marionette.navigate(self.url)
        Wait(self.marionette).until(
            expected.element_present(
                lambda m: m.find_element(By.ID, 'mozilla_logo')))

        with self.marionette.using_context('chrome'):
            # Both buttons are disabled
            self.assertFalse(self.navbar.back_button.is_enabled())
            self.assertFalse(self.navbar.forward_button.is_enabled())

            # Go to the homepage
            self.navbar.home_button.click()

        Wait(self.marionette).until(
            expected.element_not_present(
                lambda m: m.find_element(By.ID, 'mozilla_logo')))
        self.assertEqual(self.marionette.get_url(),
                         self.browser.default_homepage)

        with self.marionette.using_context('chrome'):
            # Only back button is enabled
            self.assertTrue(self.navbar.back_button.is_enabled())
            self.assertFalse(self.navbar.forward_button.is_enabled())

            # Navigate back
            self.navbar.back_button.click()

        Wait(self.marionette).until(
            expected.element_present(
                lambda m: m.find_element(By.ID, 'mozilla_logo')))
        self.assertEqual(self.marionette.get_url(), self.url)

        with self.marionette.using_context('chrome'):
            # Only forward button is enabled
            self.assertFalse(self.navbar.back_button.is_enabled())
            self.assertTrue(self.navbar.forward_button.is_enabled())

            # Navigate forward
            self.navbar.forward_button.click()

        Wait(self.marionette).until(
            expected.element_not_present(
                lambda m: m.find_element(By.ID, 'mozilla_logo')))
        self.assertEqual(self.marionette.get_url(),
                         self.browser.default_homepage)
Ejemplo n.º 4
0
 def close_app(self, app):
     self.wait_for_card_ready(app)
     Wait(self.marionette).until(
         expected.element_present(*self._app_card_locator(app)))
     self.marionette.find_element(*self._close_button_locator(app)).tap()
     Wait(self.marionette).until(
         expected.element_not_present(*self._app_card_locator(app)))
Ejemplo n.º 5
0
 def tap_edit_done(self):
      element = self.marionette.find_element(*self._exit_edit_mode_locator)
      Wait(self.marionette).until(lambda m: element.is_displayed())
      element.tap()
      Wait(self.marionette).until(lambda m: not element.is_displayed())
      Wait(self.marionette).until(expected.element_not_present(
          *self._edit_mode_locator))
Ejemplo n.º 6
0
 def tap_edit_done(self):
      element = self.marionette.find_element(*self._exit_edit_mode_locator)
      Wait(self.marionette).until(lambda m: element.is_displayed())
      element.tap()
      Wait(self.marionette).until(lambda m: not element.is_displayed())
      Wait(self.marionette).until(expected.element_not_present(
          *self._edit_mode_locator))
Ejemplo n.º 7
0
 def close_app(self, app):
     self.wait_for_card_ready(app)
     Wait(self.marionette).until(
         expected.element_present(*self._app_card_locator(app)))
     self.marionette.find_element(*self._close_button_locator(app)).tap()
     Wait(self.marionette).until(
         expected.element_not_present(*self._app_card_locator(app)))
Ejemplo n.º 8
0
 def tap_send(self, timeout=120):
     send = Wait(self.marionette).until(
         expected.element_present(*self._send_message_button_locator))
     Wait(self.marionette).until(expected.element_enabled(send))
     send.tap()
     Wait(self.marionette, timeout=timeout).until(
         expected.element_not_present(*self._message_sending_locator))
     from gaiatest.apps.messages.regions.message_thread import MessageThread
     return MessageThread(self.marionette)
Ejemplo n.º 9
0
 def tap_send(self, timeout=120):
     send = Wait(self.marionette).until(
         expected.element_present(*self._send_message_button_locator))
     Wait(self.marionette).until(expected.element_enabled(send))
     send.tap()
     Wait(self.marionette, timeout=timeout).until(
         expected.element_not_present(*self._message_sending_locator))
     from gaiatest.apps.messages.regions.message_thread import MessageThread
     return MessageThread(self.marionette)
Ejemplo n.º 10
0
    def test_buttons(self):
        self.marionette.set_context('content')

        # Load initial web page
        self.marionette.navigate(self.url)
        Wait(self.marionette).until(expected.element_present(lambda m:
                                    m.find_element(By.ID, 'mozilla_logo')))

        with self.marionette.using_context('chrome'):
            # Both buttons are disabled
            self.assertFalse(self.navbar.back_button.is_enabled())
            self.assertFalse(self.navbar.forward_button.is_enabled())

            # Go to the homepage
            self.navbar.home_button.click()

        Wait(self.marionette).until(expected.element_not_present(lambda m:
                                    m.find_element(By.ID, 'mozilla_logo')))
        self.assertEqual(self.marionette.get_url(), self.browser.default_homepage)

        with self.marionette.using_context('chrome'):
            # Only back button is enabled
            self.assertTrue(self.navbar.back_button.is_enabled())
            self.assertFalse(self.navbar.forward_button.is_enabled())

            # Navigate back
            self.navbar.back_button.click()

        Wait(self.marionette).until(expected.element_present(lambda m:
                                    m.find_element(By.ID, 'mozilla_logo')))
        self.assertEqual(self.marionette.get_url(), self.url)

        with self.marionette.using_context('chrome'):
            # Only forward button is enabled
            self.assertFalse(self.navbar.back_button.is_enabled())
            self.assertTrue(self.navbar.forward_button.is_enabled())

            # Navigate forward
            self.navbar.forward_button.click()

        Wait(self.marionette).until(expected.element_not_present(lambda m:
                                    m.find_element(By.ID, 'mozilla_logo')))
        self.assertEqual(self.marionette.get_url(), self.browser.default_homepage)
Ejemplo n.º 11
0
    def login(self, email, password):
        # This only supports logging in with a known user and no existing session
        self.type_email(email)
        self.tap_continue()

        self.type_password(password)
        self.tap_returning()

        self.marionette.switch_to_frame()
        Wait(self.marionette).until(
            expected.element_not_present(*self._persona_frame_locator))
        self.apps.switch_to_displayed_app()
Ejemplo n.º 12
0
    def login(self, email, password):
        # This only supports logging in with a known user and no existing session
        self.type_email(email)
        self.tap_continue()

        self.type_password(password)
        self.tap_returning()

        self.marionette.switch_to_frame()
        Wait(self.marionette).until(
            expected.element_not_present(*self._persona_frame_locator))
        self.apps.switch_to_displayed_app()
Ejemplo n.º 13
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"]'
            ))
Ejemplo n.º 14
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"]')
        )
Ejemplo n.º 15
0
    def test_ssl_disabled_error_page(self):
        with self.marionette.using_context('content'):
            # Open the test page
            self.assertRaises(MarionetteException, self.marionette.navigate,
                              self.url)

            # Wait for the DOM to receive events
            time.sleep(1)

            # Verify "Secure Connection Failed" error page title
            title = self.marionette.find_element(By.CLASS_NAME, 'title-text')
            nss_failure2title = self.browser.localize_entity(
                'nssFailure2.title')
            self.assertEquals(title.get_property('textContent'),
                              nss_failure2title)

            # Verify the error message is correct
            short_description = self.marionette.find_element(
                By.ID, 'errorShortDescText')
            self.assertIn('SSL_ERROR_UNSUPPORTED_VERSION',
                          short_description.get_property('textContent'))

            # Verify that the "Restore" button appears and works
            restore_button = self.marionette.find_element(
                By.ID, 'prefResetButton')
            restore_button.click()
            Wait(self.marionette).until(
                expected.element_not_present(By.ID, "prefResetButton"),
                message="Click on the restore button didn't trigger a page load"
            )

            # With the preferences reset, the page has to load correctly
            el = Wait(self.marionette,
                      timeout=self.marionette.timeout.page_load).until(
                          expected.element_present(By.TAG_NAME, 'h1'),
                          message="Expected target page has not been loaded")
            self.assertIn('tls-v1-0', el.get_property('innerText'))
Ejemplo n.º 16
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)
Ejemplo n.º 17
0
 def hang_up(self):
     self.marionette.find_element(*self._hangup_bar_locator).tap()
     self.marionette.switch_to_frame()
     Wait(self.marionette).until(
         expected.element_not_present(*self._call_screen_locator))
Ejemplo n.º 18
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)
Ejemplo n.º 19
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)
Ejemplo n.º 20
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)
 def wait_for_element_not_present(self, by, locator):
     Wait(self.marionette).until(expected.element_not_present(by, locator))
Ejemplo n.º 22
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)
Ejemplo n.º 23
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)
Ejemplo n.º 24
0
 def wait_for_element_not_present(self, by, locator):
     Wait(self.marionette).until(expected.element_not_present(by, locator))