Skip to content

Instantly share code, notes, and snippets.

igor-brishkoski

Block or report user

Report or block igor-brishkoski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View multiple_robots.kt
@RunWith(AndroidJUnit4::class)
class CreatePostActivityTest : BaseTest() {
@Rule
@JvmField
var activityTestRule = ActivityTestRule(CreatePostActivity::class.java)
@Test
fun loging_and_createPost_WithText_Success() {
login {
View create_post_robot_image.kt
class CreatePostRobot : BaseRobot() {
fun enterPostText(text: String) =
postText().typeText(text)
fun submitPost() =
postImageView().click()
fun matchResultText(expectedText: String) =
postSubmitResultText().isTextDisplayed(expectedText)
View activity_test.kt
@RunWith(AndroidJUnit4::class)
class CreatePostActivityTest : BaseTest() {
@Rule
@JvmField
var activityTestRule = ActivityTestRule(CreatePostActivity::class.java)
@Test
fun createPost_WithText_Success() {
createPost {
View create_post_robot.kt
class CreatePostRobot : BaseRobot() {
fun enterPostText(text: String) =
postText().typeText(text)
fun submitPost() =
postButton().click()
fun matchResultText(expectedText: String) =
postSubmitResultText().isTextDisplayed(expectedText)
View base_robot.kt
abstract class BaseTest {
val createPost = robotRunner(CreatePostRobot::class)
private fun <T : BaseRobot> robotRunner(cls: KClass<T>) = { func: T.() -> Unit ->
cls.createInstance().apply {
func()
}
}
}
View ext_helpers.kt
fun ViewInteraction.click(): ViewInteraction =
perform(ViewActions.click())
fun ViewInteraction.typeText(text: String): ViewInteraction =
perform(ViewActions.typeText(text), ViewActions.closeSoftKeyboard())
fun ViewInteraction.isTextDisplayed(text: String): ViewInteraction =
check(ViewAssertions.matches(ViewMatchers.withText(text)))
View espresso_test.kt
class CreatePostActivityTest {
@Test
fun void createPost_WithText_Success() {
// Find the edit text and perform typing text action
// close the keyboard after text has been entered
onView(withId(R.id.post_text))
.perform(ViewActions.typeText("This is a post"),ViewActions.closeSoftKeyboard))
// Find the submit post button and perform a click
onView(withId(R.id.post_button))
.perform(ViewActions.click())
View ui_testing_blob.kt
@Test
fun mainActivityTest() {
val bottomNavigationItemView = onView(
allOf(
withId(R.id.navigation_dashboard), withContentDescription("Dashboard"),
childAtPosition(
childAtPosition(
withId(R.id.navigation),
0
View alias_decrypt.sh
# put this in your .bashrc or .zshrc or whatever you're using
# make sure you're in the directory where the file is when running this command
alias decrypt_secrets='openssl enc -d -aes-256-cbc -in secrets.properties.enc -out secrets.properties'
@igor-brishkoski
igor-brishkoski / alias_encrypt.sh
Last active Jan 3, 2018
Create alias for encrypting your secrets
View alias_encrypt.sh
# put this in your .bashrc or .zshrc or whatever you're using
# make sure you're in the directory where the file is when running this command
alias encrypt_secrets='openssl enc -aes-256-cbc -salt -in secrets.properties -out secrets.properties.enc'
You can’t perform that action at this time.