Esempio n. 1
0
 def enter_value(self, value):
     self._select_entry()
     self.kbd.type(value)
     expectThat(self.text).equals(
         value,
         msg="Expected spinbutton value '{0}' to equal {1}"
             .format(self.text, value))
 def enter_value(self, value):
     self._select_entry()
     self.kbd.type(value)
     expectThat(self.text).equals(
         value,
         msg="Expected spinbutton value '{0}' to equal {1}".format(
             self.text, value))
Esempio n. 3
0
    def check(self, visible=True, imageStock='gtk-yes'):
        if visible:
            expectThat(self.visible).equals(
                visible,
                msg="Expected {0} label to be visible, but its wasn't"
                    .format(self.name))

            expectThat(self.stock).equals(
                imageStock,
                msg="Expected {0} image to have stock image {1} but instead "
                    "it is {2}".format(self.name, imageStock, self.stock))
    def check(self, visible=True, imageStock='gtk-yes'):
        if visible:
            expectThat(self.visible).equals(
                visible,
                msg="Expected {0} label to be visible, but its wasn't".format(
                    self.name))

            expectThat(self.stock).equals(
                imageStock,
                msg="Expected {0} image to have stock image {1} but instead "
                "it is {2}".format(self.name, imageStock, self.stock))
Esempio n. 5
0
    def _enter_pass_phrase(self, phrase):

        pwd_entries = ['password', 'verified_password']
        for i in pwd_entries:
            entry = self.select_single(BuilderName=i)
            with self.kbd.focused_type(entry) as kb:
                kb.press_and_release('Ctrl+a')
                kb.press_and_release('Delete')
                expectThat(entry.text).equals(
                    u'',
                    msg='{0} entry text was not cleared properly'.format(
                        entry.name))
                kb.type(phrase)
Esempio n. 6
0
    def _enter_pass_phrase(self, phrase):

        pwd_entries = ['password', 'verified_password']
        for i in pwd_entries:
            entry = self.select_single(BuilderName=i)
            with self.kbd.focused_type(entry) as kb:
                kb.press_and_release('Ctrl+a')
                kb.press_and_release('Delete')
                expectThat(entry.text).equals(
                    u'',
                    msg='{0} entry text was not cleared properly'
                        .format(entry.name))
                kb.type(phrase)
Esempio n. 7
0
 def check_dialog_objects(self, ):
     objects = ['partition_mount_combo',
                'partition_use_combo',
                'partition_create_type_primary',
                'partition_create_type_logical',
                'partition_create_place_beginning',
                'partition_create_place_end',
                ]
     for name in objects:
         obj = self.select_single(BuilderName=name)
         obj.check()
     expectThat(self.visible).equals(
         True,
         msg='Partition Dialog was not visible')
Esempio n. 8
0
    def encrypt_home_dir(self, encrypt=None):
        """ Check the login_encrypt box """
        chk_encrypt = self.select_single(BuilderName='login_encrypt')
        active = chk_encrypt.active

        if encrypt is None:
            # Switch checkbox and ensure it switched
            self.pointing_device.click_object(chk_encrypt)
            expectThat(chk_encrypt.active).equals(
                not active,
                msg='encrypt home checkbox state did not change. Current '
                'state: {0}'.format(chk_encrypt.active))
        elif encrypt and not active:
            self.pointing_device.click_object(chk_encrypt)
            expectThat(chk_encrypt.active).equals(
                True,
                msg='encrypt home checkbox not active and should be.')
        elif not encrypt and active:
            self.pointing_device.click_object(chk_encrypt)
            expectThat(chk_encrypt.active).equals(
                False,
                msg='encrypt home checkbox active and should not be.')
        else:
            raise ValueError("Invalid value for 'encrypt' parameter: {}"
                             .format(encrypt))
Esempio n. 9
0
    def encrypt_home_dir(self, encrypt=None):
        """ Check the login_encrypt box """
        chk_encrypt = self.select_single(BuilderName='login_encrypt')
        active = chk_encrypt.active

        if encrypt is None:
            # Switch checkbox and ensure it switched
            self.pointing_device.click_object(chk_encrypt)
            expectThat(chk_encrypt.active).equals(
                not active,
                msg='encrypt home checkbox state did not change. Current '
                'state: {0}'.format(chk_encrypt.active))
        elif encrypt and not active:
            self.pointing_device.click_object(chk_encrypt)
            expectThat(chk_encrypt.active).equals(
                True,
                msg='encrypt home checkbox not active and should be.')
        elif not encrypt and active:
            self.pointing_device.click_object(chk_encrypt)
            expectThat(chk_encrypt.active).equals(
                False,
                msg='encrypt home checkbox active and should not be.')
        else:
            raise ValueError("Invalid value for 'encrypt' parameter: {}"
                             .format(encrypt))
Esempio n. 10
0
    def select_location(self, location):
        """ Selects a location on the timezone map """
        if self.name == 'stepLocation':
            logger.debug("select_location({0})".format(location))

            location_map = self.select_single('CcTimezoneMap')
            self.pointing_device.move_to_object(location_map)
            x1, y1, x2, y2 = location_map.globalRect
            #hmmmm this is tricky! and really hacky
            pos = self.pointing_device.position()
            x = pos[0]
            y = pos[1]
            x -= 25  # px
            self.pointing_device.move(x, y)
            while True:
                entry = self.select_single('GtkEntry')
                if entry.text != location:
                    pos = self.pointing_device.position()
                    x = pos[0]
                    y = pos[1]
                    y -= 10  # px
                    self.pointing_device.move(x, y)
                    self.pointing_device.click()
                    if y < y1:
                        logger.warning("We missed the location on the map and "
                                       "ended up outside the globalRect. Now "
                                       "using the default selected location "
                                       "instead")
                        break
                else:
                    expectThat(entry.text).equals(location)
                    logger.debug("Location; '{0}' selected".format(location))
                    break
        else:
            raise ValueError("Function can only be called from a "
                             "stepLocation page object")
Esempio n. 11
0
    def select_location(self, location):
        """ Selects a location on the timezone map """
        if self.name == 'stepLocation':
            logger.debug("select_location({0})".format(location))

            location_map = self.select_single('CcTimezoneMap')
            self.pointing_device.move_to_object(location_map)
            x1, y1, x2, y2 = location_map.globalRect
            # hmmmm this is tricky! and really hacky
            pos = self.pointing_device.position()
            x = pos[0]
            y = pos[1]
            x -= 25  # px
            self.pointing_device.move(x, y)
            while True:
                entry = self.select_single('GtkEntry')
                if entry.text != location:
                    pos = self.pointing_device.position()
                    x = pos[0]
                    y = pos[1]
                    y -= 10  # px
                    self.pointing_device.move(x, y)
                    self.pointing_device.click()
                    if y < y1:
                        logger.warning("We missed the location on the map and "
                                       "ended up outside the globalRect. Now "
                                       "using the default selected location "
                                       "instead")
                        break
                else:
                    expectThat(entry.text).equals(location)
                    logger.debug("Location; '{0}' selected".format(location))
                    break
        else:
            raise ValueError("Function can only be called from a "
                             "stepLocation page object")
 def check(self, visible=True):
     expectThat(self.label).is_unicode()
     expectThat(self.label).not_equals(
         u'',
         msg="Expected {0} label to contain text, but its empty".format(
             self.name))
     expectThat(self.visible).equals(
         visible,
         msg="Expected {0} label to be visible, but its wasn't".format(
             self.name))
Esempio n. 13
0
 def check(self, visible=True):
     expectThat(self.label).is_unicode()
     expectThat(self.label).not_equals(
         u'',
         msg="Expected {0} label to contain text, but its empty"
             .format(self.name))
     expectThat(self.visible).equals(
         visible,
         msg="Expected {0} label to be visible, but its wasn't"
             .format(self.name))
Esempio n. 14
0
    def _enter_username(self, name):
        """ Enters the username

        :param name: username for user account
        """
        logger.debug("_enter_username({0})".format(name))
        entry = self.select_single('GtkEntry', name='fullname')
        with self.kbd.focused_type(entry) as kb:
            kb.press_and_release('Ctrl+a')
            kb.press_and_release('Delete')
            kb.type(name)

        #lets get the fullname from the entry
        # as we don't know the kb layout till runtime
        fullname = entry.text
        logger.debug("Checking that name, username and hostname all contain "
                     "'{0}'".format(name))
        #now check computer name contains username
        hostname_entry = self.select_single('GtkEntry', name='hostname')
        expectThat(hostname_entry.text).contains(
            fullname.lower(),
            msg="GtkBox._enter_username(): Expected the hostname entry: "
                "'{0}', to contain '{1}'"
                .format(hostname_entry.text, fullname.lower()))
        #check username contains name
        username_entry = self.select_single('GtkEntry', name='username')
        expectThat(username_entry.text).contains(
            fullname.lower(),
            msg="GtkBox._enter_username(): Expected the username entry: "
                "'{0}', to contain '{1}'"
                .format(username_entry.text, fullname.lower()))
        #check the GtkYes images are now visible
        logger.debug("Checking the stock 'gtk-yes' images are visible")
        images = ['fullname_ok', 'hostname_ok', 'username_ok']
        for image in images:
            img = self.select_single('GtkImage', name=image)
            expectThat(img.visible).equals(
                True,
                msg="Expected {0} image to be visible but it wasn't"
                .format(img.name))
            expectThat(img.stock).equals(
                'gtk-yes',
                msg="Expected {0} image to have a 'gtk-yes' stock image and "
                    "not {1}".format(img.name, img.stock))
Esempio n. 15
0
    def _enter_username(self, name):
        """ Enters the username

        :param name: username for user account
        """
        logger.debug("_enter_username({0})".format(name))
        entry = self.select_single('GtkEntry', name='fullname')
        with self.kbd.focused_type(entry) as kb:
            kb.press_and_release('Ctrl+a')
            kb.press_and_release('Delete')
            kb.type(name)

        # lets get the fullname from the entry
        # as we don't know the kb layout till runtime
        fullname = entry.text
        logger.debug("Checking that name, username and hostname all contain "
                     "'{0}'".format(name))
        # now check computer name contains username
        hostname_entry = self.select_single('GtkEntry', name='hostname')
        expectThat(hostname_entry.text).contains(
            fullname.lower(),
            msg="GtkBox._enter_username(): Expected the hostname entry: "
            "'{0}', to contain '{1}'".format(hostname_entry.text,
                                             fullname.lower()))
        # check username contains name
        username_entry = self.select_single('GtkEntry', name='username')
        expectThat(username_entry.text).contains(
            fullname.lower(),
            msg="GtkBox._enter_username(): Expected the username entry: "
            "'{0}', to contain '{1}'".format(username_entry.text,
                                             fullname.lower()))
        # check the GtkYes images are now visible
        logger.debug("Checking the stock 'gtk-yes' images are visible")
        images = ['fullname_ok', 'hostname_ok', 'username_ok']
        for image in images:
            img = self.select_single('GtkImage', name=image)
            expectThat(img.visible).equals(
                True,
                msg="Expected {0} image to be visible but it wasn't".format(
                    img.name))
            expectThat(img.stock).equals(
                'gtk-yes',
                msg="Expected {0} image to have a 'gtk-yes' stock image and "
                "not {1}".format(img.name, img.stock))
Esempio n. 16
0
 def click(self, ):
     """ This simply clicks a treeview object """
     self.pointing_device.click_object(self)
     expectThat(self.is_focus).equals(True)
 def click(self, ):
     """ This simply clicks a treeview object """
     self.pointing_device.click_object(self)
     expectThat(self.is_focus).equals(True)