You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
The fourth test HorizontalListTests.horizontal_scrolling() is failing, because at least on on my emulator (pixel 5 api 31) if you do a swipeLeft you actually go inbetween the third and fourth card so the nama showing is from the fourth card "Nox" not the third card "Frankie" So instead of
fun `horizontal_scrolling`() {
onView(withId(R.id.horizontal_recycler_view))
.perform(swipeLeft())
onView(withText("Nox")).check(matches(isDisplayed()))
}
it should be
fun `horizontal_scrolling`() {
onView(withId(R.id.horizontal_recycler_view))
.perform(swipeLeft())
onView(withText("Nox")).check(matches(isDisplayed()))
}
Steps to reproduce?
Run the tests and you can see 4 failing ones.
Versions
Android Studio Chipmunk | 2021.2.1 Patch 1
Build #AI-212.5712.43.2112.8609683, built on May 18, 2022
Runtime version: 11.0.12+0-b1504.28-7817840 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 4
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.intellij.plugins.markdown (212.5457.16), Dart (212.5744), io.flutter (69.0.2)
Additional information Include screenshots if they would be useful in clarifying the problem.
The text was updated successfully, but these errors were encountered:
URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-project-dogglers-app?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-2-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-project-dogglers-app#3
In which task and step of the codelab can this issue be found?
4. Test your app
Describe the problem
4 of the 19 tests faill
For 3 of the tests, they all fail for the same reason.
The test is not handling the string resources with variables.
This happens for age and hobbies
But in BaseTest.hasListItemContent() you have this:
This won't work because the actual TextView will be a like "Age: 7" and you can calling withText("7")
So to fix you can just do this:
Add a private method so you don't duplicate your code (dry)
private fun getResourceStringWithVariable(id: Int, variable: String): String? {
val targetContext: Context = ApplicationProvider.getApplicationContext()
return targetContext.getResources().getString(id, variable)
}
Fix your tests to be this:
The fourth test HorizontalListTests.horizontal_scrolling() is failing, because at least on on my emulator (pixel 5 api 31) if you do a swipeLeft you actually go inbetween the third and fourth card so the nama showing is from the fourth card "Nox" not the third card "Frankie" So instead of
it should be
Steps to reproduce?
Versions
Android Studio Chipmunk | 2021.2.1 Patch 1
Build #AI-212.5712.43.2112.8609683, built on May 18, 2022
Runtime version: 11.0.12+0-b1504.28-7817840 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 4
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.intellij.plugins.markdown (212.5457.16), Dart (212.5744), io.flutter (69.0.2)
Additional information
Include screenshots if they would be useful in clarifying the problem.
The text was updated successfully, but these errors were encountered: