Package com.meterware.httpunit

Examples of com.meterware.httpunit.TableCell


        Assert.assertEquals("invalid attribute value", "rulesX", table.getAttribute("rules"));
        Assert.assertEquals("invalid attribute value", "styleX", table.getAttribute("style"));
        Assert.assertEquals("invalid attribute value", "summaryX", table.getAttribute("summary"));
        Assert.assertEquals("invalid attribute value", "classX table", table.getAttribute("class"));

        TableCell cell = table.getTableCell(1, 0);
        Assert.assertEquals("invalid attribute value", "styleX", cell.getAttribute("style"));
        Assert.assertEquals("invalid attribute value", "classX", cell.getAttribute("class"));

    }
View Full Code Here


        Assert.assertEquals("Wrong column header.", "Number", tables[0].getCellAsText(0, 0));
        Assert.assertEquals("Wrong column content.", "3", tables[0].getCellAsText(1, 0));
        Assert.assertEquals("Wrong column content.", "4", tables[0].getCellAsText(2, 0));

        TableCell headerCell = tables[0].getTableCell(0, 0);

        String cssClass = headerCell.getClassName();
        assertEqualsIgnoreOrder(
            "Wrong css attributes.",
            new String[]{"sortable", "sorted", "order2"},
            StringUtils.split(cssClass));

        WebLink[] headerLinks = headerCell.getLinks();
        Assert.assertEquals("Sorting link not found.", 1, headerLinks.length);
        WebLink sortingLink = headerLinks[0];
        assertEqualsIgnoreOrder(
            "Wrong parameters.",
            new String[]{"sort", "searchid", "dir", pageParameter},
View Full Code Here

        if (log.isDebugEnabled())
        {
            log.debug(response.getText());
        }

        TableCell row1Cell = tables[0].getTableCell(1, 0);
        Assert.assertEquals("Wrong style attribute.", "style-1", row1Cell.getAttribute("style"));
        Assert.assertEquals("Wrong class attribute.", "class-1", row1Cell.getClassName());

        TableCell row2Cell = tables[0].getTableCell(2, 0);
        Assert.assertEquals("Wrong style attribute.", "style-2", row2Cell.getAttribute("style"));
        Assert.assertEquals("Wrong class attribute.", "class-2", row2Cell.getClassName());
    }
View Full Code Here

        }

        WebTable[] tables = response.getTables();

        Assert.assertEquals("Expected 1 table in result.", 1, tables.length);
        TableCell cell = tables[0].getTableCell(0, 0);
        Assert.assertTrue("Expected css class \"green\" not found", StringUtils.contains(cell.getClassName(), "green"));
        Assert.assertTrue(
            "Expected css class \"purple\" not found",
            StringUtils.contains(cell.getClassName(), "purple"));
    }
View Full Code Here

        Assert.assertEquals("Wrong number of tables.", 1, tables.length);
        Assert.assertEquals("Wrong number of columns in result.", 4, tables[0].getColumnCount());

        for (int j = 0; j < 4; j++)
        {
            TableCell cell = tables[0].getTableCell(0, j);
            boolean containsSorted = (cell.getAttribute("class").indexOf("sorted") > -1);
            if (j == sortedColumn)
            {
                Assert.assertTrue("Column " + j + " is not sorted as expected", containsSorted);
            }
            else
View Full Code Here

        WebResponse taskPage = dialog.getResponse();
        WebTable timeTable;
        try {
            timeTable = taskPage.getTableWithID("time_entries");
            int lastRowIndex = timeTable.getRowCount() - 1;
            TableCell lastRowCell = timeTable.getTableCell(lastRowIndex, 0);
            HTMLElementPredicate imagePredicate = new LinkImagePredicate();
            WebLink editLink = lastRowCell.getFirstMatchingLink(imagePredicate, EDIT_IMAGE);
            editLink.click();
        } catch (Exception e) {
            throw new RuntimeException(ExceptionUtility.stackTraceToString(e));
        }
View Full Code Here

        int linkRowInNoteTable = 2;
        HttpUnitDialog dialog = getDialog();
        WebResponse storyPage = dialog.getResponse();
        try {
            WebTable noteTable = storyPage.getFirstMatchingTable(new TextInTablePredicate(), subject);
            TableCell linkCell = noteTable.getTableCell(linkRowInNoteTable, 0);
            WebLink deleteLink = linkCell.getFirstMatchingLink(new LinkImagePredicate(), imageName);
            clickLink(deleteLink);
        } catch (Exception e) {
            throw new RuntimeException(ExceptionUtility.stackTraceToString(e));
        }
    }
View Full Code Here

            WebTable objectTable = editPage.getTableWithID(tableId);
            if (objectTable == null)
                throw new RuntimeException("Acceptance tests require table with id = " + tableId);
            int rowToSearchForLink = getFirstRowNumberWithText(objectTable, text);
            for (int column = 0; column < objectTable.getColumnCount(); column++) {
                TableCell cell = objectTable.getTableCell(rowToSearchForLink, column);
                LinkImagePredicate predicate = new LinkImagePredicate();
                WebLink editLink = cell.getFirstMatchingLink(predicate, imageName);
                if (editLink != null) {
clickLink(                    editLink);
                    foundLink = true;
                    break;
                }
View Full Code Here

       public boolean matchesCriteria(Object object, Object criteria) {
           WebTable table = (WebTable) object;
           String textToMatch = (String) criteria;
           for (int i = 0; i < table.getRowCount(); i++)
               for (int j = 0; j < table.getColumnCount(); j++) {
                   TableCell cell = table.getTableCell(i, j);
                   if (cell != null && cell.asText().indexOf(textToMatch) != -1)
                       return true;
               }

           return false;
View Full Code Here

    resp = form.submit();
   
    // Make sure the address took
    WebTable table = resp.getTableWithID("address_TestAddress");
    assertNotNull(table);
    TableCell cell = table.getTableCell(0, 0);
    assertNotNull(cell);
    assertTrue(cell.getText().contains("TestAddress"));
    assertTrue(cell.getText().contains("1234 Main Street"));
    assertTrue(cell.getText().contains("Apt 123"));
    assertTrue(cell.getText().contains("Seattle"));
    assertTrue(cell.getText().contains("WA"));
    assertTrue(cell.getText().contains("98104"));
    assertTrue(cell.getText().contains("USA"));
    assertTrue(cell.getText().contains("206-333-1234"));   
   }
View Full Code Here

TOP

Related Classes of com.meterware.httpunit.TableCell

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.