@Test
public void testCardsList() throws Exception {
WebClient wc = startWebClient();
login(wc);
HtmlPage page = wc.getPage(url("/cards/Cards.action"));
HtmlDivision cardsDiv = page.getHtmlElementById("cards");
List<HtmlDivision> cardDivs = cardsDiv.getElementsByAttribute("div", "class", "card");
assertEquals(3, cardDivs.size());
// test card icon when icon URL is not null
HtmlDivision card1Div = cardDivs.get(0);
assertEquals("card1", card1Div.asText());
HtmlAnchor detailsLink = getFirstLinkByText(card1Div, "card1");
HtmlImage cardIcon = (HtmlImage) detailsLink.getHtmlElementsByTagName("img").get(0);
assertEquals("http://www.google.com/favicon.ico", cardIcon.getAttribute("src"));
// test card icon when icon URL is null
HtmlDivision card3Div = cardDivs.get(2);
assertEquals("card3", card3Div.asText());
detailsLink = getFirstLinkByText(card3Div, "card3");
cardIcon = (HtmlImage) detailsLink.getHtmlElementsByTagName("img").get(0);
assertEquals("/img/card.png", cardIcon.getAttribute("src"));
}