-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISSUE-88: Add samples and tests for ScreenshotScenarioRule
- Loading branch information
1 parent
cd32a96
commit 51ec86a
Showing
45 changed files
with
1,250 additions
and
51 deletions.
There are no files selected for viewing
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
Binary file added
BIN
+190 KB
...ts/29-1080x2220@440dp-en_US/ScenarioClientDetailsViewScreenshotTest_default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+193 KB
...2220@440dp-en_US/ScenarioClientDetailsViewScreenshotTest_usingLayoutResName.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+222 KB
...@440dp-en_US/ScenarioClientListActivityScreenshotTest_withFocusOnBackground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+223 KB
...80x2220@440dp-en_US/ScenarioClientListActivityScreenshotTest_withFocusOnFab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.4 KB
...ts/29-1080x2220@440dp-en_US/ScenarioComposableScreenshotTest_clientListItem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.13 KB
...reenshots/29-1080x2220@440dp-en_US/ScenarioComposableScreenshotTest_default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36 KB
...creenshots/29-1080x2220@440dp-en_US/ScenarioComposableScreenshotTest_dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+49.4 KB
...hots/29-1080x2220@440dp-en_US/ScenarioComposableScreenshotTest_dropdownMenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+22 KB
...shots/29-1080x2220@440dp-en_US/ScenarioComposableScreenshotTest_paddedBoxes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.71 KB
...enshots/29-1080x2220@440dp-en_US/ScenarioComposableScreenshotTest_topAppBar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+252 KB
...hots/29-1080x2220@440dp-en_US/ScenarioComposeActivityScreenshotTest_default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+252 KB
...80x2220@440dp-en_US/ScenarioComposeActivityScreenshotTest_dropDownCollapsed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+208 KB
...080x2220@440dp-en_US/ScenarioComposeActivityScreenshotTest_dropDownExpanded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.6 KB
...s/29-1080x2220@440dp-en_US/ScenarioComposeRuleInteropScreenshotTest_default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+228 KB
...080x2220@440dp-en_US/ScenarioComposeRuleInteropScreenshotTest_scrollingList.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+33 KB
...ts/29-1080x2220@440dp-en_US/ScenarioFullscreenCaptureExampleTest_fullscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+40.6 KB
...ts/29-1080x2220@440dp-en_US/ScenarioFullscreenCaptureExampleTest_withDialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+60.6 KB
...hots/29-1080x2220@440dp-en_US/ScenarioFullscreenCaptureExampleTest_withMenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.6 KB
...enshots/29-1080x2220@440dp-en_US/ScenarioMainActivityScreenshotTest_default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+134 KB
...29-1080x2220@440dp-en_US/ScreenshotScenarioRuleExampleTests_addIntentExtras.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+30.8 KB
...80x2220@440dp-en_US/ScreenshotScenarioRuleExampleTests_captureMethodExample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14 KB
...80x2220@440dp-en_US/ScreenshotScenarioRuleExampleTests_compareMethodExample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+165 KB
...s/29-1080x2220@440dp-en_US/ScreenshotScenarioRuleExampleTests_customCapture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+190 KB
...enshots/29-1080x2220@440dp-en_US/ScreenshotScenarioRuleExampleTests_default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+152 KB
...hots/29-1080x2220@440dp-en_US/ScreenshotScenarioRuleExampleTests_exclusions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+32 KB
...shots/29-1080x2220@440dp-en_US/ScreenshotScenarioRuleExampleTests_fontScale.png
Oops, something went wrong.
Binary file added
BIN
+16.4 KB
...1080x2220@440dp-en_US/ScreenshotScenarioRuleExampleTests_generateDiffs.diff.png
Oops, something went wrong.
Binary file added
BIN
+191 KB
...s/29-1080x2220@440dp-en_US/ScreenshotScenarioRuleExampleTests_generateDiffs.png
Oops, something went wrong.
Binary file added
BIN
+23.6 KB
...1080x2220@440dp-en_US/ScreenshotScenarioRuleExampleTests_setEspressoActions.png
Oops, something went wrong.
Binary file added
BIN
+12.8 KB
...ts/29-1080x2220@440dp-en_US/ScreenshotScenarioRuleExampleTests_setExactness.png
Oops, something went wrong.
Binary file added
BIN
+12.8 KB
...x2220@440dp-en_US/ScreenshotScenarioRuleExampleTests_setExactnessAnnotation.png
Oops, something went wrong.
Binary file added
BIN
+17.7 KB
...20@440dp-en_US/ScreenshotScenarioRuleExampleTests_setScreenshotViewProvider.png
Oops, something went wrong.
Binary file added
BIN
+196 KB
...1080x2220@440dp-en_US/ScreenshotScenarioRuleExampleTests_usingLayoutResName.png
Oops, something went wrong.
Binary file added
BIN
+115 KB
...eenshots/29-1080x2220@440dp-ja_JP/ScreenshotScenarioRuleExampleTests_locale.png
Oops, something went wrong.
Binary file added
BIN
+32 KB
.../29-2220x1080@440dp-en_US/ScreenshotScenarioRuleExampleTests_setOrientation.png
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
Samples/Legacy/src/androidTest/java/dev/testify/sample/ActivityScenarioExampleTest.kt
This file was deleted.
Oops, something went wrong.
90 changes: 90 additions & 0 deletions
90
.../src/androidTest/java/dev/testify/sample/scenario/ScenarioFullscreenCaptureExampleTest.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2023 ndtp | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package dev.testify.sample.scenario | ||
|
||
import androidx.test.core.app.launchActivity | ||
import androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu | ||
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation | ||
import com.google.android.material.dialog.MaterialAlertDialogBuilder | ||
import dev.testify.annotation.ScreenshotInstrumentation | ||
import dev.testify.capture.fullscreen.captureFullscreen | ||
import dev.testify.capture.fullscreen.provider.excludeSystemUi | ||
import dev.testify.core.TestifyConfiguration | ||
import dev.testify.sample.MainActivity | ||
import dev.testify.scenario.ScreenshotScenarioRule | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class ScenarioFullscreenCaptureExampleTest { | ||
|
||
@get:Rule val rule = ScreenshotScenarioRule(configuration = TestifyConfiguration(exactness = 0.95f)) | ||
|
||
@ScreenshotInstrumentation | ||
@Test | ||
fun fullscreen() { | ||
launchActivity<MainActivity>().use { scenario -> | ||
rule | ||
.withScenario(scenario) | ||
.captureFullscreen() | ||
.configure { | ||
excludeSystemUi() | ||
} | ||
.assertSame() | ||
} | ||
} | ||
|
||
@ScreenshotInstrumentation | ||
@Test | ||
fun withMenu() { | ||
launchActivity<MainActivity>().use { scenario -> | ||
openActionBarOverflowOrOptionsMenu(getInstrumentation().targetContext) | ||
rule | ||
.withScenario(scenario) | ||
.captureFullscreen() | ||
.configure { | ||
excludeSystemUi() | ||
} | ||
.assertSame() | ||
} | ||
} | ||
|
||
@ScreenshotInstrumentation | ||
@Test | ||
fun withDialog() { | ||
launchActivity<MainActivity>().use { scenario -> | ||
rule | ||
.withScenario(scenario) | ||
.captureFullscreen() | ||
.configure { | ||
excludeSystemUi() | ||
} | ||
.setViewModifications { | ||
MaterialAlertDialogBuilder(it.context) | ||
.setMessage("Hello, world!") | ||
.show() | ||
} | ||
.assertSame() | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...cy/src/androidTest/java/dev/testify/sample/scenario/ScenarioMainActivityScreenshotTest.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2023 ndtp | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package dev.testify.sample.scenario | ||
|
||
import androidx.test.core.app.launchActivity | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import dev.testify.annotation.ScreenshotInstrumentation | ||
import dev.testify.sample.MainActivity | ||
import dev.testify.scenario.ScreenshotScenarioRule | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class ScenarioMainActivityScreenshotTest { | ||
|
||
@get:Rule val rule = ScreenshotScenarioRule() | ||
|
||
@ScreenshotInstrumentation | ||
@Test | ||
fun default() { | ||
launchActivity<MainActivity>().use { scenario -> | ||
rule.withScenario(scenario).assertSame() | ||
} | ||
} | ||
} |
Oops, something went wrong.