Skip to content

Commit 8ab2950

Browse files
update tests
1 parent ddde557 commit 8ab2950

10 files changed

Lines changed: 68 additions & 51 deletions

File tree

.github/workflows/test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Java CI with Maven
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: Set up JDK 11
12+
uses: actions/setup-java@v3
13+
with:
14+
java-version: '11'
15+
distribution: 'temurin' # Use Temurin distribution (formerly AdoptOpenJDK)
16+
- name: Cache Maven packages
17+
uses: actions/cache@v3
18+
with:
19+
path: ~/.m2
20+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
21+
restore-keys: |
22+
${{ runner.os }}-m2
23+
- name: Build with Maven
24+
run: mvn -B clean test -P single

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ local.log
2424
*.rar
2525

2626
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
27-
hs_err_pid*
27+
hs_err_pid*
28+
**/.DS_Store

.travis.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
[![Build Status](https://travis-ci.org/testingbot/java-junit-example.svg?branch=master)](https://travis-ci.org/testingbot/java-junit-example)
2-
31
## TestingBot - Java & JUnit
42

53
TestingBot provides an online grid of browsers and mobile devices to run Automated tests on via Selenium WebDriver.
@@ -27,4 +25,4 @@ You will see the test result in the [TestingBot Dashboard](https://testingbot.co
2725
### Resources
2826
##### [TestingBot Documentation](https://testingbot.com/support/getting-started/junit.html)
2927
30-
##### [SeleniumHQ Documentation](http://www.seleniumhq.org/docs/)
28+
##### [SeleniumHQ Documentation](https://www.selenium.dev/documentation/)

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@
1616

1717
<test.file></test.file>
1818
<config.file>default</config.file>
19-
<maven.compiler.source>1.6</maven.compiler.source>
20-
<maven.compiler.target>1.6</maven.compiler.target>
19+
<maven.compiler.source>1.7</maven.compiler.source>
20+
<maven.compiler.target>1.7</maven.compiler.target>
2121
</properties>
2222

2323
<dependencies>
2424
<dependency>
2525
<groupId>junit</groupId>
2626
<artifactId>junit</artifactId>
27-
<version>4.12</version>
27+
<version>4.13.2</version>
2828
</dependency>
2929
<dependency>
3030
<groupId>commons-io</groupId>
3131
<artifactId>commons-io</artifactId>
32-
<version>1.3.2</version>
32+
<version>2.15.1</version>
3333
</dependency>
3434
<dependency>
3535
<groupId>org.seleniumhq.selenium</groupId>
3636
<artifactId>selenium-java</artifactId>
37-
<version>3.141.59</version>
37+
<version>4.18.1</version>
3838
</dependency>
3939
<dependency>
4040
<groupId>com.googlecode.json-simple</groupId>

src/test/java/com/testingbot/SingleTest.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@ public class SingleTest extends TestingBotJUnitTest {
1010

1111
@Test
1212
public void test() throws Exception {
13-
driver.get("https://www.google.com/ncr");
14-
WebElement element = driver.findElement(By.name("q"));
15-
element.sendKeys("TestingBot");
16-
element.submit();
17-
Thread.sleep(5000);
18-
19-
assertEquals("TestingBot - Google Search", driver.getTitle());
13+
driver.get("https://testingbot.com");
14+
assertTrue(driver.getTitle().contains("TestingBot"));
2015
}
2116
}

src/test/java/com/testingbot/TestingBotJUnitTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ public void setUp() throws Exception {
6161
Iterator it = envCapabilities.entrySet().iterator();
6262
while (it.hasNext()) {
6363
Map.Entry pair = (Map.Entry)it.next();
64-
capabilities.setCapability(pair.getKey().toString(), pair.getValue().toString());
64+
capabilities.setCapability(pair.getKey().toString(), pair.getValue());
6565
}
6666

6767
Map<String, String> commonCapabilities = (Map<String, String>) config.get("capabilities");
6868
it = commonCapabilities.entrySet().iterator();
6969
while (it.hasNext()) {
7070
Map.Entry pair = (Map.Entry)it.next();
7171
if(capabilities.getCapability(pair.getKey().toString()) == null){
72-
capabilities.setCapability(pair.getKey().toString(), pair.getValue().toString());
72+
capabilities.setCapability(pair.getKey().toString(), pair.getValue());
7373
}
7474
}
7575

@@ -83,7 +83,7 @@ public void setUp() throws Exception {
8383
secret = (String) config.get("secret");
8484
}
8585

86-
driver = new RemoteWebDriver(new URL("http://"+key+":"+secret+"@"+config.get("server")+"/wd/hub"), capabilities);
86+
driver = new RemoteWebDriver(new URL("https://"+key+":"+secret+"@"+config.get("server")+"/wd/hub"), capabilities);
8787
}
8888

8989
@After
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
{
22
"server": "hub.testingbot.com",
3-
"key": "TESTINGBOT_KEY",
4-
"secret": "TESTINGBOT_SECRET",
3+
"key": "TB_KEY",
4+
"secret": "TB_SECRET",
55

66
"capabilities": {
7-
"build": "junit-testingbot",
8-
"name": "single_test"
7+
"tb:options": {
8+
"build": "junit-testingbot",
9+
"name": "parallel_test"
10+
}
911
},
1012

1113
"environments": [{
12-
"app": "tb://f0862ada623e611f530a65f5",
13-
"deviceName": "Pixel 2",
14-
"version": "7.1",
15-
"platformName": "Android"
14+
"appium:app": "https://testingbot.com/appium/sample.apk",
15+
"appium:deviceName": "Pixel 2",
16+
"appium:version": "7.1",
17+
"appium:platformName": "Android"
1618
}]
1719
}
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
{
22
"server": "hub.testingbot.com",
3-
"key": "TESTINGBOT_KEY",
4-
"secret": "TESTINGBOT_SECRET",
3+
"key": "TB_KEY",
4+
"secret": "TB_SECRET",
55

66
"capabilities": {
7-
"build": "junit-testingbot",
8-
"name": "parallel_test"
7+
"tb:options": {
8+
"build": "junit-testingbot",
9+
"name": "parallel_test"
10+
}
911
},
1012

1113
"environments": [{
12-
"browser": "chrome",
13-
"platform": "WIN10",
14-
"version": "latest"
14+
"browserName": "chrome",
15+
"platformName": "WIN10",
16+
"browserVersion": "latest"
1517
},{
16-
"browser": "firefox",
17-
"platform": "WIN10",
18-
"version": "latest"
18+
"browserName": "firefox",
19+
"platformName": "SONOMA",
20+
"browserVersion": "latest"
1921
}]
2022
}
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
{
22
"server": "hub.testingbot.com",
3-
"key": "TESTINGBOT_KEY",
4-
"secret": "TESTINGBOT_SECRET",
3+
"key": "TB_KEY",
4+
"secret": "TB_SECRET",
55

66
"capabilities": {
7-
"build": "junit-testingbot",
8-
"name": "single_test"
7+
"tb:options": {
8+
"build": "junit-testingbot",
9+
"name": "single_test"
10+
}
911
},
1012

1113
"environments": [{
12-
"browser": "chrome",
13-
"platform": "WIN10",
14-
"version": "latest"
14+
"browserName": "chrome",
15+
"platformName": "WIN10",
16+
"browserVersion": "latest"
1517
}]
1618
}

0 commit comments

Comments
 (0)