-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |