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