11
11
import static com .aerokube .lightning .model .FirefoxContext .CHROME ;
12
12
import static com .aerokube .lightning .model .FirefoxContext .CONTENT ;
13
13
import static org .hamcrest .MatcherAssert .assertThat ;
14
- import static org .hamcrest .Matchers .*;
14
+ import static org .hamcrest .Matchers .equalTo ;
15
+ import static org .hamcrest .Matchers .greaterThan ;
15
16
16
- public class FirefoxTest extends BaseTest {
17
+ public class FirefoxCommandsTest extends BaseTest {
17
18
18
19
@ Override
19
20
protected Image getImage () {
20
21
return FIREFOX ;
21
22
}
22
23
23
- @ Override
24
- protected String getUri (int port ) {
25
- return String .format ("http://localhost:%s/wd/hub" , port );
26
- }
27
-
28
24
@ Test
29
25
void testLoadUnloadExtension () {
30
26
Path extensionPath = Paths .get ("src" , "test" , "resources" , "test.xpi" );
@@ -36,13 +32,13 @@ void testLoadUnloadExtension() {
36
32
.elements ().findFirst (By .tagName ("body" ));
37
33
assertThat (body .getCssProperty ("background-color" ), equalTo ("rgb(240, 240, 242)" ));
38
34
39
- String addonId = driver .extension (Firefox .class ).installAddon (extensionPath );
35
+ String addonId = driver .extension (FirefoxCommands .class ).installAddon (extensionPath );
40
36
body = driver
41
37
.navigation ().refresh ()
42
38
.elements ().findFirst (By .tagName ("body" ));
43
39
assertThat (body .getCssProperty ("background-color" ), equalTo ("rgb(0, 0, 0)" ));
44
40
45
- driver .extension (Firefox .class ).uninstallAddon (addonId );
41
+ driver .extension (FirefoxCommands .class ).uninstallAddon (addonId );
46
42
body = driver
47
43
.navigation ().refresh ()
48
44
.elements ().findFirst (By .tagName ("body" ));
@@ -56,10 +52,10 @@ void testContext() {
56
52
test (
57
53
() -> Capabilities .create ().firefox (),
58
54
driver -> {
59
- FirefoxContext context = driver .extension (Firefox .class ).context ();
55
+ FirefoxContext context = driver .extension (FirefoxCommands .class ).context ();
60
56
assertThat (context , equalTo (CONTENT ));
61
57
62
- FirefoxContext switchedContext = driver .extension (Firefox .class ).context (CHROME )
58
+ FirefoxContext switchedContext = driver .extension (FirefoxCommands .class ).context (CHROME )
63
59
.context ();
64
60
assertThat (switchedContext , equalTo (CHROME ));
65
61
}
@@ -73,7 +69,7 @@ void testPageScreenshot() {
73
69
driver -> {
74
70
driver .navigation ()
75
71
.navigate ("https://example.com" );
76
- byte [] screenshot = driver .extension (Firefox .class ).fullScreenshot ();
72
+ byte [] screenshot = driver .extension (FirefoxCommands .class ).fullScreenshot ();
77
73
assertThat (screenshot .length , greaterThan (0 ));
78
74
}
79
75
);
0 commit comments