1 package org.apache.maven.surefire.its.jiras;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.IOException;
23 import java.net.URI;
24
25 import org.apache.maven.surefire.its.fixture.*;
26
27 import com.gargoylesoftware.htmlunit.WebClient;
28 import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
29 import com.gargoylesoftware.htmlunit.html.HtmlDivision;
30 import com.gargoylesoftware.htmlunit.html.HtmlPage;
31 import org.junit.Test;
32
33 import static org.junit.Assert.assertFalse;
34 import static org.junit.Assert.assertTrue;
35
36
37
38
39
40
41 public class Surefire260TestWithIdenticalNamesIT
42 extends SurefireJUnit4IntegrationTestCase
43 {
44
45 @Test
46 public void testWithIdenticalNames()
47 throws IOException
48 {
49 SurefireLauncher surefireLauncher = unpack( "surefire-260-testWithIdenticalNames" ).failNever();
50 surefireLauncher.executeTest();
51 surefireLauncher.reset();
52 OutputValidator validator = surefireLauncher.addSurefireReportGoal().executeCurrentGoals();
53
54 TestFile siteFile = validator.getSiteFile( "surefire-report.html" );
55 final URI uri = siteFile.toURI();
56
57 final WebClient webClient = new WebClient();
58 webClient.setJavaScriptEnabled( true );
59 final HtmlPage page = webClient.getPage( uri.toURL() );
60
61 final HtmlAnchor a =
62 (HtmlAnchor) page.getByXPath( "//a[contains(@href, 'surefire260_TestB_testDup')]" ).get( 0 );
63 final HtmlDivision content = (HtmlDivision) page.getElementById( "surefire260_TestB_testDuperror" );
64 assertTrue( content.getAttribute( "style" ).contains( "none" ) );
65 a.click();
66 assertFalse( content.getAttribute( "style" ).contains( "none" ) );
67 webClient.closeAllWindows();
68 }
69 }