1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.linkchecker.test.ui

File LinkCheckerTest.java

 

Code metrics

2
8
2
1
63
29
3
0.38
4
2
1.5

Classes

Class Line # Actions
LinkCheckerTest 35 8 0% 3 2
0.833333383.3%
 

Contributing tests

This file is covered by 1 test. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.linkchecker.test.ui;
21   
22    import org.junit.Test;
23    import org.openqa.selenium.WebDriver;
24    import org.openqa.selenium.support.ui.ExpectedCondition;
25    import org.xwiki.linkchecker.test.po.LinkCheckerAllDocsPage;
26    import org.xwiki.test.ui.AbstractTest;
27    import org.xwiki.test.ui.po.LiveTableElement;
28   
29    /**
30    * UI tests for the Link Checker feature.
31    *
32    * @version $Id: 76d911a578abdab416a6abba01ac054f9a3021a4 $
33    * @since 3.4M1
34    */
 
35    public class LinkCheckerTest extends AbstractTest
36    {
 
37  1 toggle @Test
38    public void testLinkChecker()
39    {
40  1 getUtil().deletePage(getClass().getSimpleName(), getTestMethodName());
41   
42    // Create a page with a URL so that it appears in the Link Checker livetable.
43  1 getUtil().createPage(getClass().getSimpleName(), getTestMethodName(), "http://doesntexist", getTestClassName());
44   
45    // Navigate to the Index page and click on the "External Links" tab
46  1 final LinkCheckerAllDocsPage page = LinkCheckerAllDocsPage.gotoPage();
47   
48    // Since the LinkChecker works asynchronously there's small possibility that the link hasn't been added
49    // before the livetable displays, thus we wait till we get the link state.
50  1 getDriver().waitUntilCondition(new ExpectedCondition<Boolean>()
51    {
 
52  1 toggle public Boolean apply(WebDriver driver)
53    {
54  1 LiveTableElement livetable = page.clickLinkCheckerTab();
55  1 if (livetable.hasRow("Link", "http://doesntexist")) {
56  1 return true;
57    } else {
58  0 return false;
59    }
60    }
61    });
62    }
63    }