def __init__(self, *args, **kwargs): ParametrizedView.__init__(self, *args, **kwargs) self.download.click() self.link.click()
def __init__(self, *args, **kwargs): ParametrizedView.__init__(self, *args, **kwargs) self.download.click() self.link.click()
class TestView(View): ROOT = ".//div[@id='ws-react-c-chip-group-single']" chips = ParametrizedView.nested(Chip)
class DatastoreTileIconEntity(BaseTileIconEntity): quad_icon = ParametrizedView.nested(DatastoreQuadIconEntity)
class HostTileIconEntity(BaseTileIconEntity): quad_icon = ParametrizedView.nested(HostQuadIconEntity)
class entities(View): # noqa summary = ParametrizedView.nested(ParametrizedSummaryTable)
class InstanceTileIconEntity(BaseTileIconEntity): """ Provider child of Tile Icon entity """ quad_icon = ParametrizedView.nested(InstanceQuadIconEntity)
class VolumeTileIconEntity(BaseTileIconEntity): quad_icon = ParametrizedView.nested(VolumeQuadIconEntity)
class HostDetailsEntities(View): """Represents Details page.""" summary = ParametrizedView.nested(ParametrizedSummaryTable)
class DepRoleTileIconEntity(BaseTileIconEntity): quad_icon = ParametrizedView.nested(DepRoleQuadIconEntity)
class PhysicalServerTileIconEntity(BaseTileIconEntity): quad_icon = ParametrizedView.nested(PhysicalServerQuadIconEntity)
def __init__(self, *args, **kwargs): ParametrizedView.__init__(self, *args, **kwargs)
class StandAloneChipGroup(View): """ Represents a chip group that is "on its own", i.e. not a part of a chip group toolbar """ ROOT = ParametrizedLocator("{@locator}") overflow = OverflowChip() chips = ParametrizedView.nested(Chip) def __init__(self, parent, locator=None, logger=None): super().__init__(parent, logger=logger) self.locator = locator or GROUP_ROOT @property def label(self): # It's unlikely we'll have a labelled chip group that is not in a toolbar # ... but just in case elements = self.browser.elements(STANDALONE_GROUP_LABEL) return self.browser.text(elements[0]) if elements else None def show_more(self): """Expands a chip group""" self.overflow.show_more() def show_less(self): """Collapses a chip group""" self.overflow.show_less() @property def is_multiselect(self): return self.overflow.is_displayed def get_chips(self, show_more=True): """ A helper to expand the chip group before reading its chips """ if self.is_multiselect and show_more: self.show_more() return self.chips def __iter__(self): for chip in self.get_chips(): yield chip def remove_chip_by_name(self, name): """Removes a chip from the group by name""" for chip in self: if chip.text.lower() == name.lower(): chip.remove() break else: raise ValueError(f"Could not find chip with name '{name}'") def remove_all_chips(self): """Removes all chips from the group""" for chip in self: chip.remove() def read(self): return [chip.text for chip in self]
class StandAloneChipGroup(ChipGroup): chips = ParametrizedView.nested(OldChip) overflow = ParametrizedView.nested(OldOverflowChip)
class Cards(CardGroup): def __init__(self, parent, locator=None, logger=None, **kwargs): View.__init__(self, parent, logger=logger, **kwargs) self.locator = locator or './/section[@class="pf-c-page__main-section"]/div' cards = ParametrizedView.nested(PageCard)
class Cards(CardGroup): def __init__(self, parent, locator=None, logger=None, **kwargs): View.__init__(self, parent, logger=logger, **kwargs) self.locator = locator or './/div[contains(@class, "pf-l-gallery")]' cards = ParametrizedView.nested(PageCard)