Giter Club home page Giter Club logo

widgetastic.patternfly's Introduction

widgetastic.patternfly

https://travis-ci.org/RedHatQE/widgetastic.patternfly.svg?branch=master https://coveralls.io/repos/github/RedHatQE/widgetastic.patternfly/badge.svg?branch=master Documentation Status

Patternfly widget library for Widgetastic.

Written originally by Milan Falesnik ([email protected], http://www.falesnik.net/) and other contributors since 2016.

Contributors whose contributions were squashed during the library move in order of their first commit:

  • Ievgen Zapolskyi
  • Pete Savage
  • Dmitry Misharov
  • Oleksii Tsuman
  • Mike Shriver

Usage

from widgetastic.widget import View
from widgetastic_patternfly import Button

class SomeView(View):
    add = Button('Add', classes=[Button.PRIMARY])

Check the src/widgetastic_patternfly/__init__.py for more documentation.

Currently all the PatternFly widgets are located in the widgetastic_patternfly package.

widgetastic.patternfly's People

Contributors

digitronik avatar dsesami avatar izapolsk avatar jkrocil avatar john-dupuy avatar kedark3 avatar mshriver avatar omkarkhatavkar avatar pre-commit-ci[bot] avatar prichard77 avatar psav avatar quarckster avatar ronnypfannschmidt avatar rsnyman avatar tpapaioa avatar valaparthvi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

widgetastic.patternfly's Issues

Modal in unit test does not pass is_displayed

______________________________ test_generic_modal ______________________________
browser = <testing.conftest.CustomBrowser object at 0x7f5c3316c7f0>
    def test_generic_modal(browser):
        class TestView(View):
            """ Dummy page matching testing_page.html elements"""
            button = Button('Launch demo modal')
            modal = SpecificModal(id=modal_id)

        view = TestView(browser)
        assert not view.modal.is_displayed
        # Open the modal
        assert not view.button.disabled
        view.button.click()
        wait_for(lambda: view.modal.is_displayed,

>                delay=0.5, num_sec=MODAL_INTERACTION_TIMEOUT)
E       wait_for.TimedOutError: Could not do 'lambda defined as `wait_for(lambda: view.modal.is_displayed,
E                    delay=0.5, num_sec=MODAL_INTERACTION_TIMEOUT)`' at /home/travis/build/RedHatQE/widgetastic.patternfly/testing/test_modal.py:50 in time

The id is passed for the modal, and the if id block is evaluated in the modal constructor, but the ROOT locator does not appear to be correctly updated.

(Pdb) view.modal.__locator__()
Locator(by='xpath', locator='.//div[contains(@class, "modal") and contains(@class, "fade") and @role="dialog"]')

The modal, though displayed, is not reading the 'in' class that is included in the modal div when the modal is opened.

(Pdb) view.modal.browser.classes(view.modal)
{'modal', 'fade'}

Passing only Classes to Button yields invalid expression

Passing only classes to a Button as follows:

console_button = Button(classes=['open-console-button'])

would result in an error as below:

E InvalidSelectorError: Unable to locate an element with the xpath expression .//*[(self::a or self::button or (self::input and (@type="button" or @type="submit"))) and contains(@Class, "btn") and ( and co
ntains
(@Class, "open-console-button"))] because of the following error:
E SyntaxError: The expression is not a legal expression.

Those 2 and's highlighted above are problematic.

and ( and contains(@Class, "open-console-button"))]

I am submitting a PR for this problem shortly.

Make NavDropdown check for expandable rely on dropdown-toggle class instead of span.caret

Currently the NavDropdown is checking if the element is expandable by using the following xpath ./a/span[contains(@class, "caret")]. That is not working when following DOM structure is present:

<a id="user" role="button" class="nav-item-iconic dropdown-toggle" aria-haspopup="true" aria-expanded="false" href="#">
  <span aria-hidden="true" class="pficon pficon-user"></span>
  John Doe
  <span class="caret"></span>
</a>

I think a better and maybe more reliable way to check if something can be toggled is to check for the presence of the dropdown-toggle instead. What do you think?

PS.: I am not sure if this matters but I am using CSS to select the li element user_dropdown = NavDropdown(locator=Locator(css='li.dropdown > #user'))

Datepicker.year_pick.select results in ValueError

    def test_bootstrap_date_picker(browser):
        <...>
        # `fill` and `read` with current date
        today_date = datetime.now()
>       view.dp_readonly.fill(today_date)

testing/test_date_picker.py:22: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.tox/py36/lib/python3.6/site-packages/widgetastic/log.py:115: in wrapped
    result = f(self, *args, **kwargs)
.tox/py36/lib/python3.6/site-packages/widgetastic/widget/base.py:30: in wrapped
    return method(self, Fillable.coerce(value), *args, **kwargs)
.tox/py36/lib/python3.6/site-packages/widgetastic_patternfly/__init__.py:2060: in fill
    self.year_pick.select(value=value.year)
.tox/py36/lib/python3.6/site-packages/widgetastic/widget/base.py:67: in wrapped
    return method(self, *new_args, **new_kwargs)
.tox/py36/lib/python3.6/site-packages/widgetastic_patternfly/__init__.py:2018: in select
    start_yr, end_yr = [int(item) for item in self.datepicker_switch.read().split('-')]

self.datepicker_switch.read() is resolving the datepicker-daysDOM and readingNovember 2020(example) instead of2020-2029as expected, from thedatepicker-years` DOM.

A HeaderView class is used to define datepicker_switch locator, but the parent isn't setup properly for the widget, resulting in an out-of-scope match and unexpected text.

CheckableBootstrapTreeview.fill() needs to uncheck

https://github.com/RedHatQE/widgetastic.patternfly/blob/master/src/widgetastic_patternfly/__init__.py#L1380

This fill method will only check nodes, and won't uncheck those that are filled.

I would like to enhance the fill by taking a more complex data structure with tuples of path and check boolean to check/uncheck within a fill context.

The current implementation is forcing callers to use check_node/uncheck_node in patterns that would be better served within a fill()

The usage example is incomplete

The usage example on README file does not import everything needed

from widgetastic_patternfly import Button

class SomeView(View):
    add = Button('Add', classes=[Button.PRIMARY])

From where View comes from. It is probably from widgetastic.core but that is not clear for new comers. I think showing the import will clarify that and also make newcomers check core docs in order to know more about the View.

VerticalNavigation select() method needs strange initialization to function

I have the following HTML which describes a patternfly vertical navigation:

<div class="nav-pf-vertical nav-pf-vertical-with-sub-menus">
    <ul class="list-group">
        <li class="active list-group-item"><a href="#"><span title="Foo"></span><span class="list-group-item-value">Foo</span></a></li>
        <li class="list-group-item"><a href="#"><span title="Bar"></span><span class="list-group-item-value">Bar</span></a></li>
        <li class="list-group-item"><a href="#"><span title="Credentials"></span><span class="list-group-item-value">Baz</span></a></li>
</div>

If I try to initialize the VerticalNavigation with a CSS locator like this:
nav = VerticalNavigation(locator=(Locator(css='.nav-pf-vertical')))

Then the function nav.select('Bar') does not work, and it cannot find the element to select it. It then returns the following error:

selenium.common.exceptions.NoSuchElementException: 
Message: Could not find an element './ul/li/a[span[normalize-space(.)="Bar"] or @href="Bar"]'

The above error implies that it is starting from the top div nav-pf-vertical, but it is not when searching the ./ul/li/a/span path. Rather, the select() function works properly when I initialize the VerticalNavigation with the HTML tag directly below, of the list-group class in the ul tag:
nav = VerticalNavigation(locator=(Locator(css='.list-group')))

The select() function then behaves normally. I believe that either the function needs to be refactored to only search starting from the parent of the <ul> tag, or the search needs to check for both possibilities.

Patternfly Table view element support, Column Visibility

https://www.patternfly.org/pattern-library/content-views/table-view/#design

There are several patternfly widgets that are part of the table view markup, including column visibility.

Satellite QE, specifically the Airgun team, will have a future need to model this widget for automation.

Currently the MIQ/integration_tests team has implemented a conditional view for the patternfly content views:
https://github.com/ManageIQ/integration_tests/blob/master/widgetastic_manageiq/__init__.py#L2826

This can be adapted and extracted into a base ContentView class within wt.patternfly. Support for the table's column visibility checkboxes should exist in this library.

Refactor Tab view, point ROOT to tab content, add support for dropdown tabs

Currently Tab's ROOT points to tab link, not to tab content, making it impossible to use relative locators for tab content:

ROOT = ParametrizedLocator(
        './/ul[contains(@class, "nav-tabs")]/li[normalize-space(.)={@tab_name|quote}]')

image

Also in foreman there're tabs which are included in some parent dropdown menu:
image

General: Implement additional patternfly widgets

Please link child issues or PRs to this main issue, or write a comment below to add some details/requests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.