airgun.views.common

Module Contents

Classes

BaseLoggedInView

Base view for Satellite pages

WrongContextAlert

Alert screen which appears when switching organization while organization-specific entity is

SatTab

Regular primary level Tab.

SatVerticalTab

Represent vertical tabs that usually used in location and organization

SatTabWithDropdown

Regular primary level Tab with dropdown.

SatSecondaryTab

Secondary level Tab, typically 'List/Remove' or 'Add' sub-tab inside

LCESelectorGroup

Group of airgun.widgets.LCESelector, typically present on page

ListRemoveTab

'List/Remove' tab, part of AddRemoveResourcesView.

AddTab

Secondary level Tab, typically 'List/Remove' or 'Add' sub-tab inside

AddRemoveResourcesView

View which allows assigning/unassigning some resources to entity.

AddRemoveSubscriptionsView

A variant of AddRemoveResourcesView for managing subscriptions.

TemplateEditor

Default view for template entity editor that can be present for example

SearchableViewMixin

Mixin which adds airgun.widgets.Search widget and

SearchableViewMixinPF4

Mixin which adds airgun.widgets.Search widget and

TaskDetailsView

Common view for task details screen. Can be found for most of tasks for

BookmarkCreateView

Bookmark creation modal window, available via searchbox dropdown ->

TemplateInputItem

Template Input item view

class airgun.views.common.BaseLoggedInView(parent, logger=None, **kwargs)

Base view for Satellite pages

menu
taxonomies
flash
validations
dialog
logout
current_user
account_menu
permission_denied
select_logout()

logout from satellite

read(widget_names=None)

Reads the contents of the view and presents them as a dictionary.

Parameters

widget_names – If specified, will read only the widgets names in the list.

Returns

A dict of widget_name: widget_read_value where the values are retrieved using the Widget.read().

class airgun.views.common.WrongContextAlert(parent, logger=None, **kwargs)

Alert screen which appears when switching organization while organization-specific entity is opened.

message
back
property is_displayed

Overrides the Widget.is_displayed(). The difference is that if the view does not have the root locator, it assumes it is displayed.

Returns

bool

class airgun.views.common.SatTab(parent, logger=None, **kwargs)

Regular primary level Tab.

Usage:

@View.nested
class mytab(SatTab):
    TAB_NAME = 'My Tab'
@View.nested
class subscriptions(SatTab):
    # no need to specify 'TAB_NAME', it will be set to 'Subscriptions'
    # automatically
    pass

Note that TAB_NAME is optional and if it’s absent - capitalized class name is used instead, which is useful for simple tab names like ‘Subscriptions’

ROOT
property is_displayed

Overrides the Widget.is_displayed(). The difference is that if the view does not have the root locator, it assumes it is displayed.

Returns

bool

read()

Do not attempt to read hidden tab contents

class airgun.views.common.SatVerticalTab(parent, logger=None, **kwargs)

Represent vertical tabs that usually used in location and organization entities

Usage:

@View.nested
class mytab(SatVerticalTab):
    TAB_NAME = 'My Tab'
TAB_LOCATOR
class airgun.views.common.SatTabWithDropdown(parent, logger=None, **kwargs)

Regular primary level Tab with dropdown.

Usage:

@View.nested
class mytab(SatTabWithDropdown):
    TAB_NAME = 'My Tab'
    SUB_ITEM = 'My Tab Dropdown Item'
ROOT
property is_displayed

Overrides the Widget.is_displayed(). The difference is that if the view does not have the root locator, it assumes it is displayed.

Returns

bool

read()

Do not attempt to read hidden tab contents

class airgun.views.common.SatSecondaryTab(parent, logger=None, **kwargs)

Secondary level Tab, typically ‘List/Remove’ or ‘Add’ sub-tab inside some primary tab.

Usage:

@View.nested
class listremove(SatSecondaryTab):
    TAB_NAME = 'List/Remove'
ROOT
TAB_LOCATOR
class airgun.views.common.LCESelectorGroup(parent, logger=None, **kwargs)

Group of airgun.widgets.LCESelector, typically present on page for selecting desired lifecycle environment.

Usage:

lce = View.nested(LCESelectorGroup)

#or

@View.nested
class lce(LCESelectorGroup):
    pass
ROOT = .//*[self::div or self::span][@path-selector='environments' or @path-selector='availableEnvironments']
PARAMETERS = ['lce_name']
LAST_ENV = .//div[contains(@class, 'path-selector')]/ul/li[last()]
lce
classmethod all(browser)

Helper method which returns list of tuples with all LCESelector names (last available environment is used as a name). It’s required for read() to work properly.

fill(values=None)

Shortcut to pass the value to included lce

airgun.widgets.LCESelector widget. Usage remains the same as airgun.widgets.LCESelector and widgetastic.widget.ParametrizedView required param is filled automatically from passed lifecycle environment’s name.

Usage:

my_view.lce.fill({'PROD': True})
my_view.lce.fill({'PROD': 'Library'})

Value True or False means to set corresponding checkbox value to the last checkbox available in widget (last lifecycle environment). If you want to select different lifecycle environment within the same route - pass its name as a value instead

read()

Shortcut which returns value of included lce

airgun.widgets.LCESelector widget.

Note that returned result will be wrapped in extra dict due to widgetastic.widget.ParametrizedView nature:

{
    'DEV': {'Library': False, 'DEV': True},
    'QA': {'Library': False, 'IT': True},
    'PROD': {'Library': False, 'PROD': True},
}
class airgun.views.common.ListRemoveTab(parent, logger=None, **kwargs)

‘List/Remove’ tab, part of AddRemoveResourcesView.

TAB_NAME = List/Remove
searchbox
remove_button
table
search(value)

Search for specific associated resource and return the results

remove(value)

Remove specific associated resource

fill(values)

Remove associated resource(s).

read()

Return a list of associated resources

class airgun.views.common.AddTab(parent, logger=None, **kwargs)

Secondary level Tab, typically ‘List/Remove’ or ‘Add’ sub-tab inside some primary tab.

Usage:

@View.nested
class listremove(SatSecondaryTab):
    TAB_NAME = 'List/Remove'
TAB_NAME = Add
searchbox
add_button
table
search(value)

Search for specific available resource and return the results

add(value)

Associate specific resource

fill(values)

Associate resource(s)

read()

Return a list of available resources

class airgun.views.common.AddRemoveResourcesView(parent, logger=None, **kwargs)

View which allows assigning/unassigning some resources to entity. Contains two secondary level tabs ‘List/Remove’ and ‘Add’ with tables allowing managing resources for entity.

Usage:

@View.nested
class resources(AddRemoveResourcesView): pass
list_remove_tab
add_tab
add(values)

Assign some resource(s).

Parameters

values (str or list) – string containing resource name or a list of such strings.

remove(values)

Unassign some resource(s).

Parameters

values (str or list) – string containing resource name or a list of such strings.

read()

Read all table values from both resource tables

class airgun.views.common.AddRemoveSubscriptionsView(parent, logger=None, **kwargs)

A variant of AddRemoveResourcesView for managing subscriptions. Subscriptions table has different structure - entity label is located in separate row apart from checkbox and other cells.

class list_remove_tab(parent, logger=None, **kwargs)

‘List/Remove’ tab, part of AddRemoveResourcesView.

table
class add_tab(parent, logger=None, **kwargs)

Secondary level Tab, typically ‘List/Remove’ or ‘Add’ sub-tab inside some primary tab.

Usage:

@View.nested
class listremove(SatSecondaryTab):
    TAB_NAME = 'List/Remove'
table
class airgun.views.common.TemplateEditor(parent, logger=None, **kwargs)

Default view for template entity editor that can be present for example on provisioning template of partition table pages. It contains from different options of content rendering and ace editor where you can actually provide your inputs

Usage:

editor = View.nested(TemplateEditor)
ROOT = .//div[@id='editor-container']
rendering_options
import_template
fullscreen
editor
class airgun.views.common.SearchableViewMixin

Mixin which adds airgun.widgets.Search widget and airgun.widgets.Search.search() to your view. It’s useful for _most_ entities list views where searchbox and results table are present.

Note that class which uses this mixin should have :attr: table attribute.

searchbox
welcome_message
is_searchable()

Verify that search procedure can be executed against specific page. That means that we have search field present on the page and that page is not a welcome one

search(query)

Perform search using searchbox on the page and return table contents.

Parameters

query (str) – search query to type into search field. E.g. foo or name = "bar".

Returns

list of dicts representing table rows

Return type

list

class airgun.views.common.SearchableViewMixinPF4

Mixin which adds airgun.widgets.Search widget and airgun.widgets.Search.search() to your view. It’s useful for _most_ entities list views

where searchbox and results table are present. Note that class which uses this mixin should have :attr: table attribute.

searchbox
blank_page
is_searchable()

Verify that search procedure can be executed against specific page that is not blank

search(query)

Perform search using searchbox on the page and return table contents.

Parameters

query (str) – search query to type into search field. E.g. foo or name = "bar".

Returns

list of dicts representing table rows

Return type

list

class airgun.views.common.TaskDetailsView(parent, logger=None, **kwargs)

Common view for task details screen. Can be found for most of tasks for various entities like Products, Repositories, Errata etc.

breadcrumb
action_type
user
started_at
finished_at
parameters
state
result
progressbar
details
class airgun.views.common.BookmarkCreateView(parent, logger=None, **kwargs)

Bookmark creation modal window, available via searchbox dropdown -> Bookmark this search.

Has slightly different style for katello and foreman pages, thus some widgets have special locators.

ROOT = .//div[contains(@class, 'modal-dialog')]
title
name
query
error_message
public
submit
cancel
property is_displayed

Overrides the Widget.is_displayed(). The difference is that if the view does not have the root locator, it assumes it is displayed.

Returns

bool

class airgun.views.common.TemplateInputItem(parent, locator, logger=None)

Template Input item view

class UserInputForm(parent, logger=None, **kwargs)

View is a kind of abstract widget that can hold another widgets. Remembers the order, so therefore it can function like a form with defined filling order.

It looks like this:

class Login(View):
    user = SomeInputWidget('user')
    password = SomeInputWidget('pass')
    login = SomeButtonWidget('Log In')

    def a_method(self):
        do_something()

The view is usually instantiated with an instance of widgetastic.browser.Browser, which will then enable resolving of all of the widgets defined.

Parameters
  • parent – A parent View or widgetastic.browser.Browser

  • additional_context – If the view needs some context, for example - you want to check that you are on the page of user XYZ but you can also be on the page for user FOO, then you shall use the additional_context to pass in required variables that will allow you to detect this.

advanced
options
description
class FactValueForm(parent, logger=None, **kwargs)

View is a kind of abstract widget that can hold another widgets. Remembers the order, so therefore it can function like a form with defined filling order.

It looks like this:

class Login(View):
    user = SomeInputWidget('user')
    password = SomeInputWidget('pass')
    login = SomeButtonWidget('Log In')

    def a_method(self):
        do_something()

The view is usually instantiated with an instance of widgetastic.browser.Browser, which will then enable resolving of all of the widgets defined.

Parameters
  • parent – A parent View or widgetastic.browser.Browser

  • additional_context – If the view needs some context, for example - you want to check that you are on the page of user XYZ but you can also be on the page for user FOO, then you shall use the additional_context to pass in required variables that will allow you to detect this.

fact_name
description
class VariableValueForm(parent, logger=None, **kwargs)

View is a kind of abstract widget that can hold another widgets. Remembers the order, so therefore it can function like a form with defined filling order.

It looks like this:

class Login(View):
    user = SomeInputWidget('user')
    password = SomeInputWidget('pass')
    login = SomeButtonWidget('Log In')

    def a_method(self):
        do_something()

The view is usually instantiated with an instance of widgetastic.browser.Browser, which will then enable resolving of all of the widgets defined.

Parameters
  • parent – A parent View or widgetastic.browser.Browser

  • additional_context – If the view needs some context, for example - you want to check that you are on the page of user XYZ but you can also be on the page for user FOO, then you shall use the additional_context to pass in required variables that will allow you to detect this.

variable_name
description
class PuppetParameterForm(parent, logger=None, **kwargs)

View is a kind of abstract widget that can hold another widgets. Remembers the order, so therefore it can function like a form with defined filling order.

It looks like this:

class Login(View):
    user = SomeInputWidget('user')
    password = SomeInputWidget('pass')
    login = SomeButtonWidget('Log In')

    def a_method(self):
        do_something()

The view is usually instantiated with an instance of widgetastic.browser.Browser, which will then enable resolving of all of the widgets defined.

Parameters
  • parent – A parent View or widgetastic.browser.Browser

  • additional_context – If the view needs some context, for example - you want to check that you are on the page of user XYZ but you can also be on the page for user FOO, then you shall use the additional_context to pass in required variables that will allow you to detect this.

puppet_class_name
puppet_parameter_name
description
remove_button
name
required
input_type
input_content