generated from bitwarden/template
-
Notifications
You must be signed in to change notification settings - Fork 9
/
ExampleInstrumentedTest.kt
136 lines (104 loc) · 3.73 KB
/
ExampleInstrumentedTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package com.x8bit.bitwarden.android.authenticator
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.isDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import com.bitwarden.authenticator.ui.platform.feature.settings.appearance.model.AppTheme
import com.bitwarden.authenticator.ui.platform.feature.tutorial.TutorialScreen
import com.bitwarden.authenticator.ui.platform.feature.tutorial.TutorialViewModel
import com.bitwarden.authenticator.ui.platform.theme.AuthenticatorTheme
import org.junit.ClassRule
import org.junit.Rule
import org.junit.Test
import tools.fastlane.screengrab.Screengrab
import tools.fastlane.screengrab.locale.LocaleTestRule
class ExampleInstrumentedTest {
@get:Rule
val composeTestRule = createComposeRule()
@Test
fun screenshotTutorialSlides_Dark() {
val viewModel = TutorialViewModel()
composeTestRule.setContent {
AuthenticatorTheme(theme = AppTheme.DARK) {
TutorialScreen(
viewModel = viewModel,
onTutorialFinished = {},
)
}
}
composeTestRule.waitForIdle()
composeTestRule
.onNodeWithText("Continue")
.isDisplayed()
composeTestRule
.onNodeWithText("Secure your accounts with Bitwarden Authenticator")
.isDisplayed()
Screengrab.screenshot("IntroSlide_Dark")
composeTestRule
.onNodeWithText("Continue")
.performClick()
composeTestRule
.onNodeWithText("Use your device camera to scan codes")
.assertIsDisplayed()
Screengrab.screenshot("QrCodeSlide_Dark")
composeTestRule
.onNodeWithText("Continue")
.performClick()
composeTestRule
.onNodeWithText("Sign in using unique codes")
.assertIsDisplayed()
composeTestRule
.onNodeWithText("Continue")
.assertDoesNotExist()
composeTestRule
.onNodeWithText("Get started")
.isDisplayed()
Screengrab.screenshot("UniqueCodesSlide_Dark")
}
@Test
fun screenshotTutorialSlides_Light() {
val viewModel = TutorialViewModel()
composeTestRule.setContent {
AuthenticatorTheme(theme = AppTheme.LIGHT) {
TutorialScreen(
viewModel = viewModel,
onTutorialFinished = {},
)
}
}
composeTestRule.waitForIdle()
composeTestRule
.onNodeWithText("Continue")
.isDisplayed()
composeTestRule
.onNodeWithText("Secure your accounts with Bitwarden Authenticator")
.isDisplayed()
Screengrab.screenshot("IntroSlide_Light")
composeTestRule
.onNodeWithText("Continue")
.performClick()
composeTestRule
.onNodeWithText("Use your device camera to scan codes")
.assertIsDisplayed()
Screengrab.screenshot("QrCodeSlide_Light")
composeTestRule
.onNodeWithText("Continue")
.performClick()
composeTestRule
.onNodeWithText("Sign in using unique codes")
.assertIsDisplayed()
composeTestRule
.onNodeWithText("Continue")
.assertDoesNotExist()
composeTestRule
.onNodeWithText("Get started")
.isDisplayed()
Screengrab.screenshot("UniqueCodesSlide_Light")
}
companion object {
@JvmField
@ClassRule
val localeTestRule: LocaleTestRule = LocaleTestRule()
}
}