Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_string-template-indent = disabled
ktlint_standard_import-ordering = disabled

[*.yml]
[{*.yml,Fastfile,Screengrabfile,Appfile}]
indent_size = 2
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.runTest
import ooniprobe.composeapp.generated.resources.Common_Back
import ooniprobe.composeapp.generated.resources.Dashboard_Overview_ChooseWebsites
import ooniprobe.composeapp.generated.resources.Dashboard_Progress_UpdateLink_Label
import ooniprobe.composeapp.generated.resources.Dashboard_Running_Running
import ooniprobe.composeapp.generated.resources.Dashboard_Tab_Label
import ooniprobe.composeapp.generated.resources.Modal_EnableNotifications_Title
import ooniprobe.composeapp.generated.resources.Notification_StopTest
import ooniprobe.composeapp.generated.resources.OONIRun_Run
import ooniprobe.composeapp.generated.resources.Onboarding_AutomatedTesting_Title
import ooniprobe.composeapp.generated.resources.Onboarding_Crash_Title
Expand All @@ -31,7 +35,8 @@ import ooniprobe.composeapp.generated.resources.Settings_Sharing_UploadResults_D
import ooniprobe.composeapp.generated.resources.Settings_TestOptions_Label
import ooniprobe.composeapp.generated.resources.Settings_Title
import ooniprobe.composeapp.generated.resources.Settings_Websites_Categories_Label
import ooniprobe.composeapp.generated.resources.TestResults_Overview_Title
import ooniprobe.composeapp.generated.resources.Settings_Websites_CustomURL_Title
import ooniprobe.composeapp.generated.resources.TestResults_Overview_Tab_Label
import ooniprobe.composeapp.generated.resources.Test_Dash_Fullname
import ooniprobe.composeapp.generated.resources.Test_Performance_Fullname
import ooniprobe.composeapp.generated.resources.Test_Websites_Fullname
Expand Down Expand Up @@ -68,8 +73,10 @@ import org.ooni.testing.factories.MeasurementModelFactory
import org.ooni.testing.factories.ResultModelFactory
import org.ooni.testing.factories.UrlModelFactory
import tools.fastlane.screengrab.Screengrab
import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy
import tools.fastlane.screengrab.cleanstatusbar.CleanStatusBar
import tools.fastlane.screengrab.locale.LocaleTestRule
import java.util.Locale
import kotlin.time.Duration.Companion.seconds

@RunWith(AndroidJUnit4::class)
Expand All @@ -85,6 +92,7 @@ class AutomateScreenshotsTest {
@BeforeClass
@JvmStatic
fun beforeAll() {
Screengrab.setDefaultScreenshotStrategy(UiAutomatorScreenshotStrategy())
CleanStatusBar.enableWithDefaults()
}

Expand Down Expand Up @@ -153,6 +161,7 @@ class AutomateScreenshotsTest {
fun runTests() =
runTest {
skipOnboarding()
defaultSettings()
start()
with(compose) {
wait { onNodeWithContentDescription(Res.string.app_name).isDisplayed() }
Expand All @@ -162,20 +171,47 @@ class AutomateScreenshotsTest {
.isNotDisplayed()
}

Screengrab.screenshot("06-dashboard")
if (onNodeWithText(Res.string.Dashboard_Running_Running).isDisplayed()) {
Screengrab.screenshot("06-dashboard-running")

clickOnText(Res.string.Dashboard_Running_Running)
wait(timeout = 30.seconds) {
onNodeWithText(Res.string.Notification_StopTest)
.isDisplayed()
}

Screengrab.screenshot("06-running-running")

clickOnText(Res.string.Notification_StopTest)

wait(timeout = 30.seconds) {
onNodeWithText(Res.string.Dashboard_Tab_Label)
.isDisplayed()
}

clickOnText(Res.string.Dashboard_Tab_Label)

Thread.sleep(300)

Screengrab.screenshot("1_" + locale())

Screengrab.screenshot("06-dashboard")
} else {
Screengrab.screenshot("1_" + locale())

Screengrab.screenshot("06-dashboard")
}

wait(timeout = 30.seconds) {
onNodeWithText(Res.string.OONIRun_Run)
.isDisplayed()
}

clickOnText(Res.string.OONIRun_Run)

Screengrab.screenshot("07-run-tests")

clickOnTag("Run-Button")

Screengrab.screenshot("08-dashboard-running")
Thread.sleep(3000)
Screengrab.screenshot("07-run-tests")
}
}

Expand Down Expand Up @@ -272,11 +308,13 @@ class AutomateScreenshotsTest {
with(compose) {
wait { onNodeWithContentDescription(Res.string.app_name).isDisplayed() }

clickOnText(Res.string.TestResults_Overview_Title)
clickOnText(Res.string.TestResults_Overview_Tab_Label)

wait { onNodeWithText(Res.string.Test_Websites_Fullname).isDisplayed() }

Screengrab.screenshot("17-results")
Thread.sleep(3000)
Screengrab.screenshot("2_" + locale())

clickOnText(Res.string.Test_Websites_Fullname)

Expand All @@ -291,6 +329,7 @@ class AutomateScreenshotsTest {
checkTextAnywhereInsideWebView("https://z-lib.org/")

Screengrab.screenshot("19-website-measurement-anomaly")
Screengrab.screenshot("3_" + locale())

clickOnContentDescription(Res.string.Common_Back)
wait { onNodeWithText(Res.string.Test_Websites_Fullname).isDisplayed() }
Expand All @@ -303,6 +342,32 @@ class AutomateScreenshotsTest {
checkTextAnywhereInsideWebView("2160p (4k)")

Screengrab.screenshot("20-dash-measurement")
Thread.sleep(3000)
Screengrab.screenshot("4_" + locale())
}
}

@Test
fun choseWebsites() =
runTest {
skipOnboarding()
start()
with(compose) {
wait { onNodeWithContentDescription(Res.string.app_name).isDisplayed() }

wait(timeout = 30.seconds) {
onNodeWithText(Res.string.Dashboard_Progress_UpdateLink_Label)
.isNotDisplayed()
}

if (isOoni) {
clickOnText(Res.string.Test_Websites_Fullname)
wait { onNodeWithText(Res.string.Test_Websites_Fullname).isDisplayed() }
clickOnText(Res.string.Dashboard_Overview_ChooseWebsites)
wait { onNodeWithText(Res.string.Settings_Websites_CustomURL_Title).isDisplayed() }
Screengrab.screenshot("21-choose-websites")
Screengrab.screenshot("5_" + locale())
}
}
}

Expand All @@ -322,7 +387,7 @@ class AutomateScreenshotsTest {
with(compose) {
wait { onNodeWithContentDescription(Res.string.app_name).isDisplayed() }

clickOnText(Res.string.TestResults_Overview_Title)
clickOnText(Res.string.TestResults_Overview_Tab_Label)

wait { onNodeWithText(trustedName).isDisplayed() }

Expand Down Expand Up @@ -662,4 +727,8 @@ class AutomateScreenshotsTest {
)
}
}

fun locale(): String {
return Locale.getDefault().toString().replace("_", "-")
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@


strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

strings-organization.xml
strings-organization.xml
27 changes: 26 additions & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@ default_platform(:android)

platform :android do

before_all do
# Enable demo mode before running screengrab
adb_command = "adb shell settings put global sysui_demo 1"
Action.sh(adb_command)

# Set demo mode properties
demo_commands = [
"enter",
"battery level 100",
"battery plug false",
"network wifi level 4",
"network mobile hidden",
"clock 0800",
"notifications remove",
"status bar icons"
]

demo_commands.each do |cmd|
Action.sh("adb shell am broadcast -a com.android.systemui.demo -e command #{cmd}")
end

end

desc "Upload the screenshots to the Google Play"
lane :upload_screenshots do
upload_to_play_store(
Expand All @@ -17,7 +40,9 @@ platform :android do
lane :capture_screen_ooni do
gradle(task: "clean copyBrandingToCommonResources assembleFullDebug assembleFullDebugAndroidTest -Porganization=ooni")
capture_android_screenshots(
app_package_name: 'org.openobservatory.ooniprobe.dev'
app_package_name: 'org.openobservatory.ooniprobe.dev',
use_timestamp_suffix: false,
locales: ["en-US","ar", "ca", "de", "el", "es", "fa", "fr", "hi", "id", "is", "it", "my", "nl", "pt-BR", "ro", "ru", "sk", "sq", "sw", "th", "tr", "vi", "zh-CN", "zh-TW"],
)
end

Expand Down
1 change: 1 addition & 0 deletions fastlane/Pluginfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

gem 'fastlane-plugin-sentry'
gem 'fastlane-plugin-huawei_appgallery_connect'
gem 'fastlane-plugin-demo_mode'
5 changes: 2 additions & 3 deletions fastlane/Screengrabfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
locales(['en-US'])
# locales(['ar', 'en-US', 'hi-IN', 'pt-BR', 'sk', 'zh-CN', 'ca', 'es-ES', 'id', 'ro', 'sq', 'zh-TW', 'de-DE', 'fa', 'is-IS', 'ru-RU', 'th', 'el-GR', 'fr-FR', 'it-IT', 'tr-TR'])
app_apk_path "composeApp/build/outputs/apk/full/debug/composeApp-full-debug.apk"
app_apk_path "composeApp/build/outputs/apk/full/debug/composeApp-full-universal-debug.apk"
tests_apk_path "composeApp/build/outputs/apk/androidTest/full/debug/composeApp-full-debug-androidTest.apk"
reinstall_app true
exit_on_test_failure false
clear_previous_screenshots false # ensures the selected screenshots for the store are not deleted.
clear_previous_screenshots true # ensures the selected screenshots for the store are not deleted.
use_tests_in_packages(['org.ooni.probe.screenshots'])
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/5_en-US.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading