Skip to content

Commit

Permalink
eol banner (#1049)
Browse files Browse the repository at this point in the history
  • Loading branch information
pondrejk authored Dec 4, 2023
1 parent f9cbe6a commit 75c465e
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
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 @@ -33,6 +33,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 @@ -358,6 +359,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

0 comments on commit 75c465e

Please sign in to comment.