Search in sources :

Example 1 with LinkCheckerAllDocsPage

use of org.xwiki.linkchecker.test.po.LinkCheckerAllDocsPage in project xwiki-platform by xwiki.

the class LinkCheckerTest method testLinkChecker.

@Test
public void testLinkChecker() {
    getUtil().deletePage(getClass().getSimpleName(), getTestMethodName());
    // Create a page with a URL so that it appears in the Link Checker livetable.
    getUtil().createPage(getClass().getSimpleName(), getTestMethodName(), "http://doesntexist", getTestClassName());
    // Navigate to the Index page and click on the "External Links" tab
    final LinkCheckerAllDocsPage page = LinkCheckerAllDocsPage.gotoPage();
    // Since the LinkChecker works asynchronously there's small possibility that the link hasn't been added
    // before the livetable displays, thus we wait till we get the link state.
    getDriver().waitUntilCondition(new ExpectedCondition<Boolean>() {

        public Boolean apply(WebDriver driver) {
            LiveTableElement livetable = page.clickLinkCheckerTab();
            if (livetable.hasRow("Link", "http://doesntexist")) {
                return true;
            } else {
                return false;
            }
        }
    });
}
Also used : WebDriver(org.openqa.selenium.WebDriver) LinkCheckerAllDocsPage(org.xwiki.linkchecker.test.po.LinkCheckerAllDocsPage) LiveTableElement(org.xwiki.test.ui.po.LiveTableElement) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 WebDriver (org.openqa.selenium.WebDriver)1 LinkCheckerAllDocsPage (org.xwiki.linkchecker.test.po.LinkCheckerAllDocsPage)1 AbstractTest (org.xwiki.test.ui.AbstractTest)1 LiveTableElement (org.xwiki.test.ui.po.LiveTableElement)1