Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tech fixes #560

Merged
merged 5 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class LoggingObjectWatcherInterceptor(
logger.i(
"The object: ${interaction.description}. " +
"The operation: Check=${assertion.type}(description={${assertion.description}}. " +
"Additional info: the object was founded by selector=${interaction.selector.bySelector}"
"Additional info: the object was found by selector=${interaction.selector.bySelector}"
)
}

Expand All @@ -38,7 +38,7 @@ class LoggingObjectWatcherInterceptor(
logger.i(
"The object: ${interaction.description}. " +
"The operation: Action=${action.type}(description={${action.description}}. " +
"Additional info: the object was founded by selector=${interaction.selector.bySelector}"
"Additional info: the object was found by selector=${interaction.selector.bySelector}"
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.kaspersky.kaspressample.docloc_tests.advanced

import android.Manifest
import android.graphics.Color
import androidx.fragment.app.testing.FragmentScenario
import androidx.fragment.app.testing.launchFragmentInContainer
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.docloc.ScreenshotSampleFragment
Expand All @@ -16,7 +17,7 @@ import org.junit.Test
* For more information see DocLoc wiki page.
*/
class AdvancedScreenshotSampleTest : DocLocScreenshotTestCase(locales = "en,ru") {
private lateinit var view: ScreenshotSampleView
private lateinit var scenario: FragmentScenario<ScreenshotSampleFragment>

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Expand All @@ -27,26 +28,26 @@ class AdvancedScreenshotSampleTest : DocLocScreenshotTestCase(locales = "en,ru")
@ScreenShooterTest
@Test
fun test() = before {
val scenario = launchFragmentInContainer<ScreenshotSampleFragment>()
scenario.onFragment {
view = getUiSafeProxy(it as ScreenshotSampleView)
}
scenario = launchFragmentInContainer()
}.after {
}.run {
step("1. Launch feature screen") {
view.setCounterValue(0)
view.setBackgroundColor(Color.WHITE)
captureScreenshot("1. Startup")
}
scenario.onFragment {
val view = getUiSafeProxy(it as ScreenshotSampleView)
step("1. Launch feature screen") {
view.setCounterValue(0)
view.setBackgroundColor(Color.WHITE)
captureScreenshot("1. Startup")
}

step("2. Increase counter by 5") {
view.setCounterValue(5)
captureScreenshot("2. Value has been increased by 5")
}
step("2. Increase counter by 5") {
view.setCounterValue(5)
captureScreenshot("2. Value has been increased by 5")
}

step("3. Set red background color") {
view.setBackgroundColor(Color.RED)
captureScreenshot("3. Background has been set to red")
step("3. Set red background color") {
view.setBackgroundColor(Color.RED)
captureScreenshot("3. Background has been set to red")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.kaspersky.kaspressample.docloc_tests.advanced

import android.Manifest
import android.graphics.Color
import androidx.fragment.app.testing.FragmentScenario
import androidx.fragment.app.testing.launchFragmentInContainer
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.docloc.ScreenshotSampleFragment
Expand All @@ -20,7 +21,7 @@ class AdvancedScreenshotSampleTestLegacy : DocLocScreenshotTestCase(
screenshotsDirectory = File("screenshots"),
locales = "en,ru"
) {
private lateinit var view: ScreenshotSampleView
private lateinit var scenario: FragmentScenario<ScreenshotSampleFragment>

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Expand All @@ -31,26 +32,26 @@ class AdvancedScreenshotSampleTestLegacy : DocLocScreenshotTestCase(
@ScreenShooterTest
@Test
fun test() = before {
val scenario = launchFragmentInContainer<ScreenshotSampleFragment>()
scenario.onFragment {
view = getUiSafeProxy(it as ScreenshotSampleView)
}
scenario = launchFragmentInContainer<ScreenshotSampleFragment>()
}.after {
}.run {
step("1. Launch feature screen") {
view.setCounterValue(0)
view.setBackgroundColor(Color.WHITE)
captureScreenshot("1. Startup")
}
scenario.onFragment {
val view = getUiSafeProxy(it as ScreenshotSampleView)
step("1. Launch feature screen") {
view.setCounterValue(0)
view.setBackgroundColor(Color.WHITE)
captureScreenshot("1. Startup")
}

step("2. Increase counter by 5") {
view.setCounterValue(5)
captureScreenshot("2. Value has been increased by 5")
}
step("2. Increase counter by 5") {
view.setCounterValue(5)
captureScreenshot("2. Value has been increased by 5")
}

step("3. Set red background color") {
view.setBackgroundColor(Color.RED)
captureScreenshot("3. Background has been set to red")
step("3. Set red background color") {
view.setBackgroundColor(Color.RED)
captureScreenshot("3. Background has been set to red")
}
}
}
}
Loading