Skip to content

Commit

Permalink
NT-2124: Shot 5.11.0 library integration (#1324)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkariang committed Jul 19, 2021
1 parent 1fb18b6 commit 08c2c19
Show file tree
Hide file tree
Showing 22 changed files with 65 additions and 177 deletions.
24 changes: 9 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ android {
applicationId "com.kickstarter"
minSdkVersion 23
targetSdkVersion 30
testApplicationId "com.kickstarter.kickstarter.regression.test"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "com.karumi.shot.ShotTestRunner"

buildConfigField "String", "GIT_SHA", "\"${commitSha()}\""
buildConfigField "String", "BUILD_DATE", "\"${buildDate()}\""
Expand Down Expand Up @@ -172,12 +171,6 @@ android {
versionCode externalPrivateVersion
versionName externalPublicVersion
}
regression {
dimension "AUDIENCE"
applicationId "com.kickstarter.kickstarter.regression"
versionCode externalPrivateVersion
versionName externalPublicVersion
}
}

compileOptions {
Expand All @@ -203,13 +196,8 @@ android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'LICENSE.txt'
}

sourceSets {
regression {
androidTest.java.srcDirs = ['src/androidTestRegressionDebug/kotlin']
}
main.java.srcDirs += 'src/main/kotlin'
exclude 'META-INF/AL2.0'
exclude 'META-INF/LGPL2.1'
}

testOptions {
Expand Down Expand Up @@ -240,6 +228,7 @@ buildscript {
}
dependencies {
classpath 'com.apollographql.apollo:apollo-gradle-plugin:2.3.0'
classpath 'com.karumi:shot:5.11.0'
}
}

Expand Down Expand Up @@ -381,3 +370,8 @@ gradle.taskGraph.beforeTask { Task task ->
}

apply plugin: 'com.google.gms.google-services'

apply plugin: 'shot'
shot {
runInstrumentation = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ package com.kickstarter
import androidx.annotation.NonNull
import com.apollographql.apollo.ApolloClient
import com.google.gson.Gson
import com.kickstarter.libs.ApiEndpoint
import com.kickstarter.libs.BuildCheck
import com.kickstarter.libs.InternalToolsType
import com.kickstarter.libs.NoopBuildCheck
import com.kickstarter.libs.NoopInternalTools
import com.kickstarter.mock.services.MockApiClient
import com.kickstarter.mock.services.MockApolloClient
import com.kickstarter.services.ApiClientType
Expand All @@ -13,7 +18,7 @@ import dagger.Provides
import javax.inject.Singleton

@Module(includes = [ApplicationModule::class])
class RegressionApplicationModule {
class AndroidTestApplicationModule {

@Provides
@Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import dagger.Component
import javax.inject.Singleton

@Singleton
@Component(modules = [RegressionApplicationModule::class])
@Component(modules = [AndroidTestApplicationModule::class])
interface ApplicationComponent : ApplicationGraph
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.kickstarter.screenshoot.testing.ui.components

import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.test.core.app.ApplicationProvider
import com.karumi.shot.ScreenshotTest
import com.kickstarter.KSApplication
import com.kickstarter.R
import com.kickstarter.mock.factories.UserFactory
import com.kickstarter.ui.views.CommentCard
import com.kickstarter.ui.views.CommentCardStatus
import org.joda.time.DateTime
import org.junit.Test

class CommentCardShotTest : ScreenshotTest {
private val context = ApplicationProvider.getApplicationContext<KSApplication>()

@Test
fun commentCardScreenshotTest_COMMENT_FOR_LOGIN_BACKED_USERS() {
var commentCard: CommentCard = (LayoutInflater.from(context).inflate(R.layout.item_comment_card, null) as ConstraintLayout)
.findViewById(R.id.comments_card_view)

val user = UserFactory.user()
commentCard.setAvatarUrl(null) // -> internal network call to picasso we need to extract that.
commentCard.setReplyButtonVisibility(true)
commentCard.setViewRepliesVisibility(true)
commentCard.setCommentUserName(user.name())
commentCard.setCommentBody("Message here for the Screenshot test lets see how it behaves ....")
commentCard.setCommentPostTime(DateTime.now().toString())

commentCard.setCommentCardStatus(CommentCardStatus.COMMENT_FOR_LOGIN_BACKED_USERS)
compareScreenshot(commentCard)
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 13 additions & 0 deletions app/src/internalDebug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.kickstarter"
android:sharedUserId="com.kickstarter">

<!-- Strip away maxSdkVersion -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:remove="android:maxSdkVersion"/>

<!-- Add the permission with no maxSdkVersion defined -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
</manifest>
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.kickstarter">
package="com.kickstarter"
android:sharedUserId="com.kickstarter">
<!-- PERMISSIONS -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
Expand Down
2 changes: 0 additions & 2 deletions app/src/regression/AndroidManifest.xml

This file was deleted.

5 changes: 0 additions & 5 deletions app/src/regression/res/mipmap-anydpi-v26/ic_launcher.xml

This file was deleted.

Binary file not shown.
Binary file removed app/src/regression/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/regression/res/mipmap-xhdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/regression/res/mipmap-xxhdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
4 changes: 0 additions & 4 deletions app/src/regression/res/values/ic_launcher_background.xml

This file was deleted.

4 changes: 0 additions & 4 deletions app/src/regression/res/values/strings.xml

This file was deleted.

0 comments on commit 08c2c19

Please sign in to comment.