widgetastic_patternfly4 package

Module contents

class widgetastic_patternfly4.Alert(parent, locator, logger=None)

Bases: widgetastic_patternfly4.alert.BaseAlert, widgetastic.widget.base.Widget

ROOT

ParametrizedString modified to return instances of smartloc.Locator

class widgetastic_patternfly4.BreadCrumb(parent, logger=None, **kwargs)

Bases: widgetastic_patternfly4.breadcrumb.BaseBreadCrumb, widgetastic.widget.base.Widget

ROOT = './/nav[contains(@class, "pf-c-breadcrumb")]/ol'
class widgetastic_patternfly4.Button(parent, *text, **kwargs)

Bases: widgetastic_patternfly4.button.BaseButton, widgetastic.widget.base.Widget, widgetastic.widget.base.ClickableMixin

A Patternfly button

You can match by text, partial text or by attributes, you can also add the patternfly classes into the matching.

Button("Text of button (unless it is an input ...)")
Button("contains", "Text of button (unless it is an input ...)")
Button(title="Show xyz")  # And such
Button("Add", classes=[Button.PRIMARY])
Button(locator=".//xpath")
assert button.active
assert not button.disabled
ROOT

ParametrizedString modified to return instances of smartloc.Locator

class widgetastic_patternfly4.BulletChart(parent=None, id=None, locator=None, logger=None, *args, **kwargs)

Bases: widgetastic.widget.base.View

Represents the Patternfly Bullet Chart.

https://www.patternfly.org/v4/documentation/react/charts/chartbullet

Parameters:
  • id – If you want to look the input up by id, use this parameter, pass the id.
  • locator – If you have specific locator else it will take pf-chart.
  • offset_denominator – Denominator for offset value calculation.
APPLY_OFFSET = True
DEFAULT_LOCATOR = ".//div[contains(@class, 'chartbullet')]"
ITEMS = ".//*[name()='g']/*[name()='path' and not(contains(@style, 'type:square'))]"
LEGEND_ICON = ".//*[name()='g' or name()='svg']/*[name()='rect']/following-sibling::*[name()='path']"
LEGEND_ITEM_REGEX = re.compile('(\\d+)\\s(\\w.*)|(\\w.*)\\s(\\d+)')
LEGEND_TEXT = ".//*[name()='text' and contains(@id, 'legend-labels')]"
ROOT

ParametrizedString modified to return instances of smartloc.Locator

TOOLTIP_REGEX = re.compile('(.*?): ([\\d]+)')
data

Read graph and returns all Data Point objects.

get_data_point(label)

Get specific data point object.

Parameters:label – Name of respective data point label.
get_legend(label)

Get specific Legend object.

Parameters:label – Name of legend label.
legend_names

Return all legend names.

legends

Return all Legend objects.

read()

Read graph and returns label, value dict.

tooltip

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

class widgetastic_patternfly4.CheckboxMenu(parent, text=None, locator=None, logger=None)

Bases: widgetastic_patternfly4.menu.BaseCheckboxMenu, widgetastic_patternfly4.dropdown.Dropdown

DEFAULT_LOCATOR = './/div[contains(@class, "pf-c-menu")]'
class widgetastic_patternfly4.CheckboxSelect(parent, text=None, locator=None, logger=None)

Bases: widgetastic_patternfly4.select.BaseCheckboxSelect, widgetastic_patternfly4.dropdown.Dropdown

DEFAULT_LOCATOR = './/div[contains(@class, "pf-c-select")][1]'
class widgetastic_patternfly4.Chip(*args, **kwargs)

Bases: widgetastic.widget.base.ParametrizedView, widgetastic_patternfly4.chipgroup._BaseChip

PARAMETERS = ('text',)
ROOT

ParametrizedString modified to return instances of smartloc.Locator

classmethod all(browser)

Returns a list of the text of each chip

read_only

Returns a boolean detailing if the chip is read only

remove()

Removes a chip

exception widgetastic_patternfly4.ChipReadOnlyError(chip, message)

Bases: Exception

class widgetastic_patternfly4.ChipGroup(parent, locator=None, logger=None)

Bases: widgetastic.widget.base.View

Represents a chip group that is “on its own”, i.e. not a part of a chip group category

ROOT

ParametrizedString modified to return instances of smartloc.Locator

chips

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

get_chips(show_more=True)

A helper to expand the chip group before reading its chips

has_chips
is_multiselect
label
overflow

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

read()

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

Returns:widget_read_value`` where the values are retrieved using the Widget.read().
Return type:A dict of ``widget_name
remove_all_chips()

Removes all chips from the group

remove_chip_by_name(name)

Removes a chip from the group by name

show_less()

Collapses a chip group

show_more()

Expands a chip group

class widgetastic_patternfly4.ChipGroupToolbar(parent, locator=None, logger=None)

Bases: widgetastic.widget.base.View

ROOT

ParametrizedString modified to return instances of smartloc.Locator

TOOLBAR_LOCATOR = ".//ul[contains(@class, 'pf-c-chip-group') and contains(@class, 'pf-m-toolbar')]/parent::*"
get_groups(show_more=True)

A helper to expand the chip group toolbar before reading its groups

groups

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

has_chips
overflow

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

read()

Returns a dict of chips

show_less()

Collapses a chip group

show_more()

Expands a chip group

class widgetastic_patternfly4.ChipGroupToolbarCategory(*args, **kwargs)

Bases: widgetastic.widget.base.ParametrizedView, widgetastic_patternfly4.chipgroup.ChipGroup

Represents a chip group that is part of a toolbar, identifiable by a category label

PARAMETERS = ('label',)
ROOT

ParametrizedString modified to return instances of smartloc.Locator

classmethod all(browser)

Method that returns tuples of parameters that correspond to PARAMETERS attribute.

It is required for proper functionality of read() so it knows the exact instances of the view.

Returns:An iterable that contains tuples. Values in the tuples must map exactly to the keys in the PARAMETERS class attribute.
chips

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

label
class widgetastic_patternfly4.StandAloneChipGroup(parent, locator=None, logger=None)

Bases: widgetastic_patternfly4.chipgroup.ChipGroup

chips

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

overflow

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

class widgetastic_patternfly4.Card(parent, locator=None, logger=None)

Bases: widgetastic_patternfly4.card.BaseCard, widgetastic.widget.base.GenericLocatorWidget

ROOT

ParametrizedString modified to return instances of smartloc.Locator

class widgetastic_patternfly4.CardGroup(parent, locator=None, logger=None, **kwargs)

Bases: widgetastic.widget.base.GenericLocatorWidget, widgetastic.widget.base.View

cards

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

class widgetastic_patternfly4.CardForCardGroup(parent, locator=None, logger=None, **kwargs)

Bases: widgetastic.widget.base.ParametrizedView

PARAMETERS = ('position',)
ROOT

ParametrizedString modified to return instances of smartloc.Locator

classmethod all(browser)

Method that returns tuples of parameters that correspond to PARAMETERS attribute.

It is required for proper functionality of read() so it knows the exact instances of the view.

Returns:An iterable that contains tuples. Values in the tuples must map exactly to the keys in the PARAMETERS class attribute.
class widgetastic_patternfly4.CardCheckBox(parent, name=None, id=None, locator=None, logger=None)

Bases: widgetastic.widget.checkbox.Checkbox

ROOT = ".//input[@class='pf-c-check__input']"
exception widgetastic_patternfly4.ColumnNotExpandable(column)

Bases: Exception

class widgetastic_patternfly4.CompactPagination(parent, locator=None, logger=None)

Bases: widgetastic_patternfly4.pagination.BaseCompactPagination, widgetastic_patternfly4.pagination.Pagination

DEFAULT_LOCATOR = ".//div[contains(@class, 'pf-c-pagination') and contains(@class, 'pf-m-compact')]"
class widgetastic_patternfly4.CompoundExpandableTable(*args, **kwargs)

Bases: widgetastic_patternfly4.table.PatternflyTable

This widget is similar to the ExpandableTable, only that it can have any number of expandable rows, and the expandable column is not necessarily in the first position.

https://www.patternfly.org/v4/documentation/react/components/table#

COLUMN_AT_POSITION = './tr[1]/td[{0}]'
COLUMN_RESOLVER_PATH = '/tr[0]/td'
HEADERS = './thead/tr/th|./thead/tr/td'
ROWS = './tbody'
ROW_AT_INDEX = './tbody[{0}]'
ROW_RESOLVER_PATH = '/table/tbody'
ROW_TAG = 'tbody'
Row

alias of CompoundExpandableRow

class widgetastic_patternfly4.CategoryChipGroup(parent, label, logger=None)

Bases: widgetastic_patternfly4.chipgroup.ChipGroup

Represents a Chip Group with a category label

ROOT

ParametrizedString modified to return instances of smartloc.Locator

classmethod all(browser)

Returns a list of all category labels.

can_close
chips

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

close()
close_button

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

label
class widgetastic_patternfly4.DonutChart(parent, id=None, locator=None, logger=None)

Bases: widgetastic.widget.base.View

Represents the Donut Chart from Patternfly 4 (https://www.patternfly.org/v4/documentation/react/charts/chartdonut)

BASE_LOCATOR = './/div[@id={}]'
ROOT

ParametrizedString modified to return instances of smartloc.Locator

donut

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

legend

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

class widgetastic_patternfly4.Dropdown(parent, text=None, locator=None, logger=None)

Bases: widgetastic_patternfly4.dropdown.BaseDropdown, widgetastic.widget.base.Widget

DEFAULT_LOCATOR = './/div[contains(@class, "pf-c-dropdown")][1]'
ROOT

ParametrizedString modified to return instances of smartloc.Locator

TEXT_LOCATOR = ".//div[contains(@class, 'pf-c-dropdown') and child::button[normalize-space(.)={}]]"
exception widgetastic_patternfly4.DropdownDisabled

Bases: Exception

exception widgetastic_patternfly4.DropdownItemDisabled

Bases: Exception

exception widgetastic_patternfly4.DropdownItemNotFound

Bases: Exception

class widgetastic_patternfly4.GroupDropdown(parent, text=None, locator=None, logger=None)

Bases: widgetastic_patternfly4.dropdown.BaseGroupDropdown, widgetastic_patternfly4.dropdown.Dropdown

class widgetastic_patternfly4.SplitButtonDropdown(parent, text=None, locator=None, logger=None)

Bases: widgetastic_patternfly4.dropdown.BaseSplitButtonDropdown, widgetastic_patternfly4.dropdown.Dropdown

class widgetastic_patternfly4.FormSelect(parent, locator, logger=None)

Bases: widgetastic_patternfly4.formselect.BaseFormSelect, widgetastic.widget.base.GenericLocatorWidget

exception widgetastic_patternfly4.FormSelectDisabled

Bases: Exception

Raised if the FormSelect is Disabled.

exception widgetastic_patternfly4.FormSelectOptionDisabled

Bases: Exception

Raise if the specific option chosen is disabled.

exception widgetastic_patternfly4.FormSelectOptionNotFound

Bases: Exception

Raised if the specific form option is not found in the form select.

class widgetastic_patternfly4.Menu(parent, text=None, locator=None, logger=None)

Bases: widgetastic_patternfly4.menu.BaseMenu, widgetastic_patternfly4.dropdown.Dropdown

DEFAULT_LOCATOR = './/div[contains(@class, "pf-c-menu")]'
exception widgetastic_patternfly4.MenuItemDisabled

Bases: widgetastic_patternfly4.dropdown.DropdownItemDisabled

exception widgetastic_patternfly4.MenuItemNotFound

Bases: widgetastic_patternfly4.dropdown.DropdownItemNotFound

class widgetastic_patternfly4.Modal(parent, locator=None, logger=None, **kwargs)

Bases: widgetastic_patternfly4.modal.BaseModal, widgetastic.widget.base.View

ROOT

ParametrizedString modified to return instances of smartloc.Locator

class widgetastic_patternfly4.Navigation(parent, label=None, id=None, locator=None, logger=None)

Bases: widgetastic_patternfly4.navigation.BaseNavigation, widgetastic.widget.base.Widget

LOCATOR_START = './/nav[@class="pf-c-nav"{}]'
ROOT

ParametrizedString modified to return instances of smartloc.Locator

exception widgetastic_patternfly4.NavSelectionNotFound

Bases: Exception

class widgetastic_patternfly4.OptionsMenu(parent, text=None, locator=None, logger=None)

Bases: widgetastic_patternfly4.optionsmenu.BaseOptionsMenu, widgetastic_patternfly4.dropdown.Dropdown

class widgetastic_patternfly4.Pagination(parent, locator=None, logger=None)

Bases: widgetastic_patternfly4.pagination.BasePagination, widgetastic.widget.base.View

ROOT

ParametrizedString modified to return instances of smartloc.Locator

exception widgetastic_patternfly4.PaginationNavDisabled

Bases: Exception

class widgetastic_patternfly4.PieChart(parent=None, id=None, locator=None, logger=None, *args, **kwargs)

Bases: widgetastic_patternfly4.bulletchart.BulletChart

Represents the Pie Chart from Patternfly 4 (https://www.patternfly.org/v4/documentation/react/charts/chartpie)

APPLY_OFFSET = False
LEGEND_ITEM_REGEX = re.compile('(\\d+): (\\w.*)|(\\w.*): (\\d+)')
class widgetastic_patternfly4.Popover(parent, locator=None, logger=None)

Bases: widgetastic_patternfly4.popover.BasePopover, widgetastic.widget.base.Widget

DEFAULT_LOCATOR = ".//div[contains(@role, 'dialog') and contains(@class, 'pf-c-popover')]"
ROOT

ParametrizedString modified to return instances of smartloc.Locator

class widgetastic_patternfly4.Progress(parent, locator, logger=None)

Bases: widgetastic_patternfly4.progress.BaseProgress, widgetastic.widget.base.Widget

ROOT

ParametrizedString modified to return instances of smartloc.Locator

class widgetastic_patternfly4.Select(parent, text=None, locator=None, logger=None)

Bases: widgetastic_patternfly4.select.BaseSelect, widgetastic_patternfly4.dropdown.Dropdown

DEFAULT_LOCATOR = './/div[contains(@class, "pf-c-select")][1]'
exception widgetastic_patternfly4.SelectItemDisabled

Bases: widgetastic_patternfly4.dropdown.DropdownItemDisabled

exception widgetastic_patternfly4.SelectItemNotFound

Bases: widgetastic_patternfly4.dropdown.DropdownItemNotFound

class widgetastic_patternfly4.ContextSelector(parent, text=None, locator=None, logger=None)

Bases: widgetastic_patternfly4.contextselector.BaseContextSelector, widgetastic_patternfly4.select.Select

class widgetastic_patternfly4.Switch(parent, locator, logger=None)

Bases: widgetastic_patternfly4.switch.BaseSwitch, widgetastic.widget.base.GenericLocatorWidget

exception widgetastic_patternfly4.SwitchDisabled

Bases: Exception

class widgetastic_patternfly4.ExpandableTable(*args, **kwargs)

Bases: widgetastic_patternfly4.table.BaseExpandableTable, widgetastic_patternfly4.table.PatternflyTable

class widgetastic_patternfly4.PatternflyTable(parent, locator, column_widgets=None, assoc_column=None, rows_ignore_top=None, rows_ignore_bottom=None, top_ignore_fill=False, bottom_ignore_fill=False, logger=None)

Bases: widgetastic_patternfly4.table.BasePatternflyTable, widgetastic.widget.table.Table

exception widgetastic_patternfly4.RowNotExpandable(row)

Bases: Exception

class widgetastic_patternfly4.Tab(parent, logger=None, **kwargs)

Bases: widgetastic.widget.base.View

Represents the Patternfly Tab widget.

Selects itself automatically when any child widget gets accessed, ensuring that the widget is visible.

https://www.patternfly.org/v4/documentation/react/components/tabs

ROOT

ParametrizedString modified to return instances of smartloc.Locator

TAB_LOCATOR

ParametrizedString modified to return instances of smartloc.Locator

TAB_NAME = None
child_widget_accessed(widget)

This hook is called when a child widget of current view is accessed.

One of useful examples is below. it allows us to switch between frames.

Parameters:widget – The widget being accessed or ParametrizedViewRequest.
click()

Clicks the tab.

is_active()

Returns a boolean detailing of the tab is active.

is_displayed

Returns a boolean detailing of the tab is displayed.

select()

Selects the tab (checks if active already first).

tab_name

Returns the tab name as a string.