1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.libraries;
16
17 import org.htmlunit.WebDriverTestCase;
18 import org.htmlunit.junit.BrowserRunner;
19 import org.htmlunit.junit.annotation.Alerts;
20 import org.junit.Before;
21 import org.junit.Test;
22 import org.junit.runner.RunWith;
23 import org.openqa.selenium.By;
24 import org.openqa.selenium.WebDriver;
25
26
27
28
29
30
31 @RunWith(BrowserRunner.class)
32 public class VueTest extends WebDriverTestCase {
33
34
35
36
37 @Test
38 @Alerts("Hello World")
39 public void hello() throws Exception {
40 final String url = URL_FIRST + "hello.html";
41
42 final WebDriver driver = getWebDriver();
43 driver.get(url);
44
45 assertEquals(getExpectedAlerts()[0], driver.findElement(By.id("app")).getText());
46 }
47
48
49
50
51 @Test
52 @Alerts("Hello World")
53 public void helloMin() throws Exception {
54 final String url = URL_FIRST + "hello.min.html";
55
56 final WebDriver driver = getWebDriver();
57 driver.get(url);
58
59 assertEquals(getExpectedAlerts()[0], driver.findElement(By.id("app")).getText());
60 }
61
62
63
64
65 @Test
66 @Alerts("Hello from HtmlUnit!")
67 public void helloButton() throws Exception {
68 final String url = URL_FIRST + "hello_button.html";
69
70 final WebDriver driver = getWebDriver();
71 driver.get(url);
72
73 driver.findElement(By.id("tester")).click();
74 verifyAlerts(driver, getExpectedAlerts());
75 }
76
77
78
79
80 @Test
81 @Alerts("Hello from HtmlUnit!")
82 public void helloButtonMin() throws Exception {
83 final String url = URL_FIRST + "hello_button.min.html";
84
85 final WebDriver driver = getWebDriver();
86 driver.get(url);
87
88 driver.findElement(By.id("tester")).click();
89 verifyAlerts(driver, getExpectedAlerts());
90 }
91
92
93
94
95
96 @Before
97 public void setUp() throws Exception {
98 startWebServer("src/test/resources/libraries/vue/hello_world", null, null);
99 }
100 }