1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.libraries;
16
17 import java.net.URL;
18
19 import org.eclipse.jetty.server.Server;
20 import org.htmlunit.WebDriverTestCase;
21 import org.htmlunit.WebServerTestCase;
22 import org.htmlunit.junit.BrowserRunner;
23 import org.htmlunit.junit.annotation.Alerts;
24 import org.junit.AfterClass;
25 import org.junit.BeforeClass;
26 import org.junit.Test;
27 import org.junit.runner.RunWith;
28 import org.openqa.selenium.WebDriver;
29
30
31
32
33
34
35 @RunWith(BrowserRunner.class)
36 public class BirdTest extends WebDriverTestCase {
37
38
39 protected static Server SERVER_;
40
41
42
43
44 @BeforeClass
45 public static void startSesrver() throws Exception {
46 SERVER_ = WebServerTestCase.createWebServer("src/test/resources/libraries/bird/", null);
47 }
48
49
50
51
52 @AfterClass
53 public static void stopServer() throws Exception {
54 if (SERVER_ != null) {
55 SERVER_.stop();
56 SERVER_.destroy();
57 SERVER_ = null;
58 }
59 }
60
61
62
63
64 protected URL getBaseUrl() {
65 return URL_FIRST;
66 }
67
68
69
70
71 @Test
72 @Alerts(CHROME = {"IE false", "IE6 undefined", "IE7 undefined", "IE8 undefined", "Mozilla true",
73 "Firefox false", "Firefox2 undefined", "Firefox3 undefined", "Gecko true",
74 "Safari true", "KHTML true", "Opera false"},
75 EDGE = {"IE false", "IE6 undefined", "IE7 undefined", "IE8 undefined", "Mozilla true",
76 "Firefox false", "Firefox2 undefined", "Firefox3 undefined", "Gecko true",
77 "Safari true", "KHTML true", "Opera false"},
78 FF = {"IE false", "IE6 undefined", "IE7 undefined", "IE8 undefined", "Mozilla true",
79 "Firefox true", "Firefox2 undefined", "Firefox3 undefined", "Gecko true",
80 "Safari false", "KHTML false", "Opera false"},
81 FF_ESR = {"IE false", "IE6 undefined", "IE7 undefined", "IE8 undefined", "Mozilla true",
82 "Firefox true", "Firefox2 undefined", "Firefox3 undefined", "Gecko true",
83 "Safari false", "KHTML false", "Opera false"})
84 public void browserUtility() throws Exception {
85 doTest("BrowserUtilityTest.html");
86 }
87
88 private void doTest(final String filename) throws Exception {
89 final WebDriver driver = getWebDriver();
90 driver.get(getBaseUrl() + filename);
91
92 verifyTextArea2(driver, getExpectedAlerts());
93 }
94 }