Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

[WIPTEST] Automating MA test case #9938

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions cfme/tests/migration_analytics/test_migration_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: We can use appliance.evmserverd.restart() here.

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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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()
70 changes: 70 additions & 0 deletions cfme/v2v/migration_analytics.py
Original file line number Diff line number Diff line change
@@ -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")
1 change: 1 addition & 0 deletions entry_points.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down