Esempio n. 1
0
class GtkSpinButton(AutopilotGtkEmulatorBase):
    """ Emulator class for a GtSpinButton instance"""
    def __init__(self, *args):
        super(GtkSpinButton, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())
        self.kbd = Keyboard.create()

    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 _select_entry(self, ):
        self.pointing_device.move_to_object(self)
        pos = self.pointing_device.position()
        x = pos[0]
        y = pos[1]
        x -= 15  # px
        self.pointing_device.move(x, y)
        self.pointing_device.click()
        self.kbd.press_and_release('Ctrl+a')
        self.kbd.press_and_release('Delete')
class GtkSpinButton(AutopilotGtkEmulatorBase):
    """ Emulator class for a GtSpinButton instance"""
    def __init__(self, *args):
        super(GtkSpinButton, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())
        self.kbd = Keyboard.create()

    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 _select_entry(self, ):
        self.pointing_device.move_to_object(self)
        pos = self.pointing_device.position()
        x = pos[0]
        y = pos[1]
        x -= 15  # px
        self.pointing_device.move(x, y)
        self.pointing_device.click()
        self.kbd.press_and_release('Ctrl+a')
        self.kbd.press_and_release('Delete')
Esempio n. 3
0
 def _long_press_key(self, key_rect, pointer=None):
     if pointer is None:
         pointer = Pointer(Touch.create())
     pointer.move(key_rect.x + key_rect.w / 2.0,
                  key_rect.y + key_rect.h / 2.0)
     pointer.press()
     sleep(0.5)
     pointer.release()
Esempio n. 4
0
 def _long_press_key(self, key_rect, pointer=None):
     if pointer is None:
         pointer = Pointer(Touch.create())
     pointer.move(
         key_rect.x + key_rect.w / 2.0, key_rect.y + key_rect.h / 2.0)
     pointer.press()
     sleep(0.5)
     pointer.release()
Esempio n. 5
0
class GtkBox(GtkContainers):
    """ Emulator class for a GtkBox instance """
    def __init__(self, *args):
        super(GtkBox, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())
        self.kbd = Keyboard.create()

    def get_random_language(self, ):
        """ gets a random language from the 'stepLanguage' page

        :returns: A random TreeView item from the language treeview
        :raises: EmulatorException if function is not called from the
                step language page object

        You can now use select_language_item

        """
        logger.debug("get_random_language()")
        if self.name == 'stepLanguage':
            language_item = self._get_install_language()
            if language_item is None:
                raise ValueError("Language could not be selected")
            return language_item
        raise RuntimeError("Function can only be used from a stepLanguage "
                           "page object. Use .select_single('GtkBox, "
                           "name='stepLanguage')")

    def select_language(self, item):
        """ Selects a language for the install

        You can either use get_random_language or if you want to set the
        install language instead of randomly selecting an item. Then select
        from the treeview using GtkTreeView.select_item and pass the returned
        item to select_language

        :param item: A treeview item object
        :raises: exception if function not called from stepLanguage page object


        """
        if self.name == 'stepLanguage':
            logger.debug("select_language()")
            treeview = self.select_single('GtkTreeView')
            treeview.click()
            #for sanity lets ensure we always start at the top of the list
            logger.debug("Selecting top item of treeview list")
            self.kbd.press_and_release('Home')
            tree_items = treeview.get_all_items()
            top_item = tree_items[0]
            #If we are at the top
            if top_item.selected:
                logger.debug("top item {0} selected"
                             .format(top_item.accessible_name))
                #Now select required Language
                self.kbd.type(item.accessible_name[0:2])
                item.click()
                #check selected
                if item.selected:
                    logger.debug("Install language successfully selected! :-)")
                    return
                raise ValueError("Could not select Item")
            raise ValueError("Top item  not selected")
        raise ValueError("Function can only be used from a stepLanguage page "
                         "object. Use .select_single('GtkBox, "
                         "name='stepLanguage')")

    def _get_install_language(self, ):
        """ Gets a random language for the install

        :returns: an object of a TreeView item for the chosen language
        """
        logger.debug("_get_install_language()")
        treeview = self.select_single('GtkTreeView')
        #lets get all items
        treeview_items = treeview.get_all_items()

        #get a language which the first two chars can be ascii decoded
        test_language = self._get_decode_ascii_item(treeview_items)
        return test_language

    def _get_decode_ascii_item(self, items):
        """ decodes a list of unicode items """
        logger.debug("_get_decode_ascii_item()")
        # at the moment we can't select all locales as this would be a pain
        # to figure out all encodings for keyboard input
        lang_item = None
        l_ascii = None
        while True:
            lang_item = random.choice(items)
            l_unicode = lang_item.accessible_name
            logger.debug("Attempting to decode %s" % l_unicode)
            lan = l_unicode[0:2]
            try:
                l_ascii = lan.encode('ascii')
            except UnicodeEncodeError:
                logger.debug("%s could not be decoded" % l_unicode)
                pass
            if l_ascii:
                logger.debug("%s decoded successfully" % l_unicode)
                break
        logger.debug("Returning selected language: %s" % l_unicode)
        return lang_item

    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 create_user(self, name, password):
        """ Creates a user account with password

        :param name: Username
        :param password: user password

        """
        logger.debug("create_user({0}, {1})".format(name, password))
        if self.name == 'stepUserInfo':
            self._enter_username(name)
            self._enter_password(password)
        else:
            raise ValueError("Function can only be called froma stepUserInfo"
                             "page object")

    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))

    def _enter_password(self, password):
        if self.name == 'stepUserInfo':

            while True:
                self._enter_pass_phrase(password)
                match = self._check_phrase_match()

                if match:
                    break
        else:
            raise ValueError("enter_crypto_phrase() can only be called from "
                             "stepPartCrypto page object")

    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)

    def _check_phrase_match(self, ):
        pwd1 = self.select_single(BuilderName='password').text
        pwd2 = self.select_single(BuilderName='verified_password').text
        if pwd1 == pwd2:
            return True
        else:
            return False

    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. 6
0
class GtkBox(GtkContainers):
    """ Emulator class for a GtkBox instance """
    def __init__(self, *args):
        super(GtkBox, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())
        self.kbd = Keyboard.create()

    def get_random_language(self, ):
        """ gets a random language from the 'stepLanguage' page

        :returns: A random TreeView item from the language treeview
        :raises: EmulatorException if function is not called from the
                step language page object

        You can now use select_language_item

        """
        logger.debug("get_random_language()")
        if self.name == 'stepLanguage':
            language_item = self._get_install_language()
            if language_item is None:
                raise ValueError("Language could not be selected")
            return language_item
        raise RuntimeError("Function can only be used from a stepLanguage "
                           "page object. Use .select_single('GtkBox, "
                           "name='stepLanguage')")

    def select_language(self, item):
        """ Selects a language for the install

        You can either use get_random_language or if you want to set the
        install language instead of randomly selecting an item. Then select
        from the treeview using GtkTreeView.select_item and pass the returned
        item to select_language

        :param item: A treeview item object
        :raises: exception if function not called from stepLanguage page object


        """
        if self.name == 'stepLanguage':
            logger.debug("select_language()")
            treeview = self.select_single('GtkTreeView')
            treeview.click()
            # for sanity lets ensure we always start at the top of the list
            logger.debug("Selecting top item of treeview list")
            self.kbd.press_and_release('Home')
            tree_items = treeview.get_all_items()
            top_item = tree_items[0]
            # If we are at the top
            if top_item.selected:
                logger.debug("top item {0} selected".format(
                    top_item.accessible_name))
                # Now select required Language
                self.kbd.type(item.accessible_name[0:2])
                item.click()
                # check selected
                if item.selected:
                    logger.debug("Install language successfully selected! :-)")
                    return
                raise ValueError("Could not select Item")
            raise ValueError("Top item  not selected")
        raise ValueError("Function can only be used from a stepLanguage page "
                         "object. Use .select_single('GtkBox, "
                         "name='stepLanguage')")

    def _get_install_language(self, ):
        """ Gets a random language for the install

        :returns: an object of a TreeView item for the chosen language
        """
        logger.debug("_get_install_language()")
        treeview = self.select_single('GtkTreeView')
        # lets get all items
        treeview_items = treeview.get_all_items()

        # get a language which the first two chars can be ascii decoded
        test_language = self._get_decode_ascii_item(treeview_items)
        return test_language

    def _get_decode_ascii_item(self, items):
        """ decodes a list of unicode items """
        logger.debug("_get_decode_ascii_item()")
        # at the moment we can't select all locales as this would be a pain
        # to figure out all encodings for keyboard input
        lang_item = None
        l_ascii = None
        while True:
            lang_item = random.choice(items)
            l_unicode = lang_item.accessible_name
            logger.debug("Attempting to decode %s" % l_unicode)
            lan = l_unicode[0:2]
            try:
                l_ascii = lan.encode('ascii')
            except UnicodeEncodeError:
                logger.debug("%s could not be decoded" % l_unicode)
                pass
            if l_ascii:
                logger.debug("%s decoded successfully" % l_unicode)
                break
        logger.debug("Returning selected language: %s" % l_unicode)
        return lang_item

    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 create_user(self, name, password):
        """ Creates a user account with password

        :param name: Username
        :param password: user password

        """
        logger.debug("create_user({0}, {1})".format(name, password))
        if self.name == 'stepUserInfo':
            self._enter_username(name)
            self._enter_password(password)
        else:
            raise ValueError("Function can only be called froma stepUserInfo"
                             "page object")

    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))

    def _enter_password(self, password):
        if self.name == 'stepUserInfo':

            while True:
                self._enter_pass_phrase(password)
                match = self._check_phrase_match()

                if match:
                    break
        else:
            raise ValueError("enter_crypto_phrase() can only be called from "
                             "stepPartCrypto page object")

    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)

    def _check_phrase_match(self, ):
        pwd1 = self.select_single(BuilderName='password').text
        pwd2 = self.select_single(BuilderName='verified_password').text
        if pwd1 == pwd2:
            return True
        else:
            return False

    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. 7
0
    def test_can_move_touch_wrapper(self):
        device = Pointer(Touch.create())
        device.move(34, 56)

        self.assertThat(device.x, Equals(34))
        self.assertThat(device.y, Equals(56))
class QtCreatorTestCase(AutopilotTestCase):
    def setUp(self):
        self.pointing_device = Pointer(Mouse.create())
        #        sdk_test_mode = os.environ['SDK_TEST_MODE']
        sdk_test_mode = os.environ.get('SDK_TEST_MODE', 'auto')
        if sdk_test_mode != 'manual':
            self._set_temporary_home_directory()
            self._set_click_chroot_suffix()
        super(QtCreatorTestCase, self).setUp()
        self.launch_qt_creator()

    def launch_qt_creator(self):
        #        self.patch_environment('HOME','/home/balogh')
        self.ide = self.launch_test_application('qtcreator')

    def _create_temporary_directory(self):
        self.temporary_directory = tempfile.mkdtemp()
        self.addCleanup(shutil.rmtree, self.temporary_directory)

    def _set_temporary_home_directory(self):
        self._create_temporary_directory()

        sourcedir = os.environ['HOME'] + "/.bazaar"
        destdir = self.temporary_directory + "/.bazaar"
        shutil.copytree(sourcedir, destdir, symlinks=False, ignore=None)

        sourcedir = os.environ['HOME'] + "/.config/QtProject/qtcreator"
        destdir = self.temporary_directory + "/.config/QtProject/qtcreator"
        shutil.copytree(sourcedir, destdir, symlinks=False, ignore=None)

        sourcedir = os.environ['HOME'] + "/.config/ubuntu-sdk"
        destdir = self.temporary_directory + "/.config/ubuntu-sdk"
        shutil.copytree(sourcedir, destdir, symlinks=False, ignore=None)

        sourcedir = os.environ[
            'HOME'] + "/.local/share/data/QtProject/qtcreator"
        destdir = self.temporary_directory + "/.local/share/data/QtProject/qtcreator"
        shutil.copytree(sourcedir, destdir, symlinks=False, ignore=None)

        self.patch_environment('HOME', self.temporary_directory)
        print os.environ['HOME']
        os.chdir(os.environ['HOME'])
        if not os.path.exists('.config/ubuntu-sdk'):
            os.makedirs('.config/ubuntu-sdk')
        open('.config/ubuntu-sdk/firstrun', 'w')

    def _set_click_chroot_suffix(self):
        ts = time.time()
        st = datetime.datetime.fromtimestamp(ts).strftime('%Y%m%d%H%M%S')
        os.environ["CLICK_CHROOT_SUFFIX"] = "testing" + st

    def _get_main_window(self):
        return self.ide.wait_select_single('Core::Internal::MainWindow')

    def _get_welcome_tab_view(self):
        return self.ide.wait_select_single(
            'QWidgetWindow',
            objectName='Core::Internal::MainWindowClassWindow')

    def _get_left_tabbar(self):
        main_window = self._get_main_window()
        return main_window.select_single('Core::Internal::FancyTabBar')

    def _get_number_of_tabs(self):
        tabs = self._get_left_tabbar().select_many('Core::Internal::FancyTab')
        return len(tabs)

    def _get_current_active_tab_name(self):
        return self._get_left_tabbar().selectedTabLabel

    def _get_new_project_button(self):
        return self._get_welcome_tab_view().wait_select_single(
            'Button', text='New Project')

    def _get_new_project_dialog(self):
        return self._get_main_window().wait_select_single(
            'Core::Internal::NewDialog')

    def _click_new_project_dialog_choose_button(self):
        button = self._get_new_project_dialog().select_single(
            'QPushButton', text='&Choose...')

        self.pointing_device.click_object(button)

    def _get_new_project_wizard_dialog(self):
        return self.ide.wait_select_single(
            'Ubuntu::Internal::UbuntuProjectApplicationWizardDialog')

    def _get_new_project_name_input_field(self):
        return self._get_new_project_wizard_dialog().select_single(
            'Utils::ProjectNameValidatingLineEdit')

    def _get_new_project_location_field(self):
        return self._get_new_project_wizard_dialog().select_single(
            'Utils::PathChooser')

    def _clear_input_field(self, input_field):
        self.pointing_device.click_object(input_field)

        self.pointing_device.click()
        self.pointing_device.click()
        self.keyboard.press_and_release('Backspace')

    def _type_new_project_name(self, project):
        input_field = self._get_new_project_name_input_field()
        self._clear_input_field(input_field)

        self.keyboard.type(project)

    def _type_new_project_location(self, location):
        location_field = self._get_new_project_location_field()
        self._clear_input_field(location_field)

        self.keyboard.type(location)

    def click_new_project_button(self):
        new_button = self._get_new_project_button()

        self.pointing_device.click_object(new_button)

        return self._get_new_project_dialog()

    def _get_wizard_finish_button(self):
        return self._get_new_project_wizard_dialog().select_single(
            'QPushButton', text='&Finish')

    def _get_wizard_next_button(self):
        return self._get_new_project_wizard_dialog().select_single(
            'QPushButton', text='&Next >')

    def _click_wizard_finish_button(self):
        finish_button = self._get_wizard_finish_button()

        self.pointing_device.click_object(finish_button)

    def _click_wizard_next_button(self):
        next_button = self._get_wizard_next_button()

        self.pointing_device.click_object(next_button)

    def _createAndOpenProject(self, typeString, name):
        """ Open the New File and Project dialog by triggering the right action """
        action = self.ide.wait_select_single('QAction',
                                             text='&New File or Project...')
        action.slots.trigger()
        new_project_dialog = self._get_main_window().wait_select_single(
            'Core::Internal::NewDialog')
        """  Choose the App with Simple UI template in the Ubuntu category  """
        ubuntu_modelindex = new_project_dialog.wait_select_single(
            'QModelIndex', text='  Ubuntu')
        self.pointing_device.click_object(ubuntu_modelindex)
        app_with_simple_ui_modelindex = new_project_dialog.wait_select_single(
            'QModelIndex', text=typeString)
        self.pointing_device.click_object(app_with_simple_ui_modelindex)
        choose_pushbutton = new_project_dialog.wait_select_single(
            'QPushButton', text='Choose...')
        self.pointing_device.click_object(choose_pushbutton)
        application_wizard_dialog = self._get_main_window().wait_select_single(
            'Ubuntu::Internal::UbuntuProjectApplicationWizardDialog')
        """ Clear the default project name and enter the test name to the edit line and hit the Next->Next->Finish buttons """
        projectname_lineedit = application_wizard_dialog.wait_select_single(
            'Utils::ProjectNameValidatingLineEdit')
        projectname_lineedit.slots.clear()
        projectname_lineedit.slots.setText(name)
        next_pushbutton = application_wizard_dialog.wait_select_single(
            'QPushButton', text='&Next >')
        next_pushbutton.slots.click()
        next_pushbutton = application_wizard_dialog.wait_select_single(
            'QPushButton', text='&Next >')
        next_pushbutton.slots.click()

        for index, checkbox_kit in enumerate(
                application_wizard_dialog.select_many('QCheckBox')):
            if re.search('GCC ubuntu-sdk', checkbox_kit.text):
                checkbox_kit.slots.setChecked(True)

        checkbox_kit = application_wizard_dialog.wait_select_single(
            'QCheckBox', text='Desktop')
        checkbox_kit.slots.setChecked(False)

        next_pushbutton = application_wizard_dialog.wait_select_single(
            'QPushButton', text='&Next >')
        next_pushbutton.slots.click()
        next_pushbutton = application_wizard_dialog.wait_select_single(
            'QPushButton', text='&Finish')
        next_pushbutton.slots.click()

    def switch_to_tab_by_name(self, tab_name):
        current_tab = self._get_current_active_tab_name()
        if tab_name == current_tab:
            return

        tabbar = self._get_left_tabbar()
        tabbar_height = tabbar.height
        number_of_tabs = self._get_number_of_tabs()
        tbar_x, tbar_y, tbar_width, tbar_height = tabbar.globalRect

        tab_number = 1
        while current_tab != tab_name and not tab_number > number_of_tabs:
            tab_center = ((tabbar_height / number_of_tabs) * tab_number) - \
                         ((tabbar_height / number_of_tabs) / 2)
            tx = tbar_x + tbar_width / 2
            ty = tbar_y + tab_center
            self.pointing_device.move(tx, ty)
            self.pointing_device.click()

            current_tab = self._get_current_active_tab_name()
            tab_number += 1
Esempio n. 9
0
class CustomInstallTests(AutopilotTestCase):

    def setUp(self):
        super(CustomInstallTests, self).setUp()
        self.app = self.launch_application()

        self.pointing_device = Pointer(Mouse.create())

    def launch_application(self):
        my_process = int(os.environ['UBIQUITY_PID'])
        my_dbus = str(os.environ['DBUS_SESSION_BUS_ADDRESS'])
        return get_proxy_object_for_existing_process(
            pid=my_process, dbus_bus=my_dbus)

    def test_custom_install(self):
        '''
            Test install using Custom partition configuration
        '''
        self.keyboard.press_and_release('Super+1')

        main_window = self.app.select_single(
            'GtkWindow', name='live_installer')
        self.assertThat(main_window.title, Equals("Install"))
        # This method runs the ubiquity_ methods to navigate
        # testing through the install pages
        self.run_custom_install_test()

        #Then finally here check that the complete dialog appears

        self.ubiquity_did_install_complete()

    def run_custom_install_test(self):
        '''
            this can be easily used when debugging. If the test exits on a
            particular page, you can comment out the pages prior to the exit point
            and reset current page to its default state, then run test again.
            The test will start from the page it exited on. This can save alot of
            hassle having to setup the whole test again, just to fix a small error.
        '''
        #Page 1
        self.ubiquity_welcome_page_test()
        #Page 2
        self.ubiquity_preparing_page_test()
        ##Page 3
        self.ubiquity_install_type_page_test()
        ##Page 3 extended
        self.ubiquity_advanced_partition_page()
        #Page 4
        self.ubiquity_where_are_you_page_test()
        #Page 5
        self.ubiquity_keyboard_page_test()
        #Page 6
        self.ubiquity_who_are_you_page_test()
        #page 7
        self.ubiquity_progress_bar_test()

    def ubiquity_welcome_page_test(self):
        '''
            Tests that all needed objects on the Welcome page are accessible    
            And can also be navigated to.            
            Once confirmed continue with install accepting all defaults
        '''
        self.get_ubiquity_objects()

        self.assertThat(self.headerlabel.label, Eventually(Contains('Welcome')))
        #Can we navigate to the quit button? This fails the test if object
        # has no position attribs
        self.pointing_device.move_to_object(self.quit_button)
        self.assertThat(self.continue_button.label, Equals('Continue'))
        #Can we navigate to the continue button?
        self.pointing_device.move_to_object(self.continue_button)
        #Finally lets move on to the next page
        self.pointing_device.click()

    def ubiquity_preparing_page_test(self):

        self.wait_for_button_state_changed()
        #Check the next page title
        self.assertThat(self.headerlabel.label,
                        Eventually(Contains('Preparing to install')))
        #lets get all the page objects

        self.get_ubiquity_objects()
        '''
            Lets test we can go back to the welcome page and come back here
        '''
        #Click back
        self.pointing_device.move_to_object(self.back_button)
        self.pointing_device.click()

        self.wait_for_button_state_changed()
        #check we went back
        self.assertThat(self.headerlabel.label, Eventually(Contains('Welcome')))
        #go back to the page we were on
        self.get_ubiquity_objects()

        self.assertThat(self.continue_button.label, Equals('Continue'))
        self.pointing_device.move_to_object(self.continue_button)
        self.pointing_device.click()

        self.wait_for_button_state_changed()

        self.assertThat(self.headerlabel.label,
                        Eventually(Contains('Preparing to install')))

        '''
            Lets navigate round all objects
        '''
        # first need to get all objects again
        self.get_ubiquity_objects()
        #navigate to each one
        self.pointing_device.move_to_object(self.install_updates)
        self.pointing_device.move_to_object(self.third_party)
        self.pointing_device.move_to_object(self.back_button)
        self.pointing_device.move_to_object(self.quit_button)
        self.assertThat(self.continue_button.label, Equals('Continue'))
        self.pointing_device.move_to_object(self.continue_button)

        #Lets move on to next page now
        self.pointing_device.click()

    def ubiquity_install_type_page_test(self):

        """
            Check next page value
        """
        self.assertThat(self.headerlabel.label,
                        Eventually(Contains('Installation type')))
        #get all page objects
        self.get_ubiquity_objects()  
        '''
            Test we can go back to previous page and come back here
        '''
        #Go back
        self.pointing_device.move_to_object(self.back_button)
        self.pointing_device.click()

        self.wait_for_button_state_changed()

        self.assertThat(self.headerlabel.label,
                        Eventually(Contains('Preparing to install')))

        #To Come back again we need to get the objects of the preparing page
        self.get_ubiquity_objects()
        self.assertThat(self.continue_button.label, Equals('Continue'))
        self.pointing_device.move_to_object(self.continue_button)
        self.pointing_device.click()

        #check we came back ok
        self.assertThat(self.headerlabel.label,
                        Eventually(Contains('Installation type')))

        '''
            Lets check we can get and navigate to all the objects

            If we wanted to change the install type we can just add
            required clicks here for different installation types
        '''
        #Get all the page objects again
        self.get_ubiquity_objects()
        self.assertThat(self.erase_disk.label,
                        Contains('Erase disk and install'))
        self.pointing_device.move_to_object(self.erase_disk)
        self.pointing_device.move_to_object(self.lvm_install)
        self.pointing_device.move_to_object(self.something_else_install)
        self.pointing_device.move_to_object(self.encrypt_install)
        self.pointing_device.move_to_object(self.back_button)
        self.pointing_device.move_to_object(self.quit_button)
        self.pointing_device.move_to_object(self.continue_button)

        self.pointing_device.move_to_object(self.something_else_install)
        self.pointing_device.click()
        #and now continue
        self.assertThat(self.continue_button.label, Equals('Continue'))
        self.pointing_device.move_to_object(self.continue_button)
        self.pointing_device.click()

    def ubiquity_advanced_partition_page(self):

        self.get_ubiquity_objects()
        self.wait_for_button_state_changed()
        self.assertThat(self.headerlabel.label, Eventually(Contains('Installation type')))
        self.assertThat(self.adv_page_object.visible, Eventually(Equals(1)))
        #Create a new partition table
        self.pointing_device.move_to_object(self.adv_new_part_button)
        self.pointing_device.click()
        #COnfirm new table
        self.assertThat(self.adv_confirm_dialog.visible, Eventually(Equals(1)))
        self.keyboard.press_and_release('Right')
        self.keyboard.press_and_release('Enter')
        #check dialog closed
        self.assertThat(self.adv_confirm_dialog.visible, Eventually(Equals(0)))
        self.pointing_device.move_to_object(self.adv_undo_button)
        self.pointing_device.move_to_object(self.continue_button)
        self.pointing_device.move_to_object(self.adv_new_part_button)
        self.pointing_device.move_to_object(self.adv_scrolledwindow)
        self.pointing_device.click()

        self.keyboard.press_and_release('Down')

        self.keyboard.press_and_release('Enter')

        self.assertThat(self.partition_dialog.visible, Eventually(Equals(1)))

        #Create swap partition
        self.partition_dialog_create_partition('swap', '1000', 'end', 'primary')
        self.assertThat(self.partition_dialog.visible, Eventually(Equals(0)))

        self.wait_for_button_state_changed()

        self.keyboard.press_and_release('Down')
        self.keyboard.press_and_release('Enter')
        #create root partition
        self.partition_dialog_create_partition('/', '', 'beginning', 'primary')

        self.assertThat(self.partition_dialog.visible, Eventually(Equals(0)))

        self.wait_for_button_state_changed()

        self.pointing_device.move_to_object(self.continue_button)
        self.pointing_device.click()

    def partition_dialog_create_partition(self, mount, size, partition_place, partition_type):
        ''' Create required partition

            Params
            ::mount = a string val of the required mount point
                    for example
                    * 'swap'
                    * '/'
                    * '/home'
                    * '/boot'
            ::size = string val of partition size required in MB
                    AN empty string '' takes all the available space

            ::partition_place = a string val of position of partition
                    * 'beginning'
                    * 'end'
            ::partition_type = string val of the type of partition
                    * 'logical'
                    or
                    * 'primary'
            Currently it uses the default partition format ext4        
        '''
        #get the objects just to ensure id's have not changed
        self.get_ubiquity_objects()
        self.assertThat(self.partition_dialog.visible, Eventually(Equals(1)))
        self.assertThat(self.partition_dialog.title, Eventually(Contains('Create partition')))

        if mount == 'swap' :
            self.select_spin_button()
            self.keyboard.type(size)
            if partition_place == 'beginning':
                self.pointing_device.move_to_object(self.place_begin_radio_button)
            elif partition_place == 'end' :
                self.pointing_device.move_to_object(self.place_end_radio_button)
            else: #if it matches neither lets place it at end by default as its a swap
                self.pointing_device.move_to_object(self.place_end_radio_button)
            self.pointing_device.click()

            if partition_type == 'primary' :
                self.pointing_device.move_to_object(self.primary_radio_button)
            elif partition_type == 'logical' :
                self.pointing_device.move_to_object(self.logical_radio_button)
            else:
                self.pointing_device.move_to_object(self.primary_radio_button)
            self.pointing_device.click()

            self.pointing_device.move_to_object(self.partition_use_combo)
            self.pointing_device.click()

            self.keyboard.press_and_release('Up')
            self.keyboard.press_and_release('Up')
            self.keyboard.press_and_release('Up')
            self.keyboard.press_and_release('Enter')
        else:
            # input partition size if it is not ''
            if size is not '' :
                self.select_spin_button()
                self.keyboard.type(size)

            if partition_place == 'beginning':
                self.pointing_device.move_to_object(self.place_begin_radio_button)
            elif partition_place == 'end' :
                self.pointing_device.move_to_object(self.place_end_radio_button)
            else: #if it matches neither lets place it at beginning by default
                self.pointing_device.move_to_object(self.place_end_radio_button)
            self.pointing_device.click()

            if partition_type == 'primary' :
                self.pointing_device.move_to_object(self.primary_radio_button)
            elif partition_type == 'logical' :
                self.pointing_device.move_to_object(self.logical_radio_button)
            else:
                self.pointing_device.move_to_object(self.primary_radio_button)
            self.pointing_device.click()

            self.pointing_device.move_to_object(self.mount_gtkentry)

            self.pointing_device.click()
            self.keyboard.type(mount)

        self.pointing_device.move_to_object(self.ok_button)
        self.pointing_device.click()

    def select_spin_button(self):

        self.pointing_device.move_to_object(self.size_spinbutton)
        pos = self.pointing_device.position()
        x = pos[0]
        y = pos[1]
        x = x - 8  #px
        self.pointing_device.move(x, y)
        self.pointing_device.click()
        self.keyboard.press_and_release('Ctrl+a')

    def ubiquity_where_are_you_page_test(self):
        """
            From this point on the installation has started

            If you need to re-run the test from here then the HDD partitions
            need to be wiped
            and ./run_ubiquity run again
        """

        #check button activated
        self.wait_for_button_state_changed()
        self.get_ubiquity_objects()
        #check we are on the correct page. 
        self.assertThat(self.headerlabel.label,
                        Eventually(Contains('Where are you?')))

        #Not much to test on this page lets move on

        self.pointing_device.move_to_object(self.continue_button)

        self.pointing_device.click()

    def ubiquity_keyboard_page_test(self):
        #Check we are on the right page
        self.assertThat(self.headerlabel.label,
                        Eventually(Contains('Keyboard layout')))

        #get all the page objects
        self.get_ubiquity_objects()
        '''
            Test we can go back
        '''
        self.pointing_device.move_to_object(self.back_button)
        self.pointing_device.click()
        self.wait_for_button_state_changed()
        #check we went back ok
        self.assertThat(self.headerlabel.label,
                        Eventually(Contains('Where are you?')))

        #now lets go back

        self.continue_button = self.app.select_single('GtkButton',
                                                      name='next')
        self.pointing_device.move_to_object(self.continue_button)
        self.pointing_device.click()
        #wait for button to become active again
        self.wait_for_button_state_changed()
        #check we came back ok
        self.assertThat(self.headerlabel.label,
                        Eventually(Contains('Keyboard layout')))

        #We need to get the page objects again as the id's have changed
        self.get_ubiquity_objects()
        '''
            Test we can test keyboard
        '''
        self.pointing_device.move_to_object(self.keyboard_entry)
        self.pointing_device.click()
        self.keyboard.type('This is testing that we can enter text in this GtkEntry')
        '''
            Test we can navigate round the objects
        '''
        self.pointing_device.move_to_object(self.keyboard_layout)
        self.pointing_device.move_to_object(self.keyboard_entry)
        self.pointing_device.move_to_object(self.back_button)
        self.pointing_device.move_to_object(self.continue_button)
        #Lets move on to next page
        self.pointing_device.click()

    def ubiquity_who_are_you_page_test(self):
        """
            This method enters the new users details on the

            'Who are you?' page
        """
        #assert page title
        self.assertThat(self.headerlabel.label,
                        Eventually(Contains('Who are you')))
        self.get_ubiquity_objects()
        '''
            Test we can create a user
        '''
        self.keyboard.type('autopilot rocks')
        # Lets lose these tabs
        self.pointing_device.move_to_object(self.password_entry)
        self.pointing_device.click()

        #Intentionally cause passwords to mis-match
        self.keyboard.type('password')

        self.pointing_device.move_to_object(self.back_button)
        self.pointing_device.move_to_object(self.conf_pwd_entry)
        self.pointing_device.click()

        self.keyboard.type('will_not_match')

        #check that passwords match, and if not redo them
        self.check_passwords_match()

        self.pointing_device.move_to_object(self.continue_button)
        self.pointing_device.click()

    def check_passwords_match(self):

        while True:

            self.continue_button = self.app.select_single('GtkButton',
                                                          name='next')
            button_sensitive = self.continue_button.sensitive

            if button_sensitive == 1:
                self.assertThat(self.continue_button.sensitive, Equals(1))
                break

            #If passwords didn't match (which they didn't ;-) ) then retype them
            self.pointing_device.move_to_object(self.password_entry)
            self.pointing_device.click()
            self.keyboard.press_and_release('Ctrl+a')
            self.pointing_device.move_to_object(self.back_button)
            self.pointing_device.move_to_object(self.password_entry)
            self.keyboard.type('password')

            self.pointing_device.move_to_object(self.back_button)
            self.pointing_device.move_to_object(self.conf_pwd_entry)
            self.pointing_device.click()
            self.keyboard.press_and_release('Ctrl+a')
            self.pointing_device.move_to_object(self.back_button)
            self.pointing_device.move_to_object(self.password_entry)
            self.keyboard.type('password')

    def ubiquity_progress_bar_test(self):
        '''
            This method tracks the current progress of the install

            by using the fraction property of the progress bar

            to assertain the percentage complete.

        '''
        #We cant assert page title here as its an external html page
        #Maybe try assert WebKitWebView is visible
        self.webkitwindow = self.app.select_single('GtkScrolledWindow',
                                                   name='webkit_scrolled_window')
        self.assertThat(self.webkitwindow.visible,
                        Eventually(Equals(1)))
        #Can we track the progress percentage?
        self.install_progress = self.app.select_single('GtkProgressBar',
                                                       name='install_progress')

        #Copying files progress bar
        self.track_install_progress_bar()

        self.assertThat(self.install_progress.fraction,
                        Eventually(Equals(0.0)))
        #And now the install progress bar
        self.track_install_progress_bar()

    def track_install_progress_bar(self):
        '''
            Gets the value of the fraction property of the progress bar

            so we can see when the progress bar is complete

        '''
        progress = 0.0
        complete = 1.0
        while progress < complete:
            #Lets check there have been no install errors while in this loop
            self.check_for_install_errors()
            #keep updating fraction value
            progress = self.install_progress.fraction
            # Use for debugging. Shows current 'fraction' value
            print(progress)

    def ubiquity_did_install_complete(self):
        self.complete_dialog = self.app.select_single('GtkDialog',
                                                      name='finished_dialog')
        self.assertThat(self.complete_dialog.title,
                        Eventually(Contains('Installation Complete')))
        self.con_testing_button = self.complete_dialog.select_single('GtkButton',
                                                                     name='quit_button')
        self.restart_button = self.complete_dialog.select_single('GtkButton',
                                                                 name='reboot_button')
        self.assertThat(self.complete_dialog.visible,
                        Eventually(Equals(1)))

    def wait_for_button_state_changed(self):
        '''
            This waits on the continuebutton becoming active again
        '''
        self.continue_button = self.app.select_single('GtkButton',
                                                      name='next')
        #check button disabled
        self.assertThat(self.continue_button.sensitive,
                        Eventually(Equals(0)))

        obj_prop = self.continue_button.sensitive
        #lets wait for button to enable again
        while obj_prop != 1:
            #keep grabbing the button to refresh it's state
            self.continue_button = self.app.select_single('GtkButton',
                                                          name='next')
            obj_prop = self.continue_button.sensitive

            #Check there are no errors while in this loop
            self.check_for_install_errors()
        #lets check it is enabled before returning
        self.assertThat(self.continue_button.sensitive,
                        Eventually(Equals(1)))

    def check_for_install_errors(self):
        '''
            This checks that no error/unwanted dialogs appear

            simply asserting that their visible properties = 0

            If they are not visible then there is no problems, UI wise that is! ;-)
        '''
        # For each dialog lets, select each dialog and finally check its not visible

        crash_dialog = self.app.select_single('GtkDialog',
                                              name='crash_dialog')
        self.assertThat(crash_dialog.visible,
                        Equals(0))

        warning_dialog = self.app.select_single('GtkDialog',
                                                name='warning_dialog')
        self.assertThat(warning_dialog.visible,
                        Equals(0))

    def get_ubiquity_objects(self):
        """ Selects all the objects needed for usage in the test """

        #-----------------------------------------------------------------------#
        #               OBJECTS THAT ARE ON EVERY PAGE                          #
        #                                                                       #
        self.headerlabel = self.app.select_single('GtkLabel', name='page_title')
        self.quit_button = self.app.select_single('GtkButton', name='quit')
        self.assertThat(self.quit_button.label, Equals('_Quit'))
        # We cannot assert continue button label here as the label value changes
        self.continue_button = self.app.select_single('GtkButton', name='next')
        #-----------------------------------------------------------------------#

        #-----------------------------------------------------------------------#
        #               OBJECTS THAT ARE ON MULTIPLE PAGES                      #
        #                                                                       #
        self.back_button = self.app.select_single('GtkButton', name='back')
        self.assertThat(self.back_button.label, Equals('_Back'))
        #-----------------------------------------------------------------------#

        #-----------------------------------------------------------------------#
        #            OBJECTS 'FROM PREPARING TO INSTALL' PAGE                   #
        #                                                                       #
        self.install_updates = self.app.select_single('GtkCheckButton',
                                                      name='prepare_download_updates')
        self.assertThat(self.install_updates.label,
                        Equals('Download updates while installing'))
        self.third_party = self.app.select_single('GtkCheckButton',
                                                  name='prepare_nonfree_software')
        self.assertThat(self.third_party.label,
                        Equals('Install this third-party software'))
        #------------------------------------------------------------------------#

        #------------------------------------------------------------------------#
        #            OBJECTS FROM THE 'INSTALLATION TYPE' PAGE                   #
        #                                                                        #
        self.erase_disk = self.app.select_single('GtkRadioButton',
                                                     name='use_device')    
        self.encrypt_install = self.app.select_single('GtkCheckButton',
                                                      name='use_crypto')
        self.assertThat(self.encrypt_install.label,
                        Equals('Encrypt the new Ubuntu installation for security'))
        self.lvm_install = self.app.select_single('GtkCheckButton',
                                                  name='use_lvm')
        self.assertThat(self.lvm_install.label,
                        Equals('Use LVM with the new Ubuntu installation'))
        self.something_else_install = self.app.select_single('GtkRadioButton',
                                                             name='custom_partitioning')
        self.assertThat(self.something_else_install.label,
                        Equals('Something else'))
        #-------------------------------------------------------------------------#

        #-------------------------------------------------------------------------#
        #            OBJECTS FROM THE KEYBOARD LAYOUT PAGE                        #
        #                                                                         #

        self.keyboard_entry = self.app.select_single('GtkEntry',
                                                     name='keyboard_test')
        self.keyboard_layout = self.app.select_single('GtkButton',
                                                      name='deduce_layout')
        self.assertThat(self.keyboard_layout.label,
                        Equals('Detect Keyboard Layout'))
        #-------------------------------------------------------------------------#

        #-------------------------------------------------------------------------#
        #             OBJECTS FROM THE 'WHO ARE YOU' PAGE                         #
        #                                                                         #
        self.user_gtkbox = self.app.select_single('GtkBox',
                                                  name='stepUserInfo')
        self.user_gtkgrid = self.user_gtkbox.select_single('GtkGrid',
                                                           name='userinfo_table')
        self.user_hbox1 = self.user_gtkgrid.select_single('GtkBox',
                                                          name='hbox1')
        self.password_entry = self.user_hbox1.select_single('GtkEntry',
                                                            name='password')
        self.user_hbox2 = self.user_gtkgrid.select_single('GtkBox',
                                                          name='hbox2')
        self.conf_pwd_entry = self.user_hbox2.select_single('GtkEntry',
                                                            name='verified_password')
        #--------------------------------------------------------------------------#

        #--------------------------------------------------------------------------#
        #              OBJECTS FROM LVM ENCRYPTION PASSWORD PAGE                   #
        #                                                                          #
        self.password_grid = self.app.select_single('GtkGrid', name='password_grid')
        self.encrypt_password = self.password_grid.select_single('GtkEntry',
                                                                 name='password')
        self.verify_encrypt_password = self.password_grid.select_single('GtkEntry',
                                                                        name='verified_password')

        #--------------------------------------------------------------------------#
        #             OBJECTS FROM THE ADVANCED PARTITION PAGE                     #
        #                                                                          #
        self.adv_page_object = self.app.select_single('GtkAlignment',
                                                      name='stepPartAdvanced')
        self.adv_toolbar_grid = self.adv_page_object.select_single('GtkGrid',
                                                                   name='partition_list_buttonbox')
        self.adv_toolbar = self.adv_toolbar_grid.select_single('GtkToolbar',
                                                               name='partition_toolbar')
        self.adv_new_button = self.adv_toolbar.select_single('GtkToolButton',
                                                             name='partition_button_new')
        self.adv_del_button = self.adv_toolbar.select_single('GtkToolButton',
                                                             name='partition_button_delete')
        self.adv_edit_button = self.adv_toolbar.select_single('GtkToolButton',
                                                              name='partition_button_edit')
        self.adv_undo_button = self.adv_toolbar_grid.select_single('GtkButton',
                                                                   name='partition_button_undo')
        self.adv_new_part_button = self.adv_toolbar_grid.select_single('GtkButton',
                                                                       name='partition_button_new_label')
        self.adv_spinner = self.adv_toolbar_grid.select_single('GtkSpinner',
                                                               name='part_advanced_recalculating_spinner')
        self.adv_scrolledwindow = self.adv_page_object.select_single('GtkScrolledWindow',
                                                                     name='scrolledwindow')
        # The Confirm Dialog when creating a new table
        self.adv_confirm_dialog = self.app.select_single('GtkDialog',
                                                         name='ubi_question_dialog')
        self.adv_conf_button = self.adv_confirm_dialog.select_single('GtkButton',
                                                                     label='Continue')
        #Objects for the partition dialog
        self.partition_dialog = self.app.select_single('GtkDialog',
                                                       name='partition_dialog')
        self.size_spinbutton = self.partition_dialog.select_single('GtkSpinButton',
                                                                   name='partition_size_spinbutton')
        self.logical_radio_button = self.partition_dialog.select_single('GtkRadioButton',
                                                                        name='partition_create_type_logical')
        self.primary_radio_button = self.partition_dialog.select_single('GtkRadioButton',
                                                                        name='partition_create_type_primary')
        self.place_end_radio_button = self.partition_dialog.select_single('GtkRadioButton',
                                                                          name='partition_create_place_end')
        self.place_begin_radio_button = self.partition_dialog.select_single('GtkRadioButton',
                                                                            name='partition_create_place_beginning')
        self.mount_combo_box = self.partition_dialog.select_single('GtkComboBox',
                                                                   name='partition_mount_combo')
        self.mount_gtkentry = self.mount_combo_box.select_single('GtkEntry',
                                                                 name='combobox-entry4')
        self.partition_use_combo = self.partition_dialog.select_single('GtkComboBox',
                                                                       name='partition_use_combo')
        self.partition_use_cellview = self.partition_use_combo.select_single('GtkCellView')
        self.ok_button = self.partition_dialog.select_single('GtkButton', name='partition_dialog_okbutton')