Created
October 22, 2019 08:38
-
-
Save MrVilkaman/be28e52126f0a48488067a3521600b77 to your computer and use it in GitHub Desktop.
UI test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package arch.module.skyeng.simpleTest | |
import android.Manifest | |
import androidx.test.ext.junit.runners.AndroidJUnit4 | |
import androidx.test.rule.ActivityTestRule | |
import androidx.test.rule.GrantPermissionRule | |
import arch.module.skyeng.simpleTest.screens.ScreenAScreen | |
import arch.module.skyeng.simpleTest.screens.ScreenBScreen | |
import arch.module.skyeng.simpleTest.screens.ScreenCScreen | |
import arch.module.skyeng.ui.main.SkyengActivity | |
import com.kaspersky.kaspresso.testcases.api.testcase.TestCase | |
import org.junit.Rule | |
import org.junit.Test | |
import org.junit.runner.RunWith | |
@RunWith(AndroidJUnit4::class) | |
class SimpleTest : TestCase() { | |
@get:Rule | |
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant( | |
Manifest.permission.WRITE_EXTERNAL_STORAGE, | |
Manifest.permission.READ_EXTERNAL_STORAGE | |
) | |
@get:Rule | |
val activityTestRule = ActivityTestRule(SkyengActivity::class.java, true, false) | |
@Test | |
fun test() { | |
before { | |
activityTestRule.launchActivity(null) | |
}.after { | |
activityTestRule.finishActivity() | |
}.run { | |
step("Открыть приложение") { | |
testLogger.i("I am testLogger") | |
ScreenAScreen { | |
title { | |
isVisible() | |
hasText("ЭКРАН A") | |
} | |
} | |
} | |
step("Открыть следующий экран") { | |
ScreenAScreen { | |
button2 { | |
click() | |
} | |
} | |
ScreenCScreen { | |
title { | |
isVisible() | |
hasText("ЭКРАН C") | |
} | |
button { | |
hasText("Continue") | |
click() | |
} | |
} | |
} | |
step("Открыть следующий экран") { | |
ScreenBScreen { | |
title { | |
isVisible() | |
hasText("ЭКРАН B") | |
} | |
button { | |
click() | |
} | |
} | |
ScreenAScreen { | |
title { | |
isVisible() | |
hasText("ЭКРАН A") | |
} | |
} | |
} | |
} | |
} | |
@Test | |
fun test_flow() { | |
before { | |
activityTestRule.launchActivity(null) | |
}.after { | |
activityTestRule.finishActivity() | |
}.run { | |
step("Открыть приложение") { | |
ScreenAScreen { | |
title { | |
isVisible() | |
hasText("ЭКРАН A") | |
} | |
button1 { | |
click() | |
} | |
} | |
} | |
step("Вернуться назад") { | |
device.exploit.pressBack(true) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment