Package net.thucydides.core.pages.components

Examples of net.thucydides.core.pages.components.HtmlTable


        driver.quit();
    }

    @Test
    public void should_read_table_headings() {
        HtmlTable table = new HtmlTable(page.clients);
        List<String> tableHeadings = table.getHeadings();
        assertThat(tableHeadings.toString(), is("[First Name, Last Name, Favorite Colour]"));
    }
View Full Code Here


        assertThat(tableHeadings.toString(), is("[First Name, Last Name, Favorite Colour]"));
    }

    @Test
    public void should_read_table_data_as_a_list_of_maps() {
        HtmlTable table = new HtmlTable(page.clients);

        List<Map<Object, String>> tableRows = table.getRows();
        assertThat(tableRows.size(), is(3));


        assertThat(tableRows.get(0), allOf(hasEntry("First Name", "Tim"), hasEntry("Last Name", "Brooke-Taylor"), hasEntry("Favorite Colour", "Red")));
        assertThat(tableRows.get(1), allOf(hasEntry("First Name", "Graeme"), hasEntry("Last Name", "Garden"), hasEntry("Favorite Colour", "Green")));
View Full Code Here

    }


    @Test
    public void should_read_table_data_as_a_list_of_web_elements() {
        HtmlTable table = new HtmlTable(page.clients);

        List<WebElement> tableRows = table.getRowElements();
        assertThat(tableRows.size(), is(3));
    }
View Full Code Here

        }
    };

    @Test
    public void should_be_able_to_also_access_rows_by_column_number() {
        HtmlTable table = new HtmlTable(page.clients);

        List<Map<Object, String>> tableRows = table.getRows();

        assertThat(tableRows.size(), is(3));
        assertThat(tableRows.get(0), allOf(hasEntry(1, "Tim"), hasEntry(2, "Brooke-Taylor"), hasEntry(3, "Red")));
        assertThat(tableRows.get(1), allOf(hasEntry(1, "Graeme"), hasEntry(2, "Garden"), hasEntry(3, "Green")));
        assertThat(tableRows.get(2), allOf(hasEntry(1, "Bill"),hasEntry(2, "Oddie"), hasEntry(3,"Blue")));
View Full Code Here

        assertThat(tableRows.get(2), allOf(hasEntry(1, "Bill"),hasEntry(2, "Oddie"), hasEntry(3,"Blue")));
    }

    @Test
    public void should_read_table_data_using_a_static_method() {
        HtmlTable table = new HtmlTable(page.clients);

        List<Map<Object, String>> tableRows = HtmlTable.rowsFrom(page.clients);

        assertThat(tableRows.size(), is(3));
        assertThat(tableRows.get(0), allOf(hasEntry("First Name", "Tim"), hasEntry("Last Name", "Brooke-Taylor"), hasEntry("Favorite Colour", "Red")));
View Full Code Here

        assertThat(containsRowElements, is(true));
    }

    @Test
    public void should_ignore_data_in_extra_cells() {
        HtmlTable table = new HtmlTable(page.clients_with_extra_cells);

        List<Map<Object, String>> tableRows = table.getRows();

        assertThat(tableRows.size(), is(3));
        assertThat(tableRows.get(0), allOf(hasEntry("First Name", "Tim"),hasEntry("Last Name", "Brooke-Taylor"), hasEntry("Favorite Colour","Red")));
        assertThat(tableRows.get(1), allOf(hasEntry("First Name", "Graeme"),hasEntry("Last Name", "Garden"), hasEntry("Favorite Colour","Green")));
        assertThat(tableRows.get(2), allOf(hasEntry("First Name", "Bill"),hasEntry("Last Name", "Oddie"), hasEntry("Favorite Colour","Blue")));
View Full Code Here

        assertThat(tableRows.get(2), allOf(hasEntry("First Name", "Bill"),hasEntry("Last Name", "Oddie"), hasEntry("Favorite Colour","Blue")));
    }

    @Test
    public void should_ignore_data_in_merged_cells() {
        HtmlTable table = new HtmlTable(page.table_with_merged_cells);

        List<Map<Object, String>> tableRows = table.getRows();
        assertThat(tableRows.size(), is(3));
        assertThat(tableRows.get(0), allOf(hasEntry("First Name", "Tim"),hasEntry("Last Name", "Brooke-Taylor"), hasEntry("Favorite Colour","Red")));
        assertThat(tableRows.get(1), allOf(hasEntry("First Name", "Graeme"),hasEntry("Last Name", "Garden"), hasEntry("Favorite Colour","Green")));
        assertThat(tableRows.get(2), allOf(hasEntry("First Name", "Bill"),hasEntry("Last Name", "Oddie"), hasEntry("Favorite Colour","Blue")));
    }
View Full Code Here

        assertThat(tableRows.get(2), allOf(hasEntry("First Name", "Bill"),hasEntry("Last Name", "Oddie"), hasEntry("Favorite Colour","Blue")));
    }

    @Test
    public void should_use_first_row_as_headers_if_no_th_cells_are_defined() {
        HtmlTable table = new HtmlTable(page.table_with_td_headers);

        List<Map<Object, String>> tableRows = table.getRows();

        assertThat(tableRows.size(), is(3));
        assertThat(tableRows.get(0), allOf(hasEntry("First Name", "Tim"),hasEntry("Last Name", "Brooke-Taylor"), hasEntry("Favorite Colour","Red")));
        assertThat(tableRows.get(1), allOf(hasEntry("First Name", "Graeme"),hasEntry("Last Name", "Garden"), hasEntry("Favorite Colour","Green")));
        assertThat(tableRows.get(2), allOf(hasEntry("First Name", "Bill"),hasEntry("Last Name", "Oddie"), hasEntry("Favorite Colour","Blue")));
View Full Code Here

        assertThat(tableRows.get(1), allOf(hasEntry("First Name", "Graeme"),hasEntry("Last Name", "Garden"), hasEntry("Favorite Colour","Green")));
        assertThat(tableRows.get(2), allOf(hasEntry("First Name", "Bill"),hasEntry("Last Name", "Oddie"), hasEntry("Favorite Colour","Blue")));
    }
    @Test
    public void should_ignore_rows_with_missing_cells() {
        HtmlTable table = new HtmlTable(page.clients_with_missing_cells);

        List<Map<Object, String>> tableRows = table.getRows();

        assertThat(tableRows.size(), is(2));
        assertThat(tableRows.get(0), allOf(hasEntry("First Name", "Tim"),hasEntry("Last Name", "Brooke-Taylor"), hasEntry("Favorite Colour","Red")));
        assertThat(tableRows.get(1), allOf(hasEntry("First Name", "Bill"),hasEntry("Last Name", "Oddie"), hasEntry("Favorite Colour","Blue")));
    }
View Full Code Here

        inTable(page.clients).findFirstRowWhere(the("First Name", is("Unknown-name")));
    }

    @Test
    public void should_be_able_to_read_cells_with_empty_headers() {
        HtmlTable table = new HtmlTable(page.table_with_empty_headers);

        List<Map<Object, String>> tableRows = table.getRows();
        assertThat(tableRows.size(), is(3));
        assertThat(tableRows.get(0).get(4), is("Row 1, Cell 1"));
        assertThat(tableRows.get(0).get(5), is("Row 1, Cell 2"));
        assertThat(tableRows.get(1).get(4), is("Row 2, Cell 1"));
        assertThat(tableRows.get(1).get(5), is("Row 2, Cell 2"));
View Full Code Here

TOP

Related Classes of net.thucydides.core.pages.components.HtmlTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.