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

[RunAllTests] Fix part of #2787: Add support for proto lesson loading from local assets #2978

Merged
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5e33b02
Add support for loading proto versions of lessons.
BenHenning Mar 23, 2021
a3d5f4a
Upgrade Espresso versions to work around build issues.
BenHenning Mar 23, 2021
a017e09
Merge branch 'fix-protobuf-duplication-issue' into add-support-for-pr…
BenHenning Mar 23, 2021
1815e06
Lint fix post-copying from #2927.
BenHenning Mar 23, 2021
37547c9
Remove image loading annotation.
BenHenning Mar 23, 2021
b33ff7a
Add caching module to needed test suites.
BenHenning Mar 23, 2021
441e2ae
Add support for importing text protos as assets.
BenHenning Mar 24, 2021
927508b
Add gitignore for Android Studio Bazel plugin output.
BenHenning Mar 24, 2021
d39e926
Import textproto versions of existing dev assets.
BenHenning Mar 24, 2021
9079ab6
Undo Espresso version change since it breaks Bazel tests.
BenHenning Mar 24, 2021
be5b785
Fix tests.
BenHenning Mar 25, 2021
34333eb
Use correct Espresso core.
BenHenning Mar 25, 2021
a691bcf
Move coroutine dispatchers.
BenHenning Apr 3, 2021
8ab7437
Refactor testing utilities build graph.
BenHenning Apr 3, 2021
a78b59d
Introduce dedicated test for TestCoroutineDispatcher.
BenHenning Apr 6, 2021
1e138b9
Add tests for TestCoroutineDispatcher.
BenHenning Apr 8, 2021
797ff85
Merge branch 'develop' into add-coroutine-dispatcher-tests
BenHenning Apr 8, 2021
b45b212
Workaround ktlint semicolon issue.
BenHenning Apr 8, 2021
5db9e82
Lint fixes.
BenHenning Apr 8, 2021
236a4f0
Fix test post-merge.
BenHenning Apr 9, 2021
54dc9bc
Merge branch 'develop' into add-coroutine-dispatcher-tests
BenHenning Apr 9, 2021
dc8be26
Move CoroutineDispatcher to be part of threading.
BenHenning Apr 9, 2021
f2ef2b2
Lint fixes.
BenHenning Apr 9, 2021
12d42dc
Merge branch 'develop' into fix-protobuf-duplication-issue
BenHenning Apr 12, 2021
b0eb428
Undo version upgrade.
BenHenning Apr 12, 2021
138b83a
Merge branch 'fix-protobuf-duplication-issue' into add-support-for-pr…
BenHenning Apr 12, 2021
8601fde
Fix broken tests.
BenHenning Apr 12, 2021
7f6ba6d
Lint fixes.
BenHenning Apr 12, 2021
6aa8dbf
Add a bit more proto loading test coverage.
BenHenning Apr 12, 2021
b2a116b
Comment fix.
BenHenning Apr 12, 2021
c6fa23c
Lint fixes.
BenHenning Apr 12, 2021
3fae8d3
Address earlier TODO.
BenHenning Apr 13, 2021
522c9b6
Merge branch 'develop' into add-support-for-proto-lesson-loading-from…
BenHenning Apr 13, 2021
537ec36
Merge branch 'develop' into add-coroutine-dispatcher-tests
BenHenning Apr 13, 2021
4ab42a2
Fix broken test build.
BenHenning Apr 14, 2021
5ae75e4
Merge branch 'add-coroutine-dispatcher-tests' into add-support-for-pr…
BenHenning Apr 14, 2021
9e99d27
Merge branch 'develop' into add-coroutine-dispatcher-tests
BenHenning Apr 15, 2021
31f4f9b
Merge branch 'add-coroutine-dispatcher-tests' into add-support-for-pr…
BenHenning Apr 15, 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
6 changes: 6 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ bind(
actual = "//tools/android:compiler_annotation_processor",
)

http_archive(
name = "protobuf_tools",
strip_prefix = "protobuf-%s" % HTTP_DEPENDENCY_VERSIONS["protobuf_tools"]["version"],
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v{0}/protobuf-all-{0}.zip".format(HTTP_DEPENDENCY_VERSIONS["protobuf_tools"]["version"])],
)

load("@rules_jvm_external//:defs.bzl", "maven_install")

# Note to developers: new dependencies should be added to //third_party:versions.bzl, not here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.oppia.android.app.topic.TopicActivityPresenter
import org.oppia.android.app.topic.TopicFragment
import org.oppia.android.app.topic.questionplayer.QuestionPlayerActivity
import org.oppia.android.app.topic.revisioncard.RevisionCardActivity
import org.oppia.android.domain.topic.TEST_STORY_ID_1
import org.oppia.android.domain.topic.TEST_STORY_ID_0
import org.oppia.android.domain.topic.TEST_TOPIC_ID_0
import javax.inject.Inject

Expand All @@ -33,7 +33,7 @@ class TopicTestActivityForStory :
topicActivityPresenter.handleOnCreate(
internalProfileId = 0,
topicId = TEST_TOPIC_ID_0,
storyId = TEST_STORY_ID_1
storyId = TEST_STORY_ID_0
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,8 @@ class HomeActivityTest {
* # Logic for recommendation system
*
* We always recommend the next topic that all dependencies are completed for. If a topic with
* prerequisites is completed out-of-order (e.g. test topic 1 above) then we assume fractions is already done.
* In the same way, finishing test topic 2 means there's nothing else to recommend.
* prerequisites is completed out-of-order (e.g. test topic 1 above) then we assume fractions is
* already done. In the same way, finishing test topic 2 means there's nothing else to recommend.
*/
@Test
fun testHomeActivity_markStory0DonePlayStory1FirstTestTopic_playFractionsTopic_orderIsCorrect() {
Expand All @@ -513,7 +513,7 @@ class HomeActivityTest {
profileId = profileId1,
timestampOlderThanOneWeek = false
)
storyProgressTestHelper.markRecentlyPlayedTestTopic0Story1Exp1(
storyProgressTestHelper.markRecentlyPlayedTestTopic1Story0(
profileId = profileId1,
timestampOlderThanOneWeek = false
)
Expand All @@ -525,23 +525,23 @@ class HomeActivityTest {
targetViewId = R.id.recently_played_stories_text_view,
stringToMatch = context.getString(R.string.stories_for_you)
)
scrollToPositionOfPromotedList(position = 1)
scrollToPositionOfPromotedList(position = 0)
verifyTextOnPromotedListItemAtPosition(
itemPosition = 0,
targetViewId = R.id.topic_name_text_view,
stringToMatch = "Fractions"
stringToMatch = "Second Test Topic"
)
scrollToPositionOfPromotedList(position = 1)
verifyTextOnPromotedListItemAtPosition(
itemPosition = 1,
targetViewId = R.id.topic_name_text_view,
stringToMatch = "Ratios and Proportional Reasoning"
stringToMatch = "Fractions"
)
scrollToPositionOfPromotedList(position = 2)
verifyTextOnPromotedListItemAtPosition(
itemPosition = 2,
targetViewId = R.id.topic_name_text_view,
stringToMatch = "First Test Topic"
stringToMatch = "Ratios and Proportional Reasoning"
)
}
}
Expand Down Expand Up @@ -825,7 +825,7 @@ class HomeActivityTest {
verifyTextOnHomeListItemAtPosition(
itemPosition = 3,
targetViewId = R.id.lesson_count_text_view,
stringToMatch = "5 Lessons"
stringToMatch = "2 Lessons"
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerModule
import org.oppia.android.domain.oppialogger.loguploader.WorkManagerConfigurationModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.topic.PrimeTopicAssetsControllerModule
import org.oppia.android.domain.topic.TEST_EXPLORATION_ID_1
import org.oppia.android.domain.topic.TEST_STORY_ID_1
import org.oppia.android.domain.topic.TEST_EXPLORATION_ID_2
import org.oppia.android.domain.topic.TEST_STORY_ID_0
import org.oppia.android.domain.topic.TEST_TOPIC_ID_0
import org.oppia.android.testing.RobolectricModule
import org.oppia.android.testing.TestCoroutineDispatchers
Expand Down Expand Up @@ -115,7 +115,7 @@ class StoryActivityTest {
createStoryActivityIntent(
internalProfileId = internalProfileId,
topicId = TEST_TOPIC_ID_0,
storyId = TEST_STORY_ID_1
storyId = TEST_STORY_ID_0
)
)
val title = activityTestRule.activity.title
Expand All @@ -131,7 +131,7 @@ class StoryActivityTest {
createStoryActivityIntent(
internalProfileId = internalProfileId,
topicId = TEST_TOPIC_ID_0,
storyId = TEST_STORY_ID_1
storyId = TEST_STORY_ID_0
)
).use {
testCoroutineDispatchers.runCurrent()
Expand All @@ -153,7 +153,7 @@ class StoryActivityTest {
allOf(
hasExtra(
ExplorationActivity.EXPLORATION_ACTIVITY_EXPLORATION_ID_ARGUMENT_KEY,
TEST_EXPLORATION_ID_1
TEST_EXPLORATION_ID_2
),
hasComponent(ExplorationActivity::class.java.name)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.topic.FRACTIONS_STORY_ID_0
import org.oppia.android.domain.topic.FRACTIONS_TOPIC_ID
import org.oppia.android.domain.topic.PrimeTopicAssetsControllerModule
import org.oppia.android.domain.topic.TEST_STORY_ID_1
import org.oppia.android.domain.topic.TEST_TOPIC_ID_1
import org.oppia.android.domain.topic.TEST_STORY_ID_0
import org.oppia.android.domain.topic.TEST_TOPIC_ID_0
import org.oppia.android.testing.RobolectricModule
import org.oppia.android.testing.TestCoroutineDispatchers
import org.oppia.android.testing.TestDispatcherModule
Expand Down Expand Up @@ -303,9 +303,9 @@ class StoryFragmentTest {
).check(
matches(
withText(
"This is outline/summary for Second Exploration. It is very long but " +
"it has to be fully visible. You wil be learning about oppia app in Second Story. " +
"Learn about oppia app via testing in second exploration."
"This is the outline/summary for the first exploration of the story. It is very long " +
"but it has to be fully visible. You wil be learning about Oppia interactions. " +
"There is no second story to follow-up, but there is a second chapter."
)
)
)
Expand All @@ -331,9 +331,9 @@ class StoryFragmentTest {
).check(
matches(
withText(
"This is outline/summary for Second Exploration. It is very long but " +
"it has to be fully visible. You wil be learning about oppia app in Second Story. " +
"Learn about oppia app via testing in second exploration."
"This is the outline/summary for the first exploration of the story. It is very long " +
"but it has to be fully visible. You wil be learning about Oppia interactions. " +
"There is no second story to follow-up, but there is a second chapter."
)
)
)
Expand Down Expand Up @@ -600,8 +600,8 @@ class StoryFragmentTest {
return StoryActivity.createStoryActivityIntent(
ApplicationProvider.getApplicationContext(),
internalProfileId,
TEST_TOPIC_ID_1,
TEST_STORY_ID_1
TEST_TOPIC_ID_0,
TEST_STORY_ID_0
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ class TopicTestActivityForStoryTest {
fun testTopicTestActivityForStory_playTopicTab_storyItemIsExpanded() {
launch(TopicTestActivityForStory::class.java).use {
testCoroutineDispatchers.runCurrent()
// Story 0 of the topic should be expanded.
onView(
atPositionOnView(
recyclerViewId = R.id.story_summary_recycler_view,
position = 2,
position = 1,
targetViewId = R.id.chapter_recycler_view
)
).check(matches(isDisplayed()))
Expand Down
48 changes: 47 additions & 1 deletion domain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,61 @@ This library contains the frontend controller and business service logic for the

load("@dagger//:workspace_defs.bzl", "dagger_rules")
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library")
load("//domain:domain_assets.bzl", "generate_assets_list_from_text_protos")
load("//domain:domain_test.bzl", "domain_test")

DOMAIN_ASSETS = generate_assets_list_from_text_protos(
name = "domain_assets",
exploration_file_names = [
"test_exp_id_2",
"13",
"test_exp_id_4",
"umPkwp0L1M0-",
"MjZzEVOG47_1",
"2mzzFVDLuAj8",
"5NWuolNcwH6e",
"k2bQ7z5XHNbK",
"tIoSb3HZFN6e",
],
skills_file_names = [
"skills",
],
story_file_names = [
"test_story_id_0",
"test_story_id_2",
"wANbh4oOClga",
"wAMdg4oOClga",
"xBSdg4oOClga",
],
subtopic_file_names = [
"GJ2rLXRKD5hw_1",
"GJ2rLXRKD5hw_2",
"GJ2rLXRKD5hw_3",
"GJ2rLXRKD5hw_4",
"omzF4oqgeTXd_1",
],
topic_file_names = [
"test_topic_id_0",
"test_topic_id_1",
"test_topic_id_2",
"GJ2rLXRKD5hw",
"omzF4oqgeTXd",
],
topic_list_file_names = [
"topics",
],
)

kt_android_library(
name = "domain",
srcs = glob(
["src/main/java/org/oppia/android/domain/**/*.kt"],
exclude = ["src/main/java/org/oppia/android/domain/testing/**/*.kt"],
),
assets = glob(["src/main/assets/**"]),
assets = glob(
["src/main/assets/**"],
exclude = ["src/main/assets/**/*.textproto"],
) + DOMAIN_ASSETS,
assets_dir = "src/main/assets/",
custom_package = "org.oppia.android.domain",
manifest = "src/main/AndroidManifest.xml",
Expand Down
Loading