Skip to content

Commit

Permalink
ensure selendroid test app doesn't need to have its version updated w…
Browse files Browse the repository at this point in the history
…hen we update selendroid
  • Loading branch information
jlipps committed Feb 13, 2014
1 parent 706a610 commit 0de0452
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -9,6 +9,7 @@ sample-code/apps/TestApp/build
sample-code/apps/WebViewApp/build
sample-code/apps/WebViewApp/WebViewApp.xcodeproj/project.xcworkspace/xcshareddata
sample-code/apps/gps-demo*
sample-code/apps/*.apk
*.sublime-*
sample-code/apps/UICatalog*
sample-code/apps/io.appium.gappium*
Expand Down
7 changes: 4 additions & 3 deletions reset.sh
Expand Up @@ -349,9 +349,10 @@ reset_selendroid() {
reset_toggle_test
uninstall_android_app com.example.toggletest.selendroid
fi
echo "* Linking selendroid test app: WebViewDemo"
run_cmd rm -rf $appium_home/sample-code/apps/WebViewDemo
run_cmd ln -s $appium_home/submodules/selendroid/selendroid-test-app $appium_home/sample-code/apps/WebViewDemo
echo "* Linking selendroid test app"
run_cmd rm -rf $appium_home/sample-code/apps/selendroid-test-app.apk
test_apk=$(ls $appium_home/submodules/selendroid/selendroid-test-app/target/*.apk | head -1)
run_cmd ln -s $test_apk $appium_home/sample-code/apps/selendroid-test-app.apk
uninstall_android_app io.selendroid.testapp.selendroid
uninstall_android_app io.selendroid.testapp
# keep older versions of package around to clean up
Expand Down
Expand Up @@ -19,24 +19,14 @@ public class AndroidWebViewTest {
public void setUp() throws Exception {
// set up appium
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "../../../apps/WebViewDemo/target");
String file = getApkFile(appDir);
File app = new File(appDir, file);
File app = new File(classpathRoot, "../../../apps/selendroid-test-app.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device","selendroid");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("app-package", "io.selendroid.testapp");
capabilities.setCapability("app-activity", ".HomeScreenActivity");
driver = new SwipeableWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
private String getApkFile(File appDir) {

for(String s : appDir.list())
if(s.contains(".apk")){
return s;
}
return "";
}
@After
public void tearDown() throws Exception {
driver.quit();
Expand Down
Expand Up @@ -20,9 +20,7 @@ public class AndroidWebViewTest {
public void setUp() throws Exception {
// set up appium
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "../../../apps/WebViewDemo/target");
String file = getApkFile(appDir);
File app = new File(appDir, file);
File app = new File(classpathRoot, "../../../apps/selendroid-test-app.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device","selendroid");
capabilities.setCapability("app", app.getAbsolutePath());
Expand All @@ -31,15 +29,6 @@ public void setUp() throws Exception {
driver = new SwipeableWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}

private String getApkFile(File appDir) {

for(String s : appDir.list())
if(s.contains(".apk")){
return s;
}
return "";
}

@AfterMethod
public void tearDown() throws Exception {
driver.quit();
Expand Down
3 changes: 1 addition & 2 deletions sample-code/examples/python/android_web_view.py
Expand Up @@ -10,8 +10,7 @@ class TestAndroidWebView(unittest.TestCase):
def setUp(self):
app = os.path.abspath(
glob.glob(os.path.join(
os.path.dirname(__file__), '../../apps/WebViewDemo/target')
+ '/*.apk')[0])
os.path.dirname(__file__), '../../apps/selendroid-test-app.apk')))
desired_caps = {
'device': 'selendroid',
'app': app,
Expand Down
3 changes: 1 addition & 2 deletions test/functional/selendroid/webview-specs.js
Expand Up @@ -7,8 +7,7 @@ var env = require('../../helpers/env')
, path = require('path');

var desired = {
app: path.resolve(__dirname, "../../../sample-code/apps/WebViewDemo/target/" +
"selendroid-test-app-0.8.0.apk"),
app: path.resolve(__dirname, "../../../sample-code/apps/selendroid-test-app.apk"),
'app-package': 'io.selendroid.testapp',
'app-activity': '.HomeScreenActivity'
};
Expand Down

0 comments on commit 0de0452

Please sign in to comment.