@@ -17,18 +17,18 @@ import androidx.test.uiautomator.UiSelector
17
17
import dev.turingcomplete.kotlinonetimepassword.HmacAlgorithm
18
18
import dev.turingcomplete.kotlinonetimepassword.TimeBasedOneTimePasswordConfig
19
19
import dev.turingcomplete.kotlinonetimepassword.TimeBasedOneTimePasswordGenerator
20
+ import java.net.HttpURLConnection
21
+ import java.net.URL
22
+ import java.util.concurrent.TimeUnit
23
+ import kotlin.time.Duration.Companion.minutes
24
+ import kotlin.time.Duration.Companion.seconds
20
25
import org.apache.commons.codec.binary.Base32
21
26
import org.junit.After
22
27
import org.junit.Assert
23
28
import org.junit.Before
24
29
import org.junit.Rule
25
30
import org.junit.Test
26
31
import org.junit.runner.RunWith
27
- import java.net.HttpURLConnection
28
- import java.net.URL
29
- import java.util.concurrent.TimeUnit
30
- import kotlin.time.Duration.Companion.minutes
31
- import kotlin.time.Duration.Companion.seconds
32
32
33
33
@RunWith(AndroidJUnit4 ::class )
34
34
@LargeTest
@@ -59,18 +59,18 @@ class MainActivityTest {
59
59
timeStep = 30 ,
60
60
timeStepUnit = TimeUnit .SECONDS )
61
61
val githubTOTP = TimeBasedOneTimePasswordGenerator (github2FASecret, config)
62
-
63
62
val device = UiDevice .getInstance(InstrumentationRegistry .getInstrumentation())
64
- Log .d(TAG , " Wait for VPN permission prompt and accept" )
65
- device.find(By .text(" Connection request" ))
66
- device.find(By .text(" OK" )).click()
67
63
68
64
Log .d(TAG , " Click through Get Started screen" )
69
65
device.find(By .text(" Get Started" ))
70
66
device.find(By .text(" Get Started" )).click()
71
67
68
+ Log .d(TAG , " Wait for VPN permission prompt and accept" )
69
+ device.find(By .text(" Connection request" ))
70
+ device.find(By .text(" OK" )).click()
71
+
72
72
asNecessary(
73
- timeout = 2 .minutes,
73
+ 2 .minutes,
74
74
{
75
75
Log .d(TAG , " Log in" )
76
76
device.find(By .text(" Log in" )).click()
@@ -93,7 +93,6 @@ class MainActivityTest {
93
93
},
94
94
{
95
95
Log .d(TAG , " Make sure GitHub page has loaded" )
96
- device.find(By .text(" New to GitHub" ))
97
96
device.find(By .text(" Username or email address" ))
98
97
device.find(By .text(" Sign in" ))
99
98
},
@@ -115,19 +114,23 @@ class MainActivityTest {
115
114
.setText(githubTOTP.generate())
116
115
device.find(UiSelector ().instance(0 ).className(Button ::class .java)).click()
117
116
},
117
+ {
118
+ Log .d(TAG , " Authorizing Tailscale" )
119
+ device.find(By .text(" Authorize tailscale" )).click()
120
+ },
118
121
{
119
122
Log .d(TAG , " Accept Tailscale app" )
120
123
device.find(By .text(" Learn more about OAuth" ))
121
124
// Sleep a little to give button time to activate
125
+
122
126
Thread .sleep(5 .seconds.inWholeMilliseconds)
123
127
device.find(UiSelector ().instance(1 ).className(Button ::class .java)).click()
124
128
},
125
129
{
126
130
Log .d(TAG , " Connect device" )
127
131
device.find(By .text(" Connect device" ))
128
132
device.find(UiSelector ().instance(0 ).className(Button ::class .java)).click()
129
- },
130
- )
133
+ })
131
134
132
135
try {
133
136
Log .d(TAG , " Accept Permission (Either Storage or Notifications)" )
0 commit comments