airgun.navigation¶
AirGun’s implementation of base navigation and navigate steps.
Module Contents¶
-
class
airgun.navigation.NavigateStep(obj, navigate_obj, logger=None)¶ Bases:
navmazing.NavigateStepAirGun’s version of
navmazing.NavigateStepwith custom implementations ofam_i_here(),go()and ability to work with views.-
VIEW¶
-
view(self)¶ Cached property which returns instance of view, which was defined for current navigate step by
VIEWclass attribute.
-
create_view(self, view_class, additional_context=None)¶ Method which creates an instance of view, defined by
view_class.Created instance will have references to
entity,airgun.browser.AirgunBrowserandairgun.session.Sessionset as instance attributesself.context['entity'],self.browserandself.extra.sessioncorrespondingly.Parameters: - view_class (widgetastic.widget.View) – class of view to create
- optional additional_context (dict) – any additional context you
want to include.
entityis set to current navigate step entity by default
Returns: instance of view
Return type: widgetastic.widget.View
-
am_i_here(self, *args, **kwargs)¶ Describes if the navigation is already at the requested destination.
By default, airgun relies on view’s
is_displayedproperty to determine whether navigation succeeded. If positional argumententity_namewas passed and view hasBreadCrumbwidget, it will also ensure second location in breadcrumb is provided entity name.This method may be overridden on specific entity’s NavigateStep level for more complex logic if needed.
Returns: whether navigator is at requested destination or not. Return type: bool
-
go(self, _tries=0, *args, **kwargs)¶ Wrapper around
navmazing.NavigateStep.go()which returns instance of view after successful navigation flow.Returns: view instance if class attribute VIEWis set orNoneotherwise
-
-
class
airgun.navigation.Navigate(browser=None)¶ Bases:
navmazing.NavigateWrapper around
navmazing.Navigatewhich adds airgun browser as class attribute.For more information about
Navigateplease refer to navmazing docs.
-
airgun.navigation.navigator¶