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.annotation.Alerts;
23 import org.junit.jupiter.api.AfterAll;
24 import org.junit.jupiter.api.BeforeAll;
25 import org.junit.jupiter.api.Test;
26 import org.openqa.selenium.WebDriver;
27
28
29
30
31
32
33 public class BirdTest extends WebDriverTestCase {
34
35
36 protected static Server SERVER_;
37
38
39
40
41 @BeforeAll
42 public static void startSesrver() throws Exception {
43 SERVER_ = WebServerTestCase.createWebServer("src/test/resources/libraries/bird/", null);
44 }
45
46
47
48
49 @AfterAll
50 public static void stopServer() throws Exception {
51 if (SERVER_ != null) {
52 SERVER_.stop();
53 SERVER_.destroy();
54 SERVER_ = null;
55 }
56 }
57
58
59
60
61 protected URL getBaseUrl() {
62 return URL_FIRST;
63 }
64
65
66
67
68 @Test
69 @Alerts(CHROME = {"IE false", "IE6 undefined", "IE7 undefined", "IE8 undefined", "Mozilla true",
70 "Firefox false", "Firefox2 undefined", "Firefox3 undefined", "Gecko true",
71 "Safari true", "KHTML true", "Opera false"},
72 EDGE = {"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 FF = {"IE false", "IE6 undefined", "IE7 undefined", "IE8 undefined", "Mozilla true",
76 "Firefox true", "Firefox2 undefined", "Firefox3 undefined", "Gecko true",
77 "Safari false", "KHTML false", "Opera false"},
78 FF_ESR = {"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 public void browserUtility() throws Exception {
82 doTest("BrowserUtilityTest.html");
83 }
84
85 private void doTest(final String filename) throws Exception {
86 final WebDriver driver = getWebDriver();
87 driver.get(getBaseUrl() + filename);
88
89 verifyTextArea2(driver, getExpectedAlerts());
90 }
91 }