Skip to content

Instantly share code, notes, and snippets.

@loukwn
Created February 7, 2022 20:47
Show Gist options
  • Save loukwn/8438ac5d58da1730b131ffddfa655796 to your computer and use it in GitHub Desktop.
Save loukwn/8438ac5d58da1730b131ffddfa655796 to your computer and use it in GitHub Desktop.
class ViewTests {
@get:Rule
val paparazzi = Paparazzi() // This can be configured to use different devices etc.
private lateinit var stageStepBar: StageStepBar
private lateinit var parentView: FrameLayout
private lateinit var testNameTextView: TextView
@Before
fun setup() {
parentView = paparazzi.inflate(R.layout.layout_to_test)
stageStepBar = parentView.findViewById(R.id.stageStepbar)
testNameTextView = parentView.findViewById(R.id.testName)
stageStepBar.setAnimate(false)
}
@Test
fun `Default configuration`() {
testNameTextView.text = "View test:\nDefault configuration"
paparazzi.snapshot(parentView)
}
@Test
fun `7 stages`() {
stageStepBar.setStageStepConfig(listOf(9, 9, 9, 9, 9, 9))
testNameTextView.text = "View test:\n7 stages"
paparazzi.snapshot(parentView)
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment