-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
267 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
javac -cp target/calabash-jvm-0.0.1-standalone.jar:target/classes example/*.java -d target/classes && java -cp target/calabash-jvm-0.0.1-standalone.jar:target/classes calabash_jvm.Example | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,40 @@ | ||
package calabash_jvm; | ||
|
||
import calabash_jvm.API; | ||
import java.util.List; | ||
import java.util.Map; | ||
import calabash_jvm.QueryBuilder; | ||
|
||
|
||
import static calabash_jvm.API.*; | ||
import static calabash_jvm.QueryBuilder.view; | ||
|
||
class Example | ||
{ | ||
|
||
public static void main(String[] args) | ||
{ | ||
List l = (List) API.queryq("[:UITableView]",null); | ||
System.err.println("-----"); | ||
for (Object m : l) | ||
{ | ||
System.err.println(m); | ||
} | ||
|
||
screenshot(null); | ||
touch(view("UITabBarButton"). | ||
marked("Fourth"), null); | ||
|
||
|
||
QueryBuilder q = view("UIWebView"); | ||
|
||
waitForExists(q,null); | ||
|
||
screenshot(null); | ||
|
||
scroll(q,"down"); | ||
|
||
waitForExists(q.css("a"), null); | ||
|
||
touch(q, null); | ||
screenshot(null); | ||
|
||
System.exit(0); | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package calabash_jvm; | ||
import calabash_jvm.API; | ||
import java.util.*; | ||
|
||
import static calabash_jvm.API.*; | ||
|
||
public class QueryBuilder extends AbstractList | ||
{ | ||
|
||
private List list; | ||
|
||
public QueryBuilder() | ||
{ | ||
this.list = new ArrayList(10); | ||
} | ||
|
||
public QueryBuilder(List l) | ||
{ | ||
this.list = new ArrayList(l); | ||
} | ||
|
||
public Object get(int i) { return this.list.get(i);} | ||
public int size() {return this.list.size();} | ||
|
||
|
||
public QueryBuilder dup() | ||
{ | ||
return new QueryBuilder(this.list); | ||
} | ||
|
||
public static QueryBuilder view(String s) | ||
{ | ||
return new QueryBuilder().type(s); | ||
} | ||
|
||
public QueryBuilder type(String t) | ||
{ | ||
this.list.add(t); | ||
return this; | ||
} | ||
|
||
public QueryBuilder parent() | ||
{ | ||
this.list.add("parent"); | ||
return this; | ||
} | ||
public QueryBuilder descendant() | ||
{ | ||
this.list.add("descendant"); | ||
return this; | ||
} | ||
|
||
public QueryBuilder child() | ||
{ | ||
this.list.add("child"); | ||
return this; | ||
} | ||
|
||
public QueryBuilder with(String key, Object val) | ||
{ | ||
this.list.add(Collections.singletonMap(key,val)); | ||
return this; | ||
} | ||
|
||
public QueryBuilder marked(String mark) | ||
{ | ||
return with("marked",mark); | ||
} | ||
|
||
public QueryBuilder index(int i) | ||
{ | ||
this.list.add(calabash_jvm.API.index(i)); | ||
return this; | ||
} | ||
|
||
public QueryBuilder css(String s) | ||
{ | ||
this.list.add(calabash_jvm.API.css(s)); | ||
return this; | ||
} | ||
|
||
public QueryBuilder xpath(String xp) | ||
{ | ||
this.list.add(calabash_jvm.API.xpath(xp)); | ||
return this; | ||
} | ||
|
||
public List toQuery() | ||
{ | ||
return Collections.unmodifiableList(this.list); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
|
||
#!/bin/bash | ||
lein clean | ||
lein uberjar | ||
|
||
javac -cp target/calabash-jvm-0.0.1-standalone.jar:target/classes example/Example.java -d target/classes | ||
|
||
java -cp target/calabash-jvm-0.0.1-standalone.jar:target/classes Example | ||
./compile-run-example.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters