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

Commit

Permalink
Merge pull request #8398 from mmojzis/pdf_sdn_fix
Browse files Browse the repository at this point in the history
[1LP][RFR] pdf download popup fix
  • Loading branch information
izapolsk authored Jan 30, 2019
2 parents a55b382 + 42cf462 commit 8ec4993
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
25 changes: 17 additions & 8 deletions cfme/networks/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from cfme.base.login import BaseLoggedInPage
from cfme.common.provider_views import ProviderAddView, ProviderEditView
from cfme.exceptions import displayed_not_implemented
from cfme.utils.version import VersionPicker, Version
from widgetastic_manageiq import (
ManageIQTree,
SummaryTable,
Expand All @@ -33,7 +34,8 @@ class NetworkProviderToolBar(View):
class NetworkProviderDetailsToolBar(NetworkProviderToolBar):
""" Represents provider details toolbar """
monitoring = Dropdown(text='Monitoring')
download = Button(title='Download summary in PDF format')
download = VersionPicker({Version.lowest(): Button(title='Download summary in PDF format'),
"5.10": Button(title='Print or export summary')})


class NetworkProviderSideBar(View):
Expand Down Expand Up @@ -132,7 +134,8 @@ class BalancerToolBar(View):

class BalancerDetailsToolBar(BalancerToolBar):
""" Represents details toolbar of balancer summary """
download = Button(title='Download summary in PDF format')
download = VersionPicker({Version.lowest(): Button(title='Download summary in PDF format'),
"5.10": Button(title='Print or export summary')})


class BalancerSideBar(View):
Expand Down Expand Up @@ -203,7 +206,8 @@ class CloudNetworkToolBar(View):
class CloudNetworkDetailsToolBar(View):
""" Represents provider details toolbar """
policy = Dropdown(text='Policy')
download = Button(title='Download summary in PDF format')
download = VersionPicker({Version.lowest(): Button(title='Download summary in PDF format'),
"5.10": Button(title='Print or export summary')})


class CloudNetworkSideBar(View):
Expand Down Expand Up @@ -300,7 +304,8 @@ class NetworkPortToolBar(View):
class NetworkPortDetailsToolBar(View):
""" Represents toolbar of summary of port """
policy = Dropdown(text='Policy')
download = Button(title='Download summary in PDF format')
download = VersionPicker({Version.lowest(): Button(title='Download summary in PDF format'),
"5.10": Button(title='Print or export summary')})


class NetworkPortSideBar(View):
Expand Down Expand Up @@ -372,7 +377,8 @@ class NetworkRouterDetailsToolBar(View):
""" Represents provider toolbar and its controls """
configuration = Dropdown(text='Configuration')
policy = Dropdown(text='Policy')
download = Button(title='Download summary in PDF format')
download = VersionPicker({Version.lowest(): Button(title='Download summary in PDF format'),
"5.10": Button(title='Print or export summary')})


class NetworkRouterSideBar(View):
Expand Down Expand Up @@ -475,7 +481,8 @@ class SecurityGroupToolBar(View):
class SecurityGroupDetailsToolBar(View):
""" Represents provider details toolbar """
policy = Dropdown(text='Policy')
download = Button(title='Download summary in PDF format')
download = VersionPicker({Version.lowest(): Button(title='Download summary in PDF format'),
"5.10": Button(title='Print or export summary')})
view_selector = View.nested(ItemsToolBarViewSelector)


Expand Down Expand Up @@ -562,7 +569,8 @@ class SubnetDetailsToolBar(View):
""" Represents provider details toolbar """
configuration = Dropdown(text='Configuration')
policy = Dropdown(text='Policy')
download = Button(title='Download summary in PDF format')
download = VersionPicker({Version.lowest(): Button(title='Download summary in PDF format'),
"5.10": Button(title='Print or export summary')})


class SubnetAddView(BaseLoggedInPage):
Expand Down Expand Up @@ -788,7 +796,8 @@ class FloatingIpToolBar(View):
class FloatingIpDetailsToolBar(View):
""" Represents toolbar of summary of port """
policy = Dropdown(text='Policy')
download = Button(title='Download summary in PDF format')
download = VersionPicker({Version.lowest(): Button(title='Download summary in PDF format'),
"5.10": Button(title='Print or export summary')})


class FloatingIpDetailsSideBar(View):
Expand Down
22 changes: 19 additions & 3 deletions cfme/tests/networks/test_sdn_downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,29 @@
]


def download(appliance, objecttype, extension):
def download(objecttype, extension):
view = navigate_to(objecttype, 'All')
if appliance.version >= '5.10' and extension == 'pdf':
if view.browser.product_version >= '5.10' and extension == 'pdf':
view.toolbar.download.item_select("Print or export as PDF")
handle_extra_tabs(view)
else:
view.toolbar.download.item_select("Download as {}".format(extensions_mapping[extension]))


def download_summary(spec_object):
view = navigate_to(spec_object, 'Details')
view.toolbar.download.click()
if view.browser.product_version >= '5.10':
handle_extra_tabs(view)


def handle_extra_tabs(view):
tabs = view.browser.selenium.window_handles
while len(tabs) > 1:
view.browser.selenium.switch_to_window(tabs[-1])
view.browser.selenium.close()
tabs = view.browser.selenium.window_handles
view.browser.selenium.switch_to_window(tabs[0])


@pytest.mark.parametrize("filetype", extensions_mapping.keys())
Expand All @@ -56,9 +68,11 @@ def test_download_lists_base(filetype, collection_type, appliance):
Polarion:
assignee: mmojzis
initialEstimate: 1/10h
casecomponent: WebUI
caseimportance: medium
"""
collection = getattr(appliance.collections, collection_type)
download(appliance, collection, filetype)
download(collection, filetype)


@pytest.mark.uncollectif(
Expand All @@ -74,6 +88,8 @@ def test_download_pdf_summary(appliance, collection_type, provider):
Polarion:
assignee: mmojzis
initialEstimate: 1/10h
casecomponent: WebUI
caseimportance: medium
"""
collection = getattr(appliance.collections, collection_type)
all_entities = collection.all()
Expand Down

0 comments on commit 8ec4993

Please sign in to comment.