Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Table read with pagination #292

Merged
merged 3 commits into from
Feb 26, 2019

Conversation

ldjebran
Copy link
Contributor

test output with regular tests

(robottelo) dlezz@dlezz:~/projects/robottelo-fork$ pytest -v tests/foreman/ui_airgun/test_computeresource.py::test_positive_end_to_end 
============================================ test session starts =============================================
platform linux -- Python 3.6.6, pytest-4.0.2, py-1.5.4, pluggy-0.8.0 -- /home/dlezz/.pyenv/versions/robottelo/bin/python3.6
cachedir: .pytest_cache
shared_function enabled - ON - scope: ffff - storage: redis
rootdir: /home/dlezz/projects/robottelo-fork, inifile:
plugins: xdist-1.26.0, timeout-1.3.3, services-1.3.1, mock-1.10.0, forked-0.2, cov-2.6.1
collecting ... 2019-02-21 15:29:22 - conftest - DEBUG - BZ deselect is disabled in settings

collected 2 items                                                                                            

tests/foreman/ui_airgun/test_computeresource.py::test_positive_end_to_end[True] PASSED                 [ 50%]
tests/foreman/ui_airgun/test_computeresource.py::test_positive_end_to_end[False] PASSED                [100%]

=================================== 2 passed, 4 warnings in 238.14 seconds ===================================

to test the pagination and read_all created some function and test:

# file:  entities/roles.py

class RoleEntity(BaseEntity):

    def read_all(self, per_page=None):
        view: RolesView = self.navigate_to(self, 'All')
        if per_page:
            view.table.pagination.per_page.fill(per_page)
        return view.table.read()


# file: tests/foreman/ui_airgun/test_role.py

def test_read_all(session):
    with session:
        values = session.role.read_all('5')
        assert len(values) == 55
        assert 'Viewer' in [value['Name'] for value in values]

test output

(robottelo) dlezz@dlezz:~/projects/robottelo-fork$ pytest -v tests/foreman/ui_airgun/test_role.py::test_read_all 
============================================ test session starts =============================================
platform linux -- Python 3.6.6, pytest-4.0.2, py-1.5.4, pluggy-0.8.0 -- /home/dlezz/.pyenv/versions/robottelo/bin/python3.6
cachedir: .pytest_cache
shared_function enabled - ON - scope: ffff - storage: redis
rootdir: /home/dlezz/projects/robottelo-fork, inifile:
plugins: xdist-1.26.0, timeout-1.3.3, services-1.3.1, mock-1.10.0, forked-0.2, cov-2.6.1
collecting ... 2019-02-21 15:34:27 - conftest - DEBUG - BZ deselect is disabled in settings

collected 1 item                                                                                             

tests/foreman/ui_airgun/test_role.py::test_read_all PASSED                                             [100%]

========================================= 1 passed in 92.79 seconds ==========================================

@ldjebran
Copy link
Contributor Author

test output with role PR #290 and SatelliteQE/robottelo#6751

(robottelo) dlezz@dlezz:~/projects/robottelo-fork$ pytest -v tests/foreman/ui_airgun/test_role.py
============================================ test session starts =============================================
platform linux -- Python 3.6.6, pytest-4.0.2, py-1.5.4, pluggy-0.8.0 -- /home/dlezz/.pyenv/versions/robottelo/bin/python3.6
cachedir: .pytest_cache
shared_function enabled - ON - scope: ffff - storage: redis
rootdir: /home/dlezz/projects/robottelo-fork, inifile:
plugins: xdist-1.26.0, timeout-1.3.3, services-1.3.1, mock-1.10.0, forked-0.2, cov-2.6.1
collecting ... 2019-02-21 18:18:27 - conftest - DEBUG - BZ deselect is disabled in settings

collected 11 items                                                                                           

tests/foreman/ui_airgun/test_role.py::test_positive_end_to_end PASSED                                  [  9%]
tests/foreman/ui_airgun/test_role.py::test_positive_assign_cloned_role PASSED                          [ 18%]
tests/foreman/ui_airgun/test_role.py::test_positive_delete_cloned_builtin PASSED                       [ 27%]
tests/foreman/ui_airgun/test_role.py::test_positive_create_filter_without_override PASSED              [ 36%]
tests/foreman/ui_airgun/test_role.py::test_positive_create_non_overridable_filter PASSED               [ 45%]
tests/foreman/ui_airgun/test_role.py::test_positive_create_overridable_filter PASSED                   [ 54%]
tests/foreman/ui_airgun/test_role.py::test_positive_create_with_21_filters PASSED                      [ 63%]
tests/foreman/ui_airgun/test_role.py::test_positive_create_with_sc_parameter_permission PASSED         [ 72%]
tests/foreman/ui_airgun/test_role.py::test_positive_create_with_smart_variable_permission PASSED       [ 81%]
tests/foreman/ui_airgun/test_role.py::test_positive_create_filter_admin_user_with_locs PASSED          [ 90%]
tests/foreman/ui_airgun/test_role.py::test_positive_create_filter_admin_user_with_orgs PASSED          [100%]

================================== 11 passed, 6 warnings in 1716.81 seconds ==================================

Copy link
Contributor

@abalakh abalakh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending comments

airgun/widgets.py Outdated Show resolved Hide resolved
airgun/widgets.py Show resolved Hide resolved
@@ -1267,6 +1287,96 @@ def read(self):
"return ace.edit('{0}').getValue();".format(self.ace_edit_id))


class Pagination(Widget):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure that's the right place for this widget. Patternfly defines a standard for paginator, so such widget should lie under widgetastic_patternfly and we should just import it. If satellite has slightly different locators - then original widget in widgetastic_patternfly, and on our end we should inherit and only update locators accordingly.

airgun/widgets.py Outdated Show resolved Hide resolved
airgun/widgets.py Outdated Show resolved Hide resolved
airgun/widgets.py Outdated Show resolved Hide resolved
@ldjebran
Copy link
Contributor Author

ldjebran commented Feb 22, 2019

tested also with content view by creating 93 entities (and triggering all the buttons):
creating a read_all function

    def read_all(self, per_page=None):
        view = self.navigate_to(self, 'All')
        if per_page:
            view.table.pagination.per_page.fill(per_page)
            view.table.pagination.last_page()
            view.table.pagination.previous_page()
        return view.table.read()

the tests passed as expected

oshtaier
oshtaier previously approved these changes Feb 25, 2019
Copy link
Contributor

@oshtaier oshtaier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK pending few comments
and please create issue for patternly library for paginator and link to that PR

airgun/widgets.py Outdated Show resolved Hide resolved
airgun/widgets.py Show resolved Hide resolved
airgun/widgets.py Outdated Show resolved Hide resolved
airgun/widgets.py Show resolved Hide resolved
@ldjebran
Copy link
Contributor Author

created an issue at widgetastic.patternfly RedHatQE/widgetastic.patternfly#84

@ldjebran
Copy link
Contributor Author

@abalakh @oshtaier changes done
test foreman entity

(robottelo) dlezz@dlezz:~/projects/robottelo-fork$ pytest -v tests/foreman/ui_airgun/test_role.py::test_positive_create_with_21_filters
============================================ test session starts ============================================
platform linux -- Python 3.6.6, pytest-4.0.2, py-1.5.4, pluggy-0.8.0 -- /home/dlezz/.pyenv/versions/robottelo/bin/python3.6
cachedir: .pytest_cache
shared_function enabled - ON - scope: ffff - storage: redis
rootdir: /home/dlezz/projects/robottelo-fork, inifile:
plugins: xdist-1.26.0, timeout-1.3.3, services-1.3.1, mock-1.10.0, forked-0.2, cov-2.6.1
collecting ... 2019-02-26 15:17:06 - conftest - DEBUG - BZ deselect is disabled in settings

collected 1 item                                                                                            

tests/foreman/ui_airgun/test_role.py::test_positive_create_with_21_filters PASSED                     [100%]

======================================== 1 passed in 295.95 seconds =========================================

test katello entity

class ContentViewEntity(BaseEntity):

    def read_all(self, per_page=None):
        view = self.navigate_to(self, 'All')
        if per_page:
            view.table.pagination.per_page.fill(per_page)
            view.table.pagination.last_page()
            view.table.pagination.previous_page()
        return view.table.read()
def test_content_view_read_all(session, module_org):
    for _ in range(63):
        entities.ContentView(organization=module_org).create()
    with session:
        values = session.contentview.read_all(per_page='25')
        assert len(values) == 63
(robottelo) dlezz@dlezz:~/projects/robottelo-fork$ pytest -v tests/foreman/ui_airgun/test_role.py::test_content_view_read_all
============================================ test session starts ============================================
platform linux -- Python 3.6.6, pytest-4.0.2, py-1.5.4, pluggy-0.8.0 -- /home/dlezz/.pyenv/versions/robottelo/bin/python3.6
cachedir: .pytest_cache
shared_function enabled - ON - scope: ffff - storage: redis
rootdir: /home/dlezz/projects/robottelo-fork, inifile:
plugins: xdist-1.26.0, timeout-1.3.3, services-1.3.1, mock-1.10.0, forked-0.2, cov-2.6.1
collecting ... 2019-02-26 15:30:41 - conftest - DEBUG - BZ deselect is disabled in settings

collected 1 item                                                                                            

tests/foreman/ui_airgun/test_role.py::test_content_view_read_all PASSED                               [100%]

================================== 1 passed, 1 warnings in 117.36 seconds ===================================


@oshtaier oshtaier merged commit ae69b55 into SatelliteQE:master Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants