Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions AndroidE2E/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.reactnativenavigation.e2e.androide2e"
minSdkVersion 18
targetSdkVersion 25
minSdkVersion 24
targetSdkVersion 27
versionCode 1
versionName "1.0"

Expand All @@ -15,12 +20,12 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.2'

androidTestCompile 'org.assertj:assertj-core:2.5.0'
androidTestCompile 'com.android.support:support-annotations:25.3.1'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
androidTestImplementation 'org.assertj:assertj-core:3.8.0'
androidTestImplementation 'com.android.support:support-annotations:27.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:rules:1.0.1'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
package com.reactnativenavigation.e2e.androide2e;

import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.BySelector;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiScrollable;
import android.support.test.uiautomator.UiSelector;
import android.support.test.uiautomator.Until;

import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;

import java.io.File;

import static android.support.test.InstrumentationRegistry.getInstrumentation;
import static org.assertj.core.api.Java6Assertions.assertThat;
import android.content.pm.*;
import android.graphics.*;
import android.support.test.runner.*;
import android.support.test.uiautomator.*;

import org.junit.*;
import org.junit.runner.*;

import java.io.*;

import static android.support.test.InstrumentationRegistry.*;
import static org.assertj.core.api.Java6Assertions.*;

@RunWith(AndroidJUnit4.class)
public abstract class BaseTest {
Expand All @@ -38,6 +29,7 @@ public void beforeEach() throws Exception {
@After
public void afterEach() throws Exception {
device().executeShellCommand("am force-stop " + PACKAGE_NAME);
device().executeShellCommand("am kill " + PACKAGE_NAME);
}

public UiDevice device() {
Expand Down Expand Up @@ -97,8 +89,16 @@ public Bitmap captureScreenshot() throws Exception {
return bitmap;
}

public void swipeOpenLeftSideMenu() {
device().swipe(5, 102, 500, 152, 15);
public void swipeOpenFromLeft() {
int w = device().getDisplayWidth();
int h = device().getDisplayHeight();
device().swipe(5, h / 2, w / 2, h / 2, 10);
}

public void swipeOpenFromRight() {
int w = device().getDisplayWidth();
int h = device().getDisplayHeight();
device().swipe(w - 5, h / 2, w / 2, h / 2, 10);
}

public boolean isDebug() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void switchToTabBasedApp_SwitchTab() throws Exception {
public void switchToTabsWithSideMenu() throws Exception {
elementByText("SWITCH TO APP WITH SIDE MENUS").click();
assertExists(By.textStartsWith("This is a side menu center screen tab 1"));
swipeOpenLeftSideMenu();
swipeOpenFromLeft();
assertExists(By.text("This is a left side menu screen"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class TopTabsTest extends BaseTest {
public void tabsCanBeSwiped() throws Exception {
elementByText("PUSH TOP TABS SCREEN").click();
assertExists(By.text("This is top tab 1"));
device().swipe(400, 400, 10, 400, 2);
swipeOpenFromRight();
assertExists(By.text("This is top tab 2"));
}
}
4 changes: 3 additions & 1 deletion AndroidE2E/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -14,6 +15,7 @@ buildscript {

allprojects {
repositories {
google()
mavenLocal()
jcenter()
mavenCentral()
Expand Down
4 changes: 2 additions & 2 deletions AndroidE2E/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Mon Jan 01 12:06:42 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
2 changes: 1 addition & 1 deletion lib/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies {
// tests
testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:3.5.1'
testImplementation 'org.assertj:assertj-core:2.8.0'
testImplementation 'org.assertj:assertj-core:3.8.0'
testImplementation 'com.squareup.assertj:assertj-android:1.1.1'
testImplementation 'org.mockito:mockito-core:2.12.0'
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"eslint-config-xo": "0.18.x",
"eslint-config-xo-react": "0.13.x",
"eslint-plugin-react": "7.x.x",
"jest": "21.x.x",
"jest": "22.x.x",
"jsdoc": "3.x.x",
"jsdoc-to-markdown": "3.x.x",
"mocha": "4.x.x",
Expand Down