Skip to content

Instantly share code, notes, and snippets.

View RussellCollins's full-sized avatar

Russell Collins RussellCollins

View GitHub Profile
@RussellCollins
RussellCollins / APK_download_deploy.sh
Created April 16, 2017 04:18
A convenience script for automatically pulling Android builds from a static URL and distributing them to connected devices. Assumes AAPT and adb are in your PATH variable already.
#!/bin/sh
APK_URL="" ###### UPDATE THIS WITH THE URL TO THE ARCHIVED LAST SUCCESSFUL BUILD ARTIFACT ON JENKINS FOR EXAMPLE
FILEPATH=""
## MAKE SURE ADB IS RUNNING ##
adb version
@RussellCollins
RussellCollins / example_permission_setter.sh
Created December 2, 2015 08:56
Set write and read external storage permission prior to a test run so that a screenshot on fail listener can work on device targets running Android 6.0+
SDK=`adb shell getprop ro.build.version.sdk | tr -d '\r'`
echo "Device SDK level is: " $SDK
if (( "$SDK" >= 23 )) ; then
echo "Enabling read and write external storage permissions before running tests on Android 6.0+"
adb shell pm grant com.replace.with.your.app.package android.permission.WRITE_EXTERNAL_STORAGE
adb shell pm grant com.replace.with.your.app.package android.permission.READ_EXTERNAL_STORAGE
fi
package com.testexample.RunListeners
import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import org.junit.runner.Description;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;
import java.io.File;
package com.factorypatterndemo.utils.interfaces;
import java.io.IOException;
import java.util.Calendar;
import com.android.uiautomator.core.UiObjectNotFoundException;
public interface SystemUiDateTimeViewHelperInterface {
void setSystemTime(Calendar calendar) throws UiObjectNotFoundException, IOException;
package com.factorypatterndemo.utils.factories;
import android.os.Build;
import com.factorypatterndemo.utils.helpers.AsusNexus72012sdk21SystemDateTimeViewHelper;
import com.factorypatterndemo.utils.helpers.SamsungGalaxyS5sdk19SystemDateTimeViewHelper;
import com.factorypatterndemo.utils.interfaces.SystemUiDateTimeViewHelperInterface;
public class SystemUiDateTimeViewHelperFactory {
static String galaxyS5_sdk19_fingerprint = "samsung/kltedx/klte:4.4.2/KOT49H/G900FDXU1ANG4:user/release-keys";