Skip to content

Commit dc80b32

Browse files
committed
Updated for parameterized config keys.
1 parent 7034da1 commit dc80b32

File tree

5 files changed

+53
-21
lines changed

5 files changed

+53
-21
lines changed

pom.xml

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45
<artifactId>appium</artifactId>
56
<version>2.2.0</version>
67
<name>${project.groupId}:${project.artifactId}</name>
7-
<description>Automation Framework wrapped over Appium.</description>
8+
<description>Robust Automation Framework wrapped over Appium.</description>
89
<url>https://github.com/WasiqB/coteafs-appium</url>
910

1011
<parent>
1112
<groupId>com.github.wasiqb.coteafs</groupId>
1213
<artifactId>parent</artifactId>
13-
<version>2.0.1</version>
14+
<version>2.0.1</version>
1415
</parent>
1516

1617
<scm>
@@ -25,8 +26,8 @@
2526
</issueManagement>
2627

2728
<ciManagement>
28-
<system>travis</system>
29-
<url>https://travis-ci.org/WasiqB/coteafs-appium</url>
29+
<system>Circle CI</system>
30+
<url>https://circleci.com/gh/WasiqB/coteafs-appium</url>
3031
</ciManagement>
3132

3233
<properties>
@@ -35,6 +36,7 @@
3536
<coteafs.config.version>1.6.0</coteafs.config.version>
3637
<coteafs.error.version>1.5.0</coteafs.error.version>
3738
<coteafs.logger.version>1.6.0</coteafs.logger.version>
39+
<commons.text.version>1.4</commons.text.version>
3840
</properties>
3941

4042
<dependencies>
@@ -49,6 +51,11 @@
4951
</exclusion>
5052
</exclusions>
5153
</dependency>
54+
<dependency>
55+
<groupId>org.apache.commons</groupId>
56+
<artifactId>commons-text</artifactId>
57+
<version>${commons.text.version}</version>
58+
</dependency>
5259
<dependency>
5360
<groupId>com.github.wasiqb.coteafs</groupId>
5461
<artifactId>error</artifactId>

src/main/java/com/github/wasiqb/coteafs/appium/config/DeviceSetting.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package com.github.wasiqb.coteafs.appium.config;
1717

18+
import static org.apache.commons.text.StringSubstitutor.replaceSystemProperties;
19+
1820
import com.github.wasiqb.coteafs.appium.config.enums.ApplicationType;
1921
import com.github.wasiqb.coteafs.appium.config.enums.AutomationName;
2022
import com.github.wasiqb.coteafs.appium.config.enums.Browser;
@@ -79,7 +81,9 @@ public AndroidDeviceSetting getAndroid () {
7981
* @return the appLocation
8082
*/
8183
public String getAppLocation () {
82-
return this.appLocation;
84+
return this.appLocation.startsWith ("${")
85+
? replaceSystemProperties (this.appLocation)
86+
: this.appLocation;
8387
}
8488

8589
/**

src/main/java/com/github/wasiqb/coteafs/appium/config/ServerSetting.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package com.github.wasiqb.coteafs.appium.config;
1717

18+
import static org.apache.commons.text.StringSubstitutor.replaceSystemProperties;
19+
1820
import java.util.HashMap;
1921
import java.util.Map;
2022

@@ -126,7 +128,9 @@ public String getNodePath () {
126128
* @return the password
127129
*/
128130
public String getPassword () {
129-
return this.password;
131+
return this.password.startsWith ("${")
132+
? replaceSystemProperties (this.password)
133+
: this.password;
130134
}
131135

132136
/**
@@ -171,7 +175,9 @@ public long getStartUpTimeOutSeconds () {
171175
* @return the userName
172176
*/
173177
public String getUserName () {
174-
return this.userName;
178+
return this.userName.startsWith ("${")
179+
? replaceSystemProperties (this.userName)
180+
: this.userName;
175181
}
176182

177183
/**

src/test/java/com/github/wasiqb/coteafs/appium/android/DefaultTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class DefaultTest {
3939
*/
4040
@BeforeMethod
4141
public void setupMethod () {
42-
this.androidDevice = new AndroidDevice (this.androidServer, "test");
42+
this.androidDevice = new AndroidDevice (this.androidServer, "test_browserstack");
4343
this.androidDevice.start ();
4444

4545
login ();
@@ -53,7 +53,7 @@ public void setupMethod () {
5353
*/
5454
@BeforeClass (alwaysRun = true)
5555
public void setupTestSuite () {
56-
this.androidServer = new AppiumServer ("android");
56+
this.androidServer = new AppiumServer ("browserstack");
5757
this.androidServer.start ();
5858
}
5959

@@ -82,7 +82,7 @@ public void tearDownTestSuite () {
8282
private void login () {
8383
final LoginActivityAction login = new LoginActivityAction (this.androidDevice);
8484
login.addInputValue ("UserName", "admin")
85-
.addInputValue ("Password", "admin")
86-
.perform ();
85+
.addInputValue ("Password", "admin")
86+
.perform ();
8787
}
8888
}

src/test/resources/appium-config.yaml

+24-9
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,49 @@
11
servers:
22
android:
3-
# protocol: HTTP
43
host: 0.0.0.0
54
port: 4723
6-
# cloud: true
7-
# external: true
8-
user_name: wasiqbhamla1
9-
password: CDbp8qTdCa7nVtxur9fp
105
appium_js_path: C:\Users\wasiqb\AppData\Roaming\npm\node_modules\appium\build\lib\main.js
116
node_path: C:\Program Files\nodejs\node.exe
12-
# external: true
137
arguments:
148
log_level: DEBUG
159
log_time_stamp: true
1610
local_time_zone: true
1711
session_override: true
1812
android:
1913
suppress_adb_kill_server: true
14+
browserstack:
15+
protocol: HTTPS
16+
host: hub-cloud.browserstack.com
17+
cloud: true
18+
external: true
19+
user_name: ${env.user}
20+
password: ${env.pass}
2021

2122
devices:
22-
test:
23+
test_local:
2324
platform_type: ANDROID
2425
device_name: Samsung Galaxy S8
2526
device_version: 7.0
2627
app_type: HYBRID
2728
device_type: REAL
2829
automation_name: APPIUM
2930
app_location: apps/android/VodQA.apk
30-
# app_location: bs://d5fbc8a52dd7bad1535da8d2c7a4bbc2178c8081
31-
# cloud_app: true
31+
session_timeout: 120000
32+
playback:
33+
delay_before_swipe: 2
34+
delay_after_swipe: 1
35+
delay_before_tap: 2
36+
delay_after_tap: 1
37+
test_browserstack:
38+
platform_type: ANDROID
39+
device_name: Samsung Galaxy S8
40+
device_version: 7.0
41+
app_type: HYBRID
42+
device_type: REAL
43+
automation_name: APPIUM
44+
app_location: apps/android/VodQA.apk
45+
app_location: ${env.app}
46+
cloud_app: true
3247
session_timeout: 120000
3348
playback:
3449
delay_before_swipe: 2

0 commit comments

Comments
 (0)