Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3528: Setup Infrastructure to test using local dev server #3529

Merged
merged 82 commits into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
b720222
Introducing UiAutomator
FareesHussain Jul 15, 2021
f90cbfc
Using 23 api level
FareesHussain Jul 15, 2021
930abe0
some local tweaks
FareesHussain Jul 16, 2021
bb6f5bb
Updated implementation based on adb commands
FareesHussain Jul 20, 2021
46a1b56
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
FareesHussain Jul 20, 2021
44f4003
Nit fixes
FareesHussain Jul 20, 2021
72620a2
Nit fixes
FareesHussain Jul 20, 2021
7a384c3
Merge branch 'setup-uiautomator' of https://github.com/FareesHussain/…
FareesHussain Jul 22, 2021
8a641d7
Requested changes
FareesHussain Jul 22, 2021
c58b6f6
fix class name
FareesHussain Jul 22, 2021
09c419e
update dependencies
FareesHussain Jul 22, 2021
311ee0e
init OppiaTestApplication.kt and TestApplicationComponent.kt
FareesHussain Jul 23, 2021
f6177e6
updated manifest
FareesHussain Jul 23, 2021
959e9d3
Nit fixes
FareesHussain Jul 24, 2021
004e3a1
Nit fixes
FareesHussain Jul 24, 2021
34e28c3
Using seperate Manifest for Test Application and instrumentation tests
FareesHussain Jul 26, 2021
7e42acf
bazel lint check
FareesHussain Jul 26, 2021
3eb2c75
Nit fix
FareesHussain Jul 26, 2021
7a1221d
Requested changes
FareesHussain Jul 30, 2021
0aec4a5
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
FareesHussain Jul 30, 2021
6e09966
updated maven_install
FareesHussain Jul 30, 2021
4486882
Nit fix
FareesHussain Jul 30, 2021
f64d32c
Add CODEOWNERS
FareesHussain Jul 30, 2021
dc66ba2
Added KDoc
FareesHussain Jul 30, 2021
c233b71
NIT
FareesHussain Jul 30, 2021
2044979
Added comments
FareesHussain Jul 30, 2021
7ac1ac5
Added oppia_instrumentation_test.bzl
FareesHussain Jul 31, 2021
3bb5348
added exempted_file_path
FareesHussain Jul 31, 2021
0f4ce65
Merge branch 'setup-uiautomator' of https://github.com/FareesHussain/…
FareesHussain Jul 31, 2021
b3ce32b
changed to EndToEndTest modules
FareesHussain Jul 31, 2021
68337d8
added exempted_file_paths
FareesHussain Jul 31, 2021
ec63ede
addded usesClearTextTraffix to reference the localhost
FareesHussain Jul 31, 2021
e5a6128
Helper utility shifted to testing module
FareesHussain Aug 4, 2021
425ebfa
NIT
FareesHussain Aug 4, 2021
067537f
NIT
FareesHussain Aug 4, 2021
b9233c6
deleted the previous utility
FareesHussain Aug 4, 2021
37b10e2
ignoring instrumentation in ComputeAffectedTests.kt
FareesHussain Aug 5, 2021
3c1e79f
NIT
FareesHussain Aug 5, 2021
44363c1
NIT
FareesHussain Aug 5, 2021
e95d29f
NIT
FareesHussain Aug 6, 2021
c608f7c
changed startsWith("instrumentation/")
FareesHussain Aug 6, 2021
66f6b51
filtered bazel targets
FareesHussain Aug 6, 2021
6514ba9
NIT
FareesHussain Aug 6, 2021
e81706b
NIT
FareesHussain Aug 6, 2021
a4266e4
filtering the instrumentation from the total affected targets
FareesHussain Aug 6, 2021
6f2836c
NIT
FareesHussain Aug 6, 2021
3660243
changed directory to javatests
FareesHussain Aug 10, 2021
d4aa4d4
NIT
FareesHussain Aug 10, 2021
41ea23f
NIT
FareesHussain Aug 10, 2021
b15451b
fixed scripts
FareesHussain Aug 11, 2021
73c650e
NIT
FareesHussain Aug 11, 2021
970d506
Merge branch 'setup-uiautomator' of https://github.com/FareesHussain/…
FareesHussain Aug 11, 2021
fd7bb06
Updated and NIT
FareesHussain Aug 11, 2021
7cd778c
Added tests for modules
FareesHussain Aug 12, 2021
2bb7076
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
FareesHussain Aug 12, 2021
084624e
updated testfile exemptions
FareesHussain Aug 12, 2021
0d50914
updated the ComputedAffectedTests
FareesHussain Aug 13, 2021
e2db957
ignoring player directory
FareesHussain Aug 13, 2021
31ac93b
Created NetworkConfigModule.kt
FareesHussain Aug 13, 2021
b12b8cc
Fixed CI failures
FareesHussain Aug 13, 2021
5721b87
NIT
FareesHussain Aug 13, 2021
018909b
Merge branch 'setup-uiautomator' of https://github.com/FareesHussain/…
FareesHussain Aug 14, 2021
e455076
Requested changes
FareesHussain Aug 14, 2021
81850b4
NIT
FareesHussain Aug 14, 2021
f44b9b2
NIT
FareesHussain Aug 14, 2021
70c1ba0
NIT
FareesHussain Aug 15, 2021
cd8361f
Added kdoc
FareesHussain Aug 16, 2021
84d3dd4
NIT
FareesHussain Aug 16, 2021
25bf74e
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
FareesHussain Aug 16, 2021
e7e979e
updated tests
FareesHussain Aug 17, 2021
48266ad
NIT
FareesHussain Aug 17, 2021
77b45a7
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
FareesHussain Aug 17, 2021
231760f
updated computedAffectedTEsts
FareesHussain Aug 17, 2021
db7c7b3
fix OppiaTestApplication
FareesHussain Aug 17, 2021
76646c1
updated failing tests
FareesHussain Aug 18, 2021
b6b4d7e
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
FareesHussain Aug 18, 2021
505532a
updated ComputeAffectedTestsTest
FareesHussain Aug 18, 2021
a4d3190
added TestBazelWorkspace tests
FareesHussain Aug 19, 2021
8989986
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
FareesHussain Aug 19, 2021
3a63e8a
fixed tests
FareesHussain Aug 19, 2021
ca6ff21
updated test_manifest
FareesHussain Aug 19, 2021
72bc501
fixed confict test
FareesHussain Aug 19, 2021
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
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ package_group(
"//app/...",
"//data/...",
"//domain/...",
"//instrumentation/...",
"//testing/...",
"//utility/...",
],
Expand Down
38 changes: 38 additions & 0 deletions instrumentation/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""
This library contains all android_binary targets to each test suite in instrumentation module.
Note that:
- All the android_binaries are named similar to the respective class name of the test suite.
"""

# Used for end to end tests
android_binary(
name = "oppia_test",
testonly = True,
custom_package = "org.oppia.android",
enable_data_binding = True,
manifest = "src/java/AndroidManifest.xml",
manifest_values = {
"applicationId": "org.oppia.android",
"minSdkVersion": "19",
"targetSdkVersion": "29",
"versionCode": "0",
"versionName": "0.1-alpha",
},
multidex = "native",
visibility = ["//:oppia_testing_visibility"],
deps = [
"//app",
"//instrumentation/src/java/org/oppia/android/instrumentation:oppia_test_application",
],
)

android_binary(
name = "ExplorationPlayerTest",
testonly = True,
custom_package = "org.oppia.android",
instruments = "//:oppia_test",
manifest = "src/javatest/AndroidManifest.xml",
deps = [
"//instrumentation/src/javatest/org/oppia/android/instrumentation:exploration_player_test_lib",
],
)
226 changes: 226 additions & 0 deletions instrumentation/src/java/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
<?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="org.oppia.android">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- TODO(#56): Reenable landscape support. -->
<application
android:name=".instrumentation.OppiaTestApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
tools:replace="android:name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/OppiaTheme">
<meta-data
android:name="firebase_analytics_collection_deactivated"
android:value="true" />
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />
<meta-data
android:name="automatic_app_expiration_enabled"
android:value="false" />
<meta-data android:name="expiration_date"
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
android:value="2020-09-01" />

<activity
android:name=".app.administratorcontrols.AdministratorControlsActivity"
anandwana001 marked this conversation as resolved.
Show resolved Hide resolved
android:label="@string/administrator_controls_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.administratorcontrols.appversion.AppVersionActivity"
android:label="@string/app_version_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.completedstorylist.CompletedStoryListActivity"
android:label="@string/completed_story_list_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.help.faq.FAQListActivity"
android:label="@string/faq_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.help.faq.faqsingle.FAQSingleActivity"
android:label="@string/faq_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.help.HelpActivity"
android:label="@string/help_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.home.HomeActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.home.recentlyplayed.RecentlyPlayedActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.mydownloads.MyDownloadsActivity"
android:screenOrientation="portrait"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.onboarding.OnboardingActivity"
android:label="@string/onboarding_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.ongoingtopiclist.OngoingTopicListActivity"
android:label="@string/ongoing_topic_list_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.options.AppLanguageActivity"
android:label="@string/app_language_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.options.AudioLanguageActivity"
android:label="@string/audio_language_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.options.OptionsActivity"
android:label="@string/options_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.options.ReadingTextSizeActivity"
android:label="@string/reading_text_size_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.player.exploration.ExplorationActivity"
android:label="@string/exploration_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar"
android:windowSoftInputMode="adjustResize" />
<activity android:name=".app.player.state.testing.StateFragmentTestActivity" />
<activity
android:name=".app.profile.AddProfileActivity"
android:label="@string/add_profile_activity_label"
android:theme="@style/OppiaThemeNoActionBarColorAccentColorPrimary" />
<activity
android:name=".app.profile.AdminAuthActivity"
android:label="@string/admin_auth_activity_access_controls_title"
android:theme="@style/OppiaThemeWithoutActionBar"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".app.profile.AdminPinActivity"
android:label="@string/admin_pin_activity_title"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".app.profile.PinPasswordActivity"
android:label="@string/pin_password_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".app.profile.ProfileChooserActivity"
android:label="@string/profile_chooser_activity_label"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.profileprogress.ProfilePictureActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.profileprogress.ProfileProgressActivity"
android:label="@string/profile_progress_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.settings.profile.ProfileEditActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.settings.profile.ProfileListActivity"
android:label="@string/profile_list_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.settings.profile.ProfileRenameActivity"
android:label="@string/profile_rename_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.settings.profile.ProfileResetPinActivity"
android:label="@string/profile_reset_pin_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.splash.SplashActivity"
android:screenOrientation="portrait"
android:theme="@style/SplashScreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".app.story.StoryActivity"
android:label="@string/story_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity android:name=".app.testing.AudioFragmentTestActivity" />
<activity android:name=".app.testing.BindableAdapterTestActivity" />
<activity android:name=".app.testing.ConceptCardFragmentTestActivity" />
<activity android:name=".app.testing.DragDropTestActivity" />
<activity android:name=".app.testing.ExplorationInjectionActivity" />
<activity android:name=".app.testing.ExplorationTestActivity" />
<activity
android:name=".app.testing.TestFontScaleConfigurationUtilActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity android:name=".app.testing.HomeFragmentTestActivity" />
<activity android:name=".app.testing.HtmlParserTestActivity" />
<activity android:name=".app.testing.HomeTestActivity" />
<activity android:name=".app.testing.InputInteractionViewTestActivity" />
<activity android:name=".app.testing.ImageRegionSelectionTestActivity" />
<activity
android:name=".app.testing.NavigationDrawerTestActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.testing.ProfileChooserFragmentTestActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.testing.TopicTestActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.testing.TopicTestActivityForStory"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity android:name=".app.testing.TopicRevisionTestActivity" />
<activity
android:name=".app.topic.questionplayer.QuestionPlayerActivity"
android:label="@string/question_player_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.topic.revisioncard.RevisionCardActivity"
android:label="@string/revision_card_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity android:name=".app.testing.SplashTestActivity" />
<activity
android:name=".app.topic.TopicActivity"
android:label="@string/topic_page"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.walkthrough.WalkthroughActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity android:name=".app.testing.LessonThumbnailImageViewTestActivity" />
<activity
android:name=".app.devoptions.DeveloperOptionsActivity"
android:label="@string/developer_options_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.devoptions.markchapterscompleted.MarkChaptersCompletedActivity"
android:label="@string/mark_chapters_completed_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.devoptions.markstoriescompleted.MarkStoriesCompletedActivity"
android:label="@string/mark_stories_completed_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.devoptions.marktopicscompleted.MarkTopicsCompletedActivity"
android:label="@string/mark_topics_completed_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.devoptions.vieweventlogs.ViewEventLogsActivity"
android:label="@string/view_event_logs_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />

<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
android:exported="false"
tools:node="remove" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
load("@dagger//:workspace_defs.bzl", "dagger_rules")
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library")

kt_android_library(
name = "oppia_test_application",
testonly = True,
srcs = [
"OppiaTestApplication.kt",
"TestApplicationComponent.kt",
"TestGcsResourceModule.kt",
"TestImageParsingModule.kt",
"TestNetworkModule.kt",
],
visibility = ["//:oppia_testing_visibility"],
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
deps = [
":dagger",
"//app",
"//domain",
"//utility",
"//utility/src/main/java/org/oppia/android/util/caching:caching_module",
],
)

dagger_rules()
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package org.oppia.android.instrumentation

import android.app.Application
import androidx.appcompat.app.AppCompatActivity
import androidx.multidex.MultiDexApplication
import androidx.work.Configuration
import androidx.work.WorkManager
import com.google.firebase.FirebaseApp
import org.oppia.android.app.activity.ActivityComponent
import org.oppia.android.app.application.ActivityComponentFactory
import org.oppia.android.app.application.ApplicationInjector
import org.oppia.android.app.application.ApplicationInjectorProvider
import org.oppia.android.domain.oppialogger.ApplicationStartupListener

/** The root [Application] of the Oppia app. */
anandwana001 marked this conversation as resolved.
Show resolved Hide resolved
class OppiaTestApplication :
MultiDexApplication(),
ActivityComponentFactory,
ApplicationInjectorProvider,
Configuration.Provider {
private val component: TestApplicationComponent by lazy {
DaggerTestApplicationComponent.builder()
.setApplication(this)
.build()
}

override fun createActivityComponent(activity: AppCompatActivity): ActivityComponent {
return component.getActivityComponentBuilderProvider().get().setActivity(activity).build()
}

override fun onCreate() {
super.onCreate()
FirebaseApp.initializeApp(applicationContext)
WorkManager.initialize(applicationContext, workManagerConfiguration)
component.getApplicationStartupListeners().forEach(ApplicationStartupListener::onCreate)
}

override fun getApplicationInjector(): ApplicationInjector = component

override fun getWorkManagerConfiguration(): Configuration {
return component.getWorkManagerConfiguration()
}
}
Loading