Open vrajdesai78 opened 2 years ago
@vrajdesai78, @adhiamboperes - Requesting Further Insight!
Is it possible that the malfunction lies with the @Config(qualifiers) annotation? These test scenarios are intended specifically for the layout-sw600dp, as depicted in the image,
yet they seem to be invoked even for other layouts. Despite experimenting with different versions of Robolectric, the problem persists. Are there any particular adjustments to the configurations that might resolve this issue?
I attempted to implement a manual conditional check, which proved effective.
Assume.assumeTrue(isScreenSw600dp())
private fun isScreenSw600dp(): Boolean {
val displayMetrics = InstrumentationRegistry.getInstrumentation().targetContext.resources.displayMetrics
val screenWidthDp = displayMetrics.widthPixels / displayMetrics.density
return screenWidthDp >= 600
}
Should we explore alternative methods for obtaining @Config, or consider implementing custom checks as a replacement?
With AssumeTrue Check:
Without AssumeTrue Check:
The common error for all test cases:
Following test cases are failing in StoryFragmentTest with above mentioned errors:
testStoryFragment_toolbarTitle_marqueeInRtl_isDisplayedCorrectly
testStoryFragment_completedChapter_pawIconIsVisible()
testStoryFragment_pendingChapter_pawIconIsGone()
testStoryFragment_toolbarTitle_marqueeInLtr_isDisplayedCorrectly
testStoryFragment_completedChapter_verticalDashedLineIsVisible
testStoryFragment_completedChapter_checkProgressDrawableIsCorrect
testStoryFragment_lockedChapter_checkProgressDrawableIsCorrect
testStoryFragment_lastChapter_verticalDashedLineIsGone
testStoryFragment_notStartedChapter_checkProgressDrawableIsCorrect
Steps to reproduce the behavior:
StoryFragmentTest
in EspressoExpected behavior All test cases should pass without giving any error.
Screenshot of failing test cases
Environment