Exemple #1
0
def test_sortable_table(browser, sample):
    header, order, expected_result = sample
    table = PatternflyTable(browser,
                            ".//div[@id='ws-react-c-table-sortable']/table")
    table.sort_by(header, order)
    column = [row[header] for row in table.read()]
    assert column == expected_result
def test_sortable_table(browser, sample):
    header, order, expected_result = sample
    table = PatternflyTable(
        browser, ".//table[./caption[normalize-space(.)='Sortable Table']]")
    table.sort_by(header, order)
    column = [row[header] for row in table.read()]
    assert column == expected_result
class ApplicationsView(BaseLoggedInPage):

    title = Text(locator=".//div/h2[normalize-space(.)='Applications']")
    ACTIONS_INDEX = 2
    table = PatternflyTable(
        ".//table[contains(@class, 'pf-c-table')]",
        column_widgets={
            "Application": Text(locator=".//a"),
            "Date added": Text(locator=".//td[@data-label='Date added']"),
            ACTIONS_INDEX: Dropdown(),
        },
    )
    add_application_button = Button("Add application")
    upload_file = HiddenFileInput(
        locator='.//input[@accept=".ear, .har, .jar, .rar, .sar, .war, .zip"]'
    )
    search = Input(locator=".//input[@aria-label='Filter by name']")
    done_button = Button("Close")
    application_packages = Text(
        locator=".//wu-select-packages/h3[normalize-space(.)='Application packages']"
    )
    sort_application = Text(locator=".//th[contains(normalize-space(.), 'Application')]//i[1]")
    save_and_run_button = Button("Save and run")
    delete_button = Button("Delete")
    cancel_button = Button("Cancel")

    @property
    def is_displayed(self):
        return self.add_application_button.is_displayed and self.title.is_displayed

    def clear_search(self):
        """Clear search"""
        if self.search.value:
            self.search.fill("")
def test_selectable_table(browser, sample):
    method, expected_result = sample
    table = PatternflyTable(
        browser,
        ".//table[./caption[normalize-space(.)='Selectable Table']]",
        column_widgets={0: Checkbox(locator=".//input")})
    getattr(table, method)()
    for row in table:
        assert expected_result == row[0].widget.selected
class AllProjectView(BaseLoggedInPage):
    """This view represent Project All View"""

    title = Text(".//div[contains(@class, 'pf-c-content')]/h1")
    search = Input(locator=".//input[@aria-label='Filter by name']")
    sort = SortSelector("class", "btn btn-default dropdown-toggle")
    table_loading = './/div[contains(@class, "pf-c-skeleton")]'

    ACTIONS_INDEX = 4
    table = PatternflyTable(
        ".//table[contains(@class, 'pf-c-table pf-m-grid-md')]",
        column_widgets={
            "Name": Text(locator=".//a"),
            "Applications": Text(locator=".//td[@data-label='Applications']"),
            "Status": Text(locator=".//td[@data-label='Status']"),
            "Description": Text(locator=".//td[@data-label='Description']"),
            ACTIONS_INDEX: Dropdown(),
        },
    )

    create_project = Button("Create project")

    @View.nested
    class no_matches(View):  # noqa
        """After search if no match found"""

        text = Text(".//div[contains(@class, 'pf-c-empty-state__body')]")

    def clear_search(self):
        """Clear search"""
        if self.search.value:
            self.search.fill("")

    @property
    def all_projects(self):
        """Returns list of all project rows"""
        return [row for row in self.table]

    @property
    def is_displayed(self):
        return self.is_empty or (
            self.create_project.is_displayed
            and self.title.text == "Projects"
            and self.table.is_displayed
            and self.validate_url()
        )

    def select_project(self, name):
        for row in self.table:
            if row.name.text == name:
                row["Name"].widget.click()

    def table_loaded(self):
        return wait_for(
            lambda: not self.browser.is_displayed(self.table_loading), delay=10, timeout=120
        )
Exemple #6
0
def test_selectable_table(browser, sample):
    method, expected_result = sample
    table = PatternflyTable(
        browser,
        ".//div[@id='ws-react-c-table-selectable']//table",
        column_widgets={0: Checkbox(locator=".//input")},
    )
    getattr(table, method)()
    for row in table:
        assert expected_result == row[0].widget.selected
Exemple #7
0
def test_selectable_table(browser, sample):
    method, expected_result = sample
    table = PatternflyTable(
        browser,
        ".//div[@id='ws-react-composable-c-table-composable-selectable-with-checkbox']//table",
        column_widgets={0: Checkbox(locator=".//input")},
    )
    getattr(table, method)()
    for row in table:
        if row.index != 1:  # skip row with disabled checkbox
            assert expected_result == row[0].widget.selected
Exemple #8
0
class AnsibleRolesImportView(BaseLoggedInView):
    """View while selecting Ansible roles to import."""

    breadcrumb = BreadCrumb()
    total_available_roles = Text(
        "//div[@class='pf-c-pagination__total-items']/b[2]")
    select_all = Checkbox(locator="//input[@id='select-all']")
    table = PatternflyTable(
        component_id='OUIA-Generated-Table-2',
        column_widgets={
            0: Checkbox(locator='.//input[@type="checkbox"]'),
        },
    )
    pagination = ImportPagination()
    submit = Button('Submit')
    cancel = Button('Cancel')

    @property
    def is_displayed(self):
        return (self.breadcrumb.locations[0] == 'Roles'
                and self.breadcrumb.read() == 'Changed Ansible roles')
Exemple #9
0
    class _ContentView(View):
        """ View for the nested table(s) in the expandable columns."""

        table = PatternflyTable(
            locator=".//table[@aria-label='Sortable Table']")
def test_sortable_table(browser, sample):
    header, order, expected_result = sample
    table = PatternflyTable(browser, ".//table[./caption[normalize-space(.)='Sortable Table']]")
    table.sort_by(header, order)
    column = [row[header] for row in table.read()]
    assert column == expected_result
Exemple #11
0
 class _Workspaces(View):
     table = PatternflyTable(locator=".//table[contains(@id, '_3')]")
Exemple #12
0
 class _PullRequests(View):
     table = PatternflyTable(locator=".//table[contains(@id, '_2')]")
Exemple #13
0
 class _Branches(View):
     table = PatternflyTable(locator=".//table[contains(@id, '_1')]")