コード例 #1
0
ファイル: test_a11y_captions.py プロジェクト: 4gh/gaia
class TestCaptionsAccessibility(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

        # Make accessibility settings visible
        self.data_layer.set_setting('accessibility.screenreader-show-settings', True)
        self.data_layer.set_setting('accessibility.screenreader-captions', False)

        self.settings = Settings(self.marionette)
        self.settings.launch()

    def test_a11y_captions(self):
        accessibility_settings = self.settings.a11y_open_accessibility_settings()
        screenreader_settings = accessibility_settings.a11y_open_screenreader_settings()

        # Captions should be invisible when screen reader is disabled
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *screenreader_settings._screen_reader_captions_locator)))

        # Turn on screen reader
        self.data_layer.set_setting('accessibility.screenreader', True)

        # Captions should be visible when screen reader is on
        self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
            *screenreader_settings._screen_reader_captions_locator)))

        # Turn on color filters
        screenreader_settings.a11y_toggle_captions()

        # Captions settings should be set
        self.wait_for_condition(
            lambda m: self.data_layer.get_setting('accessibility.screenreader-captions'))
コード例 #2
0
class TestSliderVisibilityAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

        # make accessibility settings visible
        self.data_layer.set_setting('accessibility.show-settings', True)

        self.settings = Settings(self.marionette)
        self.settings.launch()

    def test_a11y_slider_visibility(self):
        accessibility_settings = self.settings.a11y_open_accessibility_settings(
        )

        # Both rate and volume sliders should be visible
        self.assertTrue(
            self.is_element_displayed(
                *accessibility_settings._screen_reader_volume_slider_locator))
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *accessibility_settings.
                    _screen_reader_volume_slider_locator)))
        self.assertTrue(
            self.is_element_displayed(
                *accessibility_settings._screen_reader_rate_slider_locator))
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *accessibility_settings._screen_reader_rate_slider_locator)
            ))
コード例 #3
0
class TestVolumeButtonsAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.settings = Settings(self.marionette)
        self.settings.launch()

    def toggle_screen_reader(self):
        self.marionette.switch_to_frame()

        self.device.press_release_volume_up_then_down_n_times(3)
        time.sleep(3)
        self.device.press_release_volume_up_then_down_n_times(3)

        self.apps.switch_to_displayed_app()

    def test_a11y_volume_buttons(self):
        # Open accessibility settings panel
        accessibility_settings = self.settings.a11y_open_accessibility_settings()

        # Panel should not be visible by default
        self.assertFalse(self.data_layer.get_setting("accessibility.screenreader-show-settings"))
        self.assertFalse(
            self.is_element_displayed(*accessibility_settings._accessibility_screenreader_menu_item_locator)
        )
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(*accessibility_settings._accessibility_screenreader_menu_item_locator)
            )
        )

        self.toggle_screen_reader()

        # Panel should become visible after screen reader turned ON
        self.assertTrue(self.data_layer.get_setting("accessibility.screenreader-show-settings"))
        self.assertTrue(
            self.is_element_displayed(*accessibility_settings._accessibility_screenreader_menu_item_locator)
        )
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(*accessibility_settings._accessibility_screenreader_menu_item_locator)
            )
        )

        self.toggle_screen_reader()

        # Panel should still be visible
        self.assertTrue(self.data_layer.get_setting("accessibility.screenreader-show-settings"))
        self.assertTrue(
            self.is_element_displayed(*accessibility_settings._accessibility_screenreader_menu_item_locator)
        )
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(*accessibility_settings._accessibility_screenreader_menu_item_locator)
            )
        )
コード例 #4
0
class TestSliderVisibilityAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

        # make accessibility settings visible
        self.data_layer.set_setting('accessibility.screenreader-show-settings',
                                    True)

        self.settings = Settings(self.marionette)
        self.settings.launch()

    def test_a11y_slider_visibility(self):
        accessibility_settings = self.settings.a11y_open_accessibility_settings(
        )
        screenreader_settings = accessibility_settings.a11y_open_screenreader_settings(
        )

        # Rate and volume settings should be invisible when screen reader is disabled
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *screenreader_settings._screen_reader_volume_slider_locator
                )))
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *
                    screenreader_settings._screen_reader_rate_slider_locator)))

        # Turn on screen reader
        self.data_layer.set_setting('accessibility.screenreader', True)

        # Both rate and volume sliders should be visible when screen reader is on
        self.wait_for_condition(lambda x: self.accessibility.is_visible(
            self.marionette.find_element(
                *screenreader_settings._screen_reader_volume_slider_locator)))
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *
                    screenreader_settings._screen_reader_rate_slider_locator)))

        # Turn screen reader off again
        self.data_layer.set_setting('accessibility.screenreader', False)

        # Rate and volume settings should be invisible when screen reader is disabled
        self.wait_for_condition(lambda x: self.accessibility.is_hidden(
            self.marionette.find_element(
                *screenreader_settings._screen_reader_volume_slider_locator)))
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *
                    screenreader_settings._screen_reader_rate_slider_locator)))
コード例 #5
0
class TestSliderVisibilityAccessibility(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

        # make accessibility settings visible
        self.data_layer.set_setting(
            'accessibility.screenreader-show-settings', True)

        self.settings = Settings(self.marionette)
        self.settings.launch()

    def test_a11y_slider_visibility(self):
        accessibility_settings = self.settings.a11y_open_accessibility_settings()
        screenreader_settings = accessibility_settings.a11y_open_screenreader_settings()

        # Rate and volume settings should be invisible when screen reader is disabled
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *screenreader_settings._screen_reader_volume_slider_locator)))
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *screenreader_settings._screen_reader_rate_slider_locator)))

        # Turn on screen reader
        self.data_layer.set_setting('accessibility.screenreader', True)

        # Both rate and volume sliders should be visible when screen reader is on
        self.wait_for_condition(lambda x:
            self.accessibility.is_visible(self.marionette.find_element(
                *screenreader_settings._screen_reader_volume_slider_locator)))
        self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
            *screenreader_settings._screen_reader_rate_slider_locator)))

        # Turn screen reader off again
        self.data_layer.set_setting('accessibility.screenreader', False)

        # Rate and volume settings should be invisible when screen reader is disabled
        self.wait_for_condition(lambda x:
            self.accessibility.is_hidden(self.marionette.find_element(
                *screenreader_settings._screen_reader_volume_slider_locator)))
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *screenreader_settings._screen_reader_rate_slider_locator)))
コード例 #6
0
ファイル: test_a11y_captions.py プロジェクト: zhixin4567/gaia
class TestCaptionsAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

        # Make accessibility settings visible
        self.data_layer.set_setting('accessibility.screenreader-show-settings',
                                    True)
        self.data_layer.set_setting('accessibility.screenreader-captions',
                                    False)

        self.settings = Settings(self.marionette)
        self.settings.launch()

    def test_a11y_captions(self):
        accessibility_settings = self.settings.a11y_open_accessibility_settings(
        )
        screenreader_settings = accessibility_settings.a11y_open_screenreader_settings(
        )

        # Captions should be invisible when screen reader is disabled
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *screenreader_settings._screen_reader_captions_locator)))

        # Turn on screen reader
        self.data_layer.set_setting('accessibility.screenreader', True)

        # Captions should be visible when screen reader is on
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *screenreader_settings._screen_reader_captions_locator)))

        # Turn on color filters
        screenreader_settings.a11y_toggle_captions()

        # Captions settings should be set
        self.wait_for_condition(lambda m: self.data_layer.get_setting(
            'accessibility.screenreader-captions'))
コード例 #7
0
class TestSliderVisibilityAccessibility(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

        # make accessibility settings visible
        self.data_layer.set_setting('accessibility.show-settings', True)

        self.settings = Settings(self.marionette)
        self.settings.launch()

    def test_a11y_slider_visibility(self):
        accessibility_settings = self.settings.a11y_open_accessibility_settings()

        # Both rate and volume sliders should be visible
        self.assertTrue(self.marionette.find_element(
            *accessibility_settings._screen_reader_volume_slider_locator).is_displayed())
        self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
            *accessibility_settings._screen_reader_volume_slider_locator)))
        self.assertTrue(self.marionette.find_element(
            *accessibility_settings._screen_reader_rate_slider_locator).is_displayed())
        self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
            *accessibility_settings._screen_reader_rate_slider_locator)))
コード例 #8
0
class TestColorFiltersAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

        # make accessibility settings visible
        self.data_layer.set_setting('accessibility.colors.enabled', False)
        self.data_layer.set_setting('accessibility.colors.invert', False)
        self.data_layer.set_setting('accessibility.colors.grayscale', False)
        self.data_layer.set_setting('accessibility.colors.contrast', 0.0)

        self.settings = Settings(self.marionette)
        self.settings.launch()

    def test_a11y_color_filters(self):
        accessibility_settings = self.settings.a11y_open_accessibility_settings(
        )
        colors_settings = accessibility_settings.a11y_open_color_settings()

        # make sure the actual settings are hidden
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *colors_settings._invert_switch_locator)))
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *colors_settings._grayscale_switch_locator)))
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *colors_settings._contrast_slider_locator)))

        # turn on color filters
        colors_settings.a11y_toggle_filters()

        # the color settings should show up now
        self.wait_for_condition(lambda m: self.accessibility.is_visible(
            self.marionette.find_element(*colors_settings.
                                         _invert_switch_locator)))
        self.wait_for_condition(lambda m: self.accessibility.is_visible(
            self.marionette.find_element(*colors_settings.
                                         _grayscale_switch_locator)))
        self.wait_for_condition(lambda m: self.accessibility.is_visible(
            self.marionette.find_element(*colors_settings.
                                         _contrast_slider_locator)))

        colors_settings.a11y_toggle_invert()

        # layers invert setting should be set
        self.wait_for_condition(
            lambda m: self.data_layer.get_setting('layers.effect.invert'))

        colors_settings.a11y_toggle_grayscale()

        # layers grayscale setting should be set
        self.wait_for_condition(
            lambda m: self.data_layer.get_setting('layers.effect.grayscale'))

        # turn off color filters
        colors_settings.a11y_toggle_filters()

        # layers settings should go back to default automatically
        self.wait_for_condition(
            lambda m: not self.data_layer.get_setting('layers.effect.invert'))
        self.wait_for_condition(lambda m: not self.data_layer.get_setting(
            'layers.effect.grayscale'))

        # make sure the actual settings are hidden
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *colors_settings._invert_switch_locator)))
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *colors_settings._grayscale_switch_locator)))
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *colors_settings._contrast_slider_locator)))
コード例 #9
0
ファイル: test_a11y_color_filters.py プロジェクト: 4gh/gaia
class TestColorFiltersAccessibility(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

        # make accessibility settings visible
        self.data_layer.set_setting('accessibility.colors.enabled', False)
        self.data_layer.set_setting('accessibility.colors.invert', False)
        self.data_layer.set_setting('accessibility.colors.grayscale', False)
        self.data_layer.set_setting('accessibility.colors.contrast', 0.0)

        self.settings = Settings(self.marionette)
        self.settings.launch()

    def test_a11y_color_filters(self):
        accessibility_settings = self.settings.a11y_open_accessibility_settings()
        colors_settings = accessibility_settings.a11y_open_color_settings()

        # make sure the actual settings are hidden
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *colors_settings._invert_switch_locator)))
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *colors_settings._grayscale_switch_locator)))
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *colors_settings._contrast_slider_locator)))

        # turn on color filters
        colors_settings.a11y_toggle_filters()

        # the color settings should show up now
        self.wait_for_condition(
            lambda m: self.accessibility.is_visible(self.marionette.find_element(
            *colors_settings._invert_switch_locator)))
        self.wait_for_condition(
            lambda m: self.accessibility.is_visible(self.marionette.find_element(
            *colors_settings._grayscale_switch_locator)))
        self.wait_for_condition(
            lambda m: self.accessibility.is_visible(self.marionette.find_element(
            *colors_settings._contrast_slider_locator)))

        colors_settings.a11y_toggle_invert()

        # layers invert setting should be set
        self.wait_for_condition(
            lambda m: self.data_layer.get_setting('layers.effect.invert'))

        colors_settings.a11y_toggle_grayscale()

        # layers grayscale setting should be set
        self.wait_for_condition(
            lambda m: self.data_layer.get_setting('layers.effect.grayscale'))

        # turn off color filters
        colors_settings.a11y_toggle_filters()

        # layers settings should go back to default automatically
        self.wait_for_condition(
            lambda m: not self.data_layer.get_setting('layers.effect.invert'))
        self.wait_for_condition(
            lambda m: not self.data_layer.get_setting('layers.effect.grayscale'))

        # make sure the actual settings are hidden
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *colors_settings._invert_switch_locator)))
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *colors_settings._grayscale_switch_locator)))
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *colors_settings._contrast_slider_locator)))
コード例 #10
0
class TestVolumeButtonsAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.settings = Settings(self.marionette)
        self.settings.launch()

    def toggle_screen_reader(self):
        self.marionette.switch_to_frame()

        self.device.press_release_volume_up_then_down_n_times(3)
        time.sleep(3)
        self.device.press_release_volume_up_then_down_n_times(3)

        self.apps.switch_to_displayed_app()

    def test_a11y_volume_buttons(self):
        # Open accessibility settings panel
        accessibility_settings = self.settings.a11y_open_accessibility_settings(
        )

        # Panel should not be visible by default
        self.assertFalse(
            self.data_layer.get_setting(
                'accessibility.screenreader-show-settings'))
        self.assertFalse(
            self.is_element_displayed(
                *accessibility_settings.
                _accessibility_screenreader_menu_item_locator))
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *accessibility_settings.
                    _accessibility_screenreader_menu_item_locator)))

        self.toggle_screen_reader()

        # Panel should become visible after screen reader turned ON
        self.assertTrue(
            self.data_layer.get_setting(
                'accessibility.screenreader-show-settings'))
        self.assertTrue(
            self.is_element_displayed(
                *accessibility_settings.
                _accessibility_screenreader_menu_item_locator))
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *accessibility_settings.
                    _accessibility_screenreader_menu_item_locator)))

        self.toggle_screen_reader()

        # Panel should still be visible
        self.assertTrue(
            self.data_layer.get_setting(
                'accessibility.screenreader-show-settings'))
        self.assertTrue(
            self.is_element_displayed(
                *accessibility_settings.
                _accessibility_screenreader_menu_item_locator))
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *accessibility_settings.
                    _accessibility_screenreader_menu_item_locator)))