diff --git a/cfme/tests/migration_analytics/test_migration_analytics.py b/cfme/tests/migration_analytics/test_migration_analytics.py index be5187882c..36c1d3d52f 100644 --- a/cfme/tests/migration_analytics/test_migration_analytics.py +++ b/cfme/tests/migration_analytics/test_migration_analytics.py @@ -2,17 +2,34 @@ import pytest from cfme import test_requirements +from cfme.infrastructure.provider.virtualcenter import VMwareProvider +from cfme.utils.appliance.implementations.ui import navigate_to +from cfme.v2v.migration_analytics import MigrationAnalyticsSummaryView pytestmark = [ pytest.mark.ignore_stream("5.10"), pytest.mark.tier(1), - test_requirements.migration_analytics + test_requirements.migration_analytics, + pytest.mark.usefixtures("setup_provider"), ] -@pytest.mark.manual +@pytest.fixture(scope="module") +def enable_migration(appliance): + """This fixture helps to enable migration analytics in 5.11""" + def enable(is_enable): + yaml_data = {"prototype": {"migration_analytics": {"enabled": is_enable}}} + appliance.update_advanced_settings(yaml_data) + appliance.ssh_client.run_command('systemctl restart evmserverd') + appliance.wait_for_web_ui() + + enable(True) + yield + enable(False) + + @pytest.mark.smoke -def test_enable_migration_analytics(): +def test_enable_migration_analytics(appliance, enable_migration): """ Polarion: assignee: ghubale @@ -33,7 +50,8 @@ def test_enable_migration_analytics(): 3. 4. Check in UI. You will have navigation to Migration > Migration Analytics """ - pass + view = navigate_to(appliance.collections.v2v_migration_analytics, "All") + assert view.is_displayed @pytest.mark.manual @@ -192,8 +210,8 @@ def test_verify_manifest_version(): pass -@pytest.mark.manual -def test_confirm_environment_summary_data(): +@pytest.mark.provider([VMwareProvider], scope='function') +def test_confirm_environment_summary_data(appliance, enable_migration): """ Polarion: assignee: ghubale @@ -212,4 +230,7 @@ def test_confirm_environment_summary_data(): 2. 3. Check summary data """ - pass + view = navigate_to(appliance.collections.v2v_migration_analytics, "All") + view.get_started.click() + view = appliance.browser.create_view(MigrationAnalyticsSummaryView, wait=60) + view.summary.read() diff --git a/cfme/v2v/migration_analytics.py b/cfme/v2v/migration_analytics.py new file mode 100644 index 0000000000..23629a94e7 --- /dev/null +++ b/cfme/v2v/migration_analytics.py @@ -0,0 +1,70 @@ +import attr +from navmazing import NavigateToAttribute +from widgetastic.widget import View +from widgetastic_patternfly import Button +from widgetastic_patternfly import Text + +from cfme.common import BaseLoggedInPage +from cfme.modeling.base import BaseCollection +from cfme.modeling.base import BaseEntity +from cfme.utils.appliance.implementations.ui import CFMENavigateStep +from cfme.utils.appliance.implementations.ui import navigator +from widgetastic_manageiq import SummaryTable + + +class MigrationAnalyticsView(BaseLoggedInPage): + + @property + def in_explorer(self): + return self.logged_in_as_current_user and self.navigation.currently_selected == [ + "Migration", "Migration Analytics" + ] + + @property + def is_displayed(self): + return self.in_explorer + + +@attr.s +class MigrationAnalytics(BaseEntity): + pass + + +@attr.s +class MigrationAnalyticsCollection(BaseCollection): + """Collection for migration analytics""" + + ENTITY = MigrationAnalytics + + +class MigrationAnalyticsAllView(MigrationAnalyticsView): + + get_started = Text('.//div[contains(@class, "blank-slate-pf-main-action")]/button') + title = Text('.//div[contains(@class, "blank-slate-pf full-page-empty")]/h4') + + @property + def is_displayed(self): + return ( + self.in_explorer and + self.title.text == "Examine your virtual environment using Red Hat Migration Analytics" + ) + + +class MigrationAnalyticsSummaryView(View): + + title = Text('.//div[contains(@class, "environment-summary")]/h2') + collect_inventory_data = Button('.//div[contains(@class, "reports-summary")]/button') + summary = SummaryTable('.//div[contains(@class, "environment-summary")]/table') + + @property + def is_displayed(self): + return self.title.text == "Environment Summary" + + +@navigator.register(MigrationAnalyticsCollection, "All") +class All(CFMENavigateStep): + prerequisite = NavigateToAttribute("appliance.server", "LoggedIn") + VIEW = MigrationAnalyticsAllView + + def step(self): + self.prerequisite_view.navigation.select("Migration", "Migration Analytics") diff --git a/entry_points.txt b/entry_points.txt index e2e11219b2..8d9290eb91 100644 --- a/entry_points.txt +++ b/entry_points.txt @@ -123,6 +123,7 @@ time_profiles = cfme.configure.settings:TimeProfileCollection users = cfme.configure.access_control:UserCollection utilization = cfme.optimize.utilization:UtilizationCollection v2v_infra_mappings = cfme.v2v.infrastructure_mapping:InfrastructureMappingCollection +v2v_migration_analytics = cfme.v2v.migration_analytics:MigrationAnalyticsCollection v2v_migration_plans = cfme.v2v.migration_plans:MigrationPlanCollection v2v_conversion_hosts = cfme.v2v.migration_settings:ConversionHostCollection volume_backups = cfme.storage.volume_backup:VolumeBackupCollection