Skip to content

Commit

Permalink
Fixes, dependencies.gradle added
Browse files Browse the repository at this point in the history
  • Loading branch information
eakurnikov committed Mar 14, 2019
1 parent 0e57454 commit 6ef03f1
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 83 deletions.
19 changes: 9 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.11'
apply from : 'dependencies.gradle'

repositories {
maven { url pInternalRepositoryUrl= }
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
dependencies {
classpath "com.android.tools.build:gradle:$versions.androidPlugin"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin"
}
}

Expand All @@ -22,12 +19,14 @@ allprojects {
google()
jcenter()
}

configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.startsWith('multidex')) {
details.useVersion pAndroidSupportVersion
&& !details.requested.name.startsWith('multidex')
) {
details.useVersion versions.androidSupport
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ext.versions = [
minSdk : "14",
compileSdk : "27",
targetSdk : "27",
buildTools : "28.0.3",

kotlin : "1.3.21",
androidPlugin : "3.2.1",
androidSupport: "27.1.1",
junit : "4.12",
retrofit : "2.5.0",
runner : "1.0.2",
espresso : "3.0.2",
uiautomator : "2.1.3",
spoon : "1.7.1"
]
12 changes: 1 addition & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,4 @@ org.gradle.jvmargs=-Xmx1536m
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official

pUiFrameworkMajor = 1
pUiFrameworkMinor = 0
pUiFrameworkBuild = 0
pPublish = false

pMinSdkVersion=14
pBuildToolsVersion=28.0.3
pAndroidSupportVersion=27.1.1
pTargetSdkVersion=27

pInternalRepositoryUrl=
pInternalRepositoryUrl= = http://mobile.avp.ru:8081/repository/internal/
36 changes: 17 additions & 19 deletions uitest_framework/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
apply plugin: 'com.android.library'

apply plugin: 'maven'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply from: '../dependencies.gradle'

android {
compileSdkVersion Integer.parseInt(pTargetSdkVersion)
buildToolsVersion pBuildToolsVersion
compileSdkVersion Integer.parseInt(versions.compileSdk)
buildToolsVersion versions.buildTools

defaultConfig {
minSdkVersion pMinSdkVersion
targetSdkVersion pTargetSdkVersion
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
versionName "$pUiFrameworkMajor.$pUiFrameworkMinor.$pUiFrameworkBuild"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -29,18 +27,18 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation "com.android.support:design:${pAndroidSupportVersion}"
testImplementation 'junit:junit:4.12'
implementation 'com.android.support.test:runner:1.0.2'
implementation 'com.android.support.test.espresso:espresso-web:3.0.2'
implementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
implementation 'com.android.support.test.espresso:espresso-intents:3.0.2'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21"
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.21"
implementation 'com.squareup.spoon:spoon-client:1.7.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin"
implementation "org.jetbrains.kotlin:kotlin-reflect:$versions.kotlin"
implementation "com.android.support:design:$versions.androidSupport"
testImplementation "junit:junit:$versions.junit"
implementation "com.squareup.retrofit2:retrofit:$versions.retrofit"
implementation "com.android.support.test:runner:$versions.runner"
implementation "com.android.support.test.espresso:espresso-web:$versions.espresso"
implementation "com.android.support.test.espresso:espresso-core:$versions.espresso"
implementation "com.android.support.test.espresso:espresso-contrib:$versions.espresso"
implementation "com.android.support.test.espresso:espresso-intents:$versions.espresso"
implementation "com.android.support.test.uiautomator:uiautomator-v18:$versions.uiautomator"
implementation "com.squareup.spoon:spoon-client:$versions.spoon"
}

if (pPublish.toBoolean()) {
Expand Down
8 changes: 1 addition & 7 deletions uitest_framework/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,5 @@ kotlin.code.style=official
pUiFrameworkMajor = 1
pUiFrameworkMinor = 0
pUiFrameworkBuild = 0
pPublish = false

pMinSdkVersion=14
pBuildToolsVersion=28.0.3
pAndroidSupportVersion=28.0.0
pTargetSdkVersion=27

pInternalRepositoryUrl=
pPublish = false
27 changes: 0 additions & 27 deletions uitest_framework/src/gradle.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class ActivitiesManager {
get() = Looper.myLooper() == Looper.getMainLooper()

inline fun <reified T : Activity> assertCurrentActivity() {

UiThreadStatement.runOnUiThread {
Assert.assertThat(
getResumedActivity(),
Expand All @@ -29,7 +28,6 @@ class ActivitiesManager {
}

fun getResumedActivity(): Activity? {

var resumedActivity: Activity? = null

val findResumedActivity = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class AppsManager(
fun openUrlInChrome(url: String) = launchApp(CHROME_PACKAGE_NAME, Uri.parse(url))

fun launchApp(packageName: String, data: Uri? = null) {

val intent = context.packageManager
.getLaunchIntentForPackage(packageName)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
Expand All @@ -63,11 +62,9 @@ class AppsManager(
}

fun openRecentApp(contentDescription: String) {

device.pressRecentApps()

val appSelector = UiSelector().descriptionContains(contentDescription)

val recentApp = device.findObject(appSelector)

Thread.sleep(1_000)
Expand All @@ -80,7 +77,6 @@ class AppsManager(
}

fun killApp(packageName: String = context.packageName) {

Runtime.getRuntime().exec(arrayOf("am", "force-stop", packageName))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ object Device {
* Available since api 24
*/
@TargetApi(Build.VERSION_CODES.N)
fun enableAccessibility(packageName: String, className: String) {
fun enableAccessibility(
packageName: String,
className: String = "com.kaspersky.components.accessibility.KasperskyAccessibility"
) {
val string = "enabled_accessibility_services"
val cmd = "settings put secure $string $packageName/$className"

Expand All @@ -84,7 +87,6 @@ object Device {

@SuppressLint("WifiManagerLeak")
fun toggleWiFi(enable: Boolean) {

val wifiManager =
if (isSdkVersionHigherThan(Build.VERSION_CODES.N)) {
InstrumentationRegistry.getTargetContext()
Expand Down Expand Up @@ -124,7 +126,6 @@ object Device {
}

fun pressBack(failTestIfAppUnderTestClosed: Boolean = false) {

if (failTestIfAppUnderTestClosed) {
Espresso.pressBack()
} else {
Expand Down

0 comments on commit 6ef03f1

Please sign in to comment.