Ejemplo n.º 1
0
class InProgressPlansView(MigrationPlanView):
    progress_card = MigrationProgressBar()

    @property
    def is_displayed(self):
        return (self.in_migration_plan and self.progress_card.is_displayed
                and self.title.text == 'In Progress Plans')
Ejemplo n.º 2
0
class MigrationDashboardView(BaseLoggedInPage):
    create_infrastructure_mapping = Text(
        locator='(//a|//button)'
        '[text()="Create Infrastructure Mapping"]')
    create_migration_plan = Text(
        locator='(//a|//button)[text()="Create Migration Plan"]')
    configure_providers = Text(locator='//a[text()="Configure Providers"]')
    migration_plans_not_started_list = MigrationPlansList(
        "plans-not-started-list")
    migration_plans_completed_list = MigrationPlansList("plans-complete-list")
    migration_plans_archived_list = MigrationPlansList("plans-complete-list")
    infra_mapping_list = InfraMappingList("infra-mappings-list-view")
    migr_dropdown = MigrationDropdown(text="Not Started Plans")
    # TODO: XPATH requested to devel (repo:miq_v2v_ui_plugin issues:415)
    progress_card = MigrationProgressBar(
        locator='.//div[3]/div/div[3]/div[3]/div/div')

    @property
    def is_displayed(self):
        return (
            self.navigation.currently_selected == ['Compute', 'Migration'] and
            (len(self.browser.elements(".//div[contains(@class,'spinner')]"))
             == 0) and
            (len(self.browser.elements('.//div[contains(@class,"card-pf")]')) >
             0))

    def plan_in_progress(self, plan_name):
        """MIQ V2V UI is going through redesign as OSP will be integrated.

            # TODO: This also means that mappings/plans may be moved to different pages. Once all of
            that is settled we will need to refactor and also account for notifications.
        """
        try:
            try:
                is_plan_visible = self.progress_card.is_plan_visible(plan_name)
                plan_time_elapsed = self.progress_card.get_clock(plan_name)
            except ItemNotFound:
                # This will end the wait_for loop and check the plan under completed_plans section
                return True
            if is_plan_visible:
                # log current status
                # uncomment following logs after @Yadnyawalk updates the widget for in progress card
                # logger.info("For plan %s, current migrated size is %s out of total size %s",
                #     migration_plan.name, view.progress_card.get_migrated_size(plan_name),
                #     view.progress_card.get_total_size(migration_plan.name))
                # logger.info("For plan %s, current migrated VMs are %s out of total VMs %s",
                #     migration_plan.name, view.progress_card.migrated_vms(migration_plan.name),
                #     view.progress_card.total_vm_to_be_migrated(migration_plan.name))
                self.logger.info(
                    "For plan %s, is plan in progress: %s,"
                    "time elapsed for migration: %s", plan_name,
                    is_plan_visible, plan_time_elapsed)
            # return False if plan visible under "In Progress Plans"
            return not is_plan_visible
        except StaleElementReferenceException:
            self.browser.refresh()
            self.migr_dropdown.item_select("In Progress Plans")
            return False
Ejemplo n.º 3
0
class MigrationDashboardView(BaseLoggedInPage):
    create_infrastructure_mapping = Text(
        locator='(//a|//button)'
        '[text()="Create Infrastructure Mapping"]')
    create_migration_plan = Text(
        locator='(//a|//button)[text()="Create Migration Plan"]')
    configure_providers = Text(locator='//a[text()="Configure Providers"]')
    migration_plans_not_started_list = MigrationPlansList(
        "plans-not-started-list")
    migration_plans_completed_list = MigrationPlansList("plans-complete-list")
    infra_mapping_list = InfraMappingList("infra-mappings-list-view")
    migr_dropdown = MigrationDropdown(text="Not Started Plans")
    # TODO: XPATH requested to devel (repo:miq_v2v_ui_plugin issues:415)
    progress_bar = MigrationProgressBar(
        locator='.//div[3]/div/div[3]/div[3]/div/div')

    def _get_status(self, plan_name):
        """Returns status of migration plan"""
        # TODO: Error handling with try-except
        not_started = "Not Started Plans"
        self.migr_dropdown.item_select(not_started)
        if not self.migration_plans_not_started_list.is_plan_completed(
                plan_name):
            in_progress = "In Progress Plans"
            self.migr_dropdown.item_select(in_progress)
            wait_for(
                lambda: bool(self.progress_bar.is_plan_started(plan_name)),
                message="migration plan is starting, be patient please",
                delay=5,
                num_sec=3600)
            if self.progress_bar.is_plan_started(plan_name):
                flag = in_progress
            else:
                completed = "Completed Plans"
                self.migr_dropdown.item_select(completed)
                if self.migration_plans_completed_list.is_plan_completed(
                        plan_name):
                    flag = completed
                # TODO: Add archived plans tab to kk's widget
        else:
            flag = not_started
        self.migr_dropdown.item_select(flag)
        return flag

    @property
    def is_displayed(self):
        return (
            self.navigation.currently_selected == ['Compute', 'Migration'] and
            (len(self.browser.elements(".//div[contains(@class,'spinner')]"))
             == 0) and
            (len(self.browser.elements('.//div[contains(@class,"card-pf")]')) >
             0))
Ejemplo n.º 4
0
class MigrationPlanView(MigrationView):
    dashboard_cards = View.nested(DashboardCards)
    paginator_view = View.include(V2VPaginatorPane, use_parent=True)
    title = Text('.//div[contains(@class, "pull-left")]//h3')
    create_migration_plan = Text(locator='(//a|//button)[text()="Create Migration Plan"]')
    configure_providers = Text(locator='//a[text()="Configure Providers"]')
    sort_type_dropdown = SelectorDropdown("id", "sortTypeMenu")
    sort_direction = Text(locator=".//span[contains(@class,'sort-direction')]")
    progress_card = MigrationProgressBar()
    search_box = SearchBox(locator=".//div[contains(@class,'input-group')]/input")
    clear_filters = Text(".//a[text()='Clear All Filters']")

    @property
    def in_migration_plan(self):
        return (
            self.in_explorer and self.create_migration_plan.is_displayed and
            len(self.browser.elements('.//div[contains(@class,"card-pf")]')) > 0
            and len(self.browser.elements(PFIcon.icons.WARNING)) < 1
        )

    @property
    def is_displayed(self):
        return self.in_migration_plan
Ejemplo n.º 5
0
class MigrationDashboardView(BaseLoggedInPage):
    create_infrastructure_mapping = Text(
        locator='(//a|//button)'
        '[text()="Create Infrastructure Mapping"]')
    create_migration_plan = Text(
        locator='(//a|//button)[text()="Create Migration Plan"]')
    configure_providers = Text(locator='//a[text()="Configure Providers"]')
    migration_plans_not_started_list = MigrationPlansList(
        "plans-not-started-list")
    migration_plans_completed_list = MigrationPlansList("plans-complete-list")
    infra_mapping_list = InfraMappingList("infra-mappings-list-view")
    migr_dropdown = MigrationDropdown(text="Not Started Plans")
    # TODO: XPATH requested to devel (repo:miq_v2v_ui_plugin issues:415)
    progress_card = MigrationProgressBar(
        locator='.//div[3]/div/div[3]/div[3]/div/div')

    @property
    def is_displayed(self):
        return (
            self.navigation.currently_selected == ['Compute', 'Migration'] and
            (len(self.browser.elements(".//div[contains(@class,'spinner')]"))
             == 0) and
            (len(self.browser.elements('.//div[contains(@class,"card-pf")]')) >
             0))
Ejemplo n.º 6
0
class MigrationDashboardView(BaseLoggedInPage):
    create_infrastructure_mapping = Text(
        locator='(//a|//button)'
        '[text()="Create Infrastructure Mapping"]')
    create_migration_plan = Text(
        locator='(//a|//button)[text()="Create Migration Plan"]')
    configure_providers = Text(locator='//a[text()="Configure Providers"]')
    migration_plans_not_started_list = MigrationPlansList(
        "plans-not-started-list")
    migration_plans_completed_list = MigrationPlansList("plans-complete-list")
    migration_plans_archived_list = MigrationPlansList("plans-complete-list")
    sort_type_dropdown = SelectorDropdown('id', 'sortTypeMenu')
    sort_direction = Text(locator=".//span[contains(@class,'sort-direction')]")
    # TODO: XPATH requested to devel (repo:miq_v2v_ui_plugin issues:415)
    progress_card = MigrationProgressBar(
        locator='.//div[3]/div/div[3]/div[3]/div/div')
    not_started_plans = MigrationDashboardStatusCard(name="Not Started")
    in_progress_plans = MigrationDashboardStatusCard(name="In Progress")
    completed_plans = MigrationDashboardStatusCard(name="Complete")
    archived_plans = MigrationDashboardStatusCard(name="Archived")
    # TODO: next 3 lines are specialized only for 510z and inheritance for DashboardView59z
    # is incorrect. Need to fix it.
    paginator_view = View.include(v2vPaginatorPane, use_parent=True)
    search_box = TextInput(
        locator=".//div[contains(@class,'input-group')]/input")
    clear_filters = Text(".//a[text()='Clear All Filters']")

    @property
    def is_displayed(self):
        # TODO: Remove next line, after fix for https://github.com/ManageIQ/manageiq-v2v/issues/726
        # has been backported to downstream 510z
        return (
            (self.navigation.currently_selected == ['Compute', 'Migration']
             or self.navigation.currently_selected
             == ['Compute', 'Migration', 'Overview']) and
            (len(self.browser.elements(".//div[contains(@class,'spinner')]"))
             == 0) and
            (len(self.browser.elements('.//div[contains(@class,"card-pf")]')) >
             0) and len(
                 self.browser.elements(
                     ".//div[contains(@class,'pficon-warning-triangle-o')]")) <
            1)

    def switch_to(self, section):
        """Switches to Not Started, In Progress, Complete or Archived Plans section."""
        sections = {
            'Not Started Plans': self.not_started_plans,
            'In Progress Plans': self.in_progress_plans,
            'Completed Plans': self.completed_plans,
            'Archived Plans': self.archived_plans
        }
        self.logger.info("Switching to Migration Dashboard section: %s",
                         section)
        sections[section].click()

    def plan_in_progress(self, plan_name):
        """MIQ V2V UI is going through redesign as OSP will be integrated.

            # TODO: This also means that mappings/plans may be moved to different pages. Once all of
            that is settled we will need to refactor and also account for notifications.
        """
        try:
            try:
                is_plan_visible = self.progress_card.is_plan_visible(plan_name)
                plan_time_elapsed = self.progress_card.get_clock(plan_name)
            except ItemNotFound:
                # This will end the wait_for loop and check the plan under completed_plans section
                return True
            if is_plan_visible:
                # log current status
                # uncomment following logs after @Yadnyawalk updates the widget for in progress card
                # logger.info("For plan %s, current migrated size is %s out of total size %s",
                #     migration_plan.name, view.progress_card.get_migrated_size(plan_name),
                #     view.progress_card.get_total_size(migration_plan.name))
                # logger.info("For plan %s, current migrated VMs are %s out of total VMs %s",
                #     migration_plan.name, view.progress_card.migrated_vms(migration_plan.name),
                #     view.progress_card.total_vm_to_be_migrated(migration_plan.name))
                self.logger.info(
                    "For plan %s, is plan in progress: %s,"
                    "time elapsed for migration: %s", plan_name,
                    is_plan_visible, plan_time_elapsed)
            # return False if plan visible under "In Progress Plans"
            return not is_plan_visible
        except StaleElementReferenceException:
            self.browser.refresh()
            self.switch_to("In Progress Plans")
            return False