File tree Expand file tree Collapse file tree 4 files changed +16
-48
lines changed
src/test/java/co/unruly/flick Expand file tree Collapse file tree 4 files changed +16
-48
lines changed Original file line number Diff line number Diff line change 168168 <artifactId >junit</artifactId >
169169 <version >${junit.version} </version >
170170 </dependency >
171+
172+ <dependency >
173+ <groupId >com.codeborne</groupId >
174+ <artifactId >phantomjsdriver</artifactId >
175+ <version >1.2.1</version >
176+ <scope >test</scope >
177+ </dependency >
171178 </dependencies >
172179
173180 <distributionManagement >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11package co .unruly .flick ;
22
3- import co .unruly .flick .browser .Browser ;
43import co .unruly .flick .browser .Page ;
54import co .unruly .flick .dsl .Action ;
65import co .unruly .flick .dsl .Actor ;
@@ -13,13 +12,14 @@ public class ExampleTest implements FlickDSL {
1312
1413 private static class User implements Actor {}
1514
16- private final Browser browser = new PhantomJSBrowser ();
15+ private final PhantomJSBrowser browser = new PhantomJSBrowser ();
1716
1817 @ Test
1918 public void shouldLoadPage () {
2019 Actor actor = new User ();
2120
2221 Page page = given (actor .using (browser , "http://example.com" ))
22+ .wasAbleTo (logHelloUsingJS ())
2323 .hasHappened ();
2424
2525 then (actor .using (browser , page ))
@@ -47,6 +47,10 @@ private Action getMoreInfo() {
4747 return (browser ) -> browser .findElement (By .xpath ("/html/body/div/p[2]/a" )).click ();
4848 }
4949
50+ private Action <PhantomJSBrowser > logHelloUsingJS () {
51+ return PhantomJSBrowser ::hello ;
52+ }
53+
5054 private Assertion beOnPage (String expectedUrl ) {
5155 return (browser ) -> browser .waitUntilEquals (
5256 () -> browser .getDriver ().getCurrentUrl (),
Original file line number Diff line number Diff line change @@ -44,4 +44,7 @@ public void shutdown() {
4444 this .driver .quit ();
4545 }
4646
47+ public void hello () {
48+ ((PhantomJSDriver ) driver ).executePhantomJS ("console.log('Hello!');" );
49+ }
4750}
You can’t perform that action at this time.
0 commit comments