Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.13.z] eol banner #1058

Merged
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
32 changes: 32 additions & 0 deletions airgun/entities/eol_banner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from airgun.entities.base import BaseEntity
from airgun.navigation import NavigateStep, navigator
from airgun.views.eol_banner import EOLBannerView


class EOLBannerEntity(BaseEntity):
def read(self):
view = self.navigate_to(self, 'NavigateToEOLBanner')
return view.read()

def dismiss(self):
view = self.navigate_to(self, 'NavigateToEOLBanner')
view.dismiss_button.click()

def is_warning(self):
view = self.navigate_to(self, 'NavigateToEOLBanner')
return view.warning

def is_danger(self):
view = self.navigate_to(self, 'NavigateToEOLBanner')
return view.danger


@navigator.register(EOLBannerEntity)
class NavigateToEOLBanner(NavigateStep):
VIEW = EOLBannerView

def step(self, *args, **kwargs):
self.view.wait_displayed()

def am_i_here(self, *args, **kwargs):
return self.view.is_displayed
6 changes: 6 additions & 0 deletions airgun/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from airgun.entities.discoveredhosts import DiscoveredHostsEntity
from airgun.entities.discoveryrule import DiscoveryRuleEntity
from airgun.entities.domain import DomainEntity
from airgun.entities.eol_banner import EOLBannerEntity
from airgun.entities.errata import ErrataEntity
from airgun.entities.filter import FilterEntity
from airgun.entities.hardware_model import HardwareModelEntity
Expand Down Expand Up @@ -345,6 +346,11 @@ def bookmark(self):
"""Instance of Bookmark entity."""
return self._open(BookmarkEntity)

@cached_property
def eol_banner(self):
"""Instance of Bookmark entity."""
return self._open(EOLBannerEntity)

@cached_property
def cloudinventory(self):
"""Instance of RH Cloud Inventory Upload entity."""
Expand Down
20 changes: 20 additions & 0 deletions airgun/views/eol_banner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from widgetastic.widget import ClickableMixin, Text, View


class EOLBannerView(View, ClickableMixin):
name = Text('//div[@id="satellite-eol-banner"]')
dismiss_button = Text('//*[@id="satellite-oel-banner-dismiss-button"]')

@property
def warning(self):
"""Return whether the banner is displayed in warning style"""
return 'warning' in " ".join(self.browser.classes(self.name))

@property
def danger(self):
"""Return whether the banner is displayed in danger style"""
return 'danger' in " ".join(self.browser.classes(self.name))

@property
def is_displayed(self):
return self.name.is_displayed
Loading