-
Notifications
You must be signed in to change notification settings - Fork 528
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 part of #3602: Add label for all non-test activities for Profile Edit Activity #4783
Closed
deonwaju
wants to merge
33
commits into
oppia:develop
from
deonwaju:add-label-to-profile-edit-activity
Closed
Changes from 12 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
783b29b
added label to profile edit activity
deonwaju 3832b7d
added label to profile edit activity
deonwaju ac21080
added label to profile edit activity
deonwaju 7efd9bb
added label to profile edit activity
deonwaju 5e2f6b6
Merge branch 'develop' into add-label-to-profile-edit-activity
deonwaju 40d5aca
added changes from review
deonwaju f9a06dd
Merge remote-tracking branch 'origin/add-label-to-profile-edit-activi…
deonwaju 06acd7c
removed model/build.gradle from being tracked
deonwaju 3918851
removed .gitignore from being tracked
deonwaju f24589c
added back .gitignore and model/build.gradle files i untracked, after…
deonwaju b7ea5e5
removed strings in other languages except english, added test like in…
deonwaju 6a9f3fa
removed strings in other languages except english, added test like in…
deonwaju 433c4e6
Fixes #4712: Ensure CoordinatorLayout Behaviors are not renamed/remov…
BenHenning 0483a72
Localisation updates from https://translatewiki.net. (#4733)
translatewiki 7634f1e
Fix #4645: "Continue Studying" texts keeps showing even when there is…
JishnuGoyal e7d5fcb
Fix #4709: Revert "Fix #2581: Marquee auto restart issue (#4392)" (#4…
BenHenning ff10c4f
Update version codes to prepare for RC02 of Beta MR2 (#4745)
BenHenning b1e1bcc
Fix #4746: Update app to target SDK 31 (#4747)
BenHenning b5f3ab3
Fix #4445: Add scaling animation for Continue button (#4568)
JishnuGoyal 62fb0e3
Localisation updates from https://translatewiki.net. (#4753)
translatewiki 3896d85
Fix #2546: Rename OngoingStory to PromotedStory (#4704)
adhiamboperes fa39d88
fixed merge conflict
deonwaju d54fe33
Fix #4750: Fixes SDK 31 support (#4752)
BenHenning 1b9bb14
Fix #4756: Add support for logging an invested engagement event (#4757)
BenHenning 5d789ee
Fix #4764: Spotlight overlays have some UI issues (#4763)
JishnuGoyal 6f8757a
Localisation updates from https://translatewiki.net. (#4761)
translatewiki df1cf78
Fixed Hints & Solution and Concept Card Dark Mode (#4779)
MohitGupta121 cbb4606
Fix #4775: SpotlightFragmentTest is very flaky (#4780)
JishnuGoyal 27801bc
removed model/build.gradle from being tracked
deonwaju 99905f4
removed .gitignore from being tracked
deonwaju db2f602
added back .gitignore and model/build.gradle files i untracked, after…
deonwaju 83cf1e5
removed strings in other languages except english, added test like in…
deonwaju 1c96913
Merge branch 'add-label-to-profile-edit-activity' of https://github.c…
deonwaju File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
179 changes: 179 additions & 0 deletions
179
app/src/sharedTest/java/org/oppia/android/app/options/ProfileEditActivityTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
package org.oppia.android.app.options | ||
|
||
import android.app.Application | ||
import android.content.Context | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.test.core.app.ApplicationProvider | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.rule.ActivityTestRule | ||
import com.google.common.truth.Truth.assertThat | ||
import dagger.Component | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.oppia.android.app.model.ReadingTextSize.MEDIUM_TEXT_SIZE | ||
import org.oppia.android.app.model.ScreenName | ||
import org.oppia.android.data.backends.gae.NetworkConfigProdModule | ||
import org.oppia.android.data.backends.gae.NetworkModule | ||
import org.oppia.android.domain.classify.InteractionsModule | ||
import org.oppia.android.domain.classify.rules.algebraicexpressioninput.AlgebraicExpressionInputModule | ||
import org.oppia.android.domain.classify.rules.continueinteraction.ContinueModule | ||
import org.oppia.android.domain.classify.rules.dragAndDropSortInput.DragDropSortInputModule | ||
import org.oppia.android.domain.classify.rules.fractioninput.FractionInputModule | ||
import org.oppia.android.domain.classify.rules.imageClickInput.ImageClickInputModule | ||
import org.oppia.android.domain.classify.rules.itemselectioninput.ItemSelectionInputModule | ||
import org.oppia.android.domain.classify.rules.mathequationinput.MathEquationInputModule | ||
import org.oppia.android.domain.classify.rules.multiplechoiceinput.MultipleChoiceInputModule | ||
import org.oppia.android.domain.classify.rules.numberwithunits.NumberWithUnitsRuleModule | ||
import org.oppia.android.domain.classify.rules.numericexpressioninput.NumericExpressionInputModule | ||
import org.oppia.android.domain.classify.rules.numericinput.NumericInputRuleModule | ||
import org.oppia.android.domain.classify.rules.ratioinput.RatioInputModule | ||
import org.oppia.android.domain.classify.rules.textinput.TextInputRuleModule | ||
import org.oppia.android.domain.exploration.ExplorationStorageModule | ||
import org.oppia.android.domain.hintsandsolution.HintsAndSolutionConfigModule | ||
import org.oppia.android.domain.hintsandsolution.HintsAndSolutionProdModule | ||
import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule | ||
import org.oppia.android.domain.oppialogger.LogStorageModule | ||
import org.oppia.android.domain.oppialogger.LoggingIdentifierModule | ||
import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule | ||
import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule | ||
import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule | ||
import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule | ||
import org.oppia.android.domain.platformparameter.PlatformParameterModule | ||
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule | ||
import org.oppia.android.domain.question.QuestionModule | ||
import org.oppia.android.domain.topic.PrimeTopicAssetsControllerModule | ||
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule | ||
import org.oppia.android.testing.OppiaTestRule | ||
import org.oppia.android.testing.TestLogReportingModule | ||
import org.oppia.android.testing.junit.InitializeDefaultLocaleRule | ||
import org.oppia.android.testing.robolectric.RobolectricModule | ||
import org.oppia.android.testing.threading.TestDispatcherModule | ||
import org.oppia.android.testing.time.FakeOppiaClockModule | ||
import org.oppia.android.util.accessibility.AccessibilityTestModule | ||
import org.oppia.android.util.caching.AssetModule | ||
import org.oppia.android.util.caching.testing.CachingTestModule | ||
import org.oppia.android.util.gcsresource.GcsResourceModule | ||
import org.oppia.android.util.locale.LocaleProdModule | ||
import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName | ||
import org.oppia.android.util.logging.EventLoggingConfigurationModule | ||
import org.oppia.android.util.logging.LoggerModule | ||
import org.oppia.android.util.logging.SyncStatusModule | ||
import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule | ||
import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule | ||
import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule | ||
import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule | ||
import org.oppia.android.util.parser.image.GlideImageLoaderModule | ||
import org.oppia.android.util.parser.image.ImageParsingModule | ||
import org.robolectric.annotation.Config | ||
import org.robolectric.annotation.LooperMode | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
/** Tests for [ProfileEditActivityTest]. */ | ||
@RunWith(AndroidJUnit4::class) | ||
@LooperMode(LooperMode.Mode.PAUSED) | ||
@Config( | ||
application = ProfileEditActivityTest.TestApplication::class, | ||
qualifiers = "port-xxhdpi" | ||
) | ||
class ProfileEditActivityTest { | ||
@get:Rule | ||
val initializeDefaultLocaleRule = InitializeDefaultLocaleRule() | ||
|
||
@get:Rule | ||
val oppiaTestRule = OppiaTestRule() | ||
|
||
@get:Rule | ||
val activityTestRule: ActivityTestRule<ProfileEditActivityTest> = ActivityTestRule( | ||
ProfileEditActivityTest::class.java, /* initialTouchMode= */ true, /* launchActivity= */ false | ||
) | ||
|
||
@Inject lateinit var context: Context | ||
|
||
@Before | ||
fun setUp() { | ||
setUpTestApplicationComponent() | ||
} | ||
|
||
private fun setUpTestApplicationComponent() { | ||
ApplicationProvider.getApplicationContext<TestApplication>().inject(this) | ||
} | ||
|
||
@Test | ||
fun testActivity_createIntent_verifyScreenNameInIntent() { | ||
val screenName = createProfileEditActivityTestIntent().extractCurrentAppScreenName() | ||
|
||
assertThat(screenName).isEqualTo(ScreenName.READING_TEXT_SIZE_ACTIVITY) | ||
} | ||
|
||
@Test | ||
fun testProfileEditActivityTest_hasCorrectActivityLabel() { | ||
activityTestRule.launchActivity(createProfileEditActivityTestIntent()) | ||
|
||
val title = activityTestRule.activity.title | ||
// Verify that the activity label is correct as a proxy to verify TalkBack will announce the | ||
// correct string when it's read out. | ||
assertThat(title).isEqualTo(context.getString(R.string.reading_text_size_activity_title)) | ||
} | ||
|
||
private fun createProfileEditActivityTestIntent() = | ||
ProfileEditActivityTest.createProfileEditActivityTestIntent(context, MEDIUM_TEXT_SIZE) | ||
|
||
// TODO(#59): Figure out a way to reuse modules instead of needing to re-declare them. | ||
@Singleton | ||
@Component( | ||
modules = [ | ||
RobolectricModule::class, | ||
PlatformParameterModule::class, PlatformParameterSingletonModule::class, | ||
TestDispatcherModule::class, ApplicationModule::class, | ||
LoggerModule::class, ContinueModule::class, FractionInputModule::class, | ||
ItemSelectionInputModule::class, MultipleChoiceInputModule::class, | ||
NumberWithUnitsRuleModule::class, NumericInputRuleModule::class, TextInputRuleModule::class, | ||
DragDropSortInputModule::class, ImageClickInputModule::class, InteractionsModule::class, | ||
GcsResourceModule::class, GlideImageLoaderModule::class, ImageParsingModule::class, | ||
HtmlParserEntityTypeModule::class, QuestionModule::class, TestLogReportingModule::class, | ||
AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, | ||
PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, | ||
ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, | ||
ApplicationStartupListenerModule::class, LogReportWorkerModule::class, | ||
HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, | ||
FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, | ||
DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, | ||
ExplorationStorageModule::class, NetworkModule::class, NetworkConfigProdModule::class, | ||
NetworkConnectionUtilDebugModule::class, NetworkConnectionDebugUtilModule::class, | ||
AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, | ||
NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, | ||
MathEquationInputModule::class, SplitScreenInteractionModule::class, | ||
LoggingIdentifierModule::class, ApplicationLifecycleModule::class, | ||
SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, | ||
EventLoggingConfigurationModule::class, ActivityRouterModule::class, | ||
CpuPerformanceSnapshotterModule::class | ||
] | ||
) | ||
interface TestApplicationComponent : ApplicationComponent { | ||
@Component.Builder | ||
interface Builder : ApplicationComponent.Builder | ||
|
||
fun inject(profileEditActivityTest: ProfileEditActivityTest) | ||
} | ||
|
||
class TestApplication : Application(), ActivityComponentFactory, ApplicationInjectorProvider { | ||
private val component: TestApplicationComponent by lazy { | ||
DaggerProfileEditActivityTest_TestApplicationComponent.builder() | ||
.setApplication(this) | ||
.build() as TestApplicationComponent | ||
} | ||
|
||
fun inject(profileEditActivityTest: ProfileEditActivityTest) { | ||
component.inject(profileEditActivityTest) | ||
} | ||
|
||
override fun createActivityComponent(activity: AppCompatActivity): ActivityComponent { | ||
return component.getActivityComponentBuilderProvider().get().setActivity(activity).build() | ||
} | ||
|
||
override fun getApplicationInjector(): ApplicationInjector = component | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deonwaju I think there is no need of commiting this file.
I'm right @rt4914 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, Thought @rt4914 said write tests like Please add test similar to in ProfileEditActivity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay @deonwaju Thanks for clearing. Yes then we need this file.