diff --git a/e2e/update_samples b/e2e/update_samples index 87f8d66a4c..2a91d98e58 100755 --- a/e2e/update_samples +++ b/e2e/update_samples @@ -17,8 +17,10 @@ fi rm -rf samples/ samples.zip mkdir -p samples/ +mkdir -p samples/wikipedia_es_ES cp -r apps/wikipedia.apk apps/wikipedia.zip samples/ cp -r workspaces/wikipedia/* samples/ +cp -r workspaces/wikipedia_es_ES/* samples/wikipedia_es_ES cp samples/wikipedia.apk samples/sample.apk # The name is being depended upon. cp samples/wikipedia.zip samples/sample.zip # The name is being depended upon. cd samples/ diff --git a/e2e/workspaces/wikipedia_es_ES/android-advanced-flow.yaml b/e2e/workspaces/wikipedia_es_ES/android-advanced-flow.yaml new file mode 100644 index 0000000000..a6872200c3 --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/android-advanced-flow.yaml @@ -0,0 +1,13 @@ +appId: org.wikipedia +tags: + - android + - passing + - advanced +--- +- runFlow: subflows/onboarding-android.yaml +- tapOn: + id: "org.wikipedia:id/search_container" +- runScript: scripts/getSearchQuery.js +- inputText: ${output.result} +- assertVisible: ${output.result} +- runFlow: subflows/launch-clearstate-android.yaml diff --git a/e2e/workspaces/wikipedia_es_ES/android-flow.yaml b/e2e/workspaces/wikipedia_es_ES/android-flow.yaml new file mode 100644 index 0000000000..7d0ced3538 --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/android-flow.yaml @@ -0,0 +1,6 @@ +appId: org.wikipedia +tags: + - android + - passing +--- +- launchApp diff --git a/e2e/workspaces/wikipedia_es_ES/ios-advanced-flow.yaml b/e2e/workspaces/wikipedia_es_ES/ios-advanced-flow.yaml new file mode 100644 index 0000000000..ef2420acc8 --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/ios-advanced-flow.yaml @@ -0,0 +1,23 @@ +appId: org.wikimedia.wikipedia +tags: + - ios + - passing + - advanced +--- +- runFlow: subflows/onboarding-ios.yaml + +# Dismiss the auth modal if visible +- runFlow: + when: + visible: "You have been logged out" + commands: + - tapOn: + text: "Continue without logging in" + +- tapOn: Buscar en Wikipedia +- runScript: scripts/getSearchQuery.js +- inputText: ${output.result} +- eraseText +- inputText: qwerty +- assertVisible: ${output.result} +- runFlow: subflows/launch-clearstate-ios.yaml diff --git a/e2e/workspaces/wikipedia_es_ES/ios-flow.yaml b/e2e/workspaces/wikipedia_es_ES/ios-flow.yaml new file mode 100644 index 0000000000..217066d669 --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/ios-flow.yaml @@ -0,0 +1,6 @@ +appId: org.wikimedia.wikipedia +tags: + - ios + - passing +--- +- launchApp diff --git a/e2e/workspaces/wikipedia_es_ES/scripts/getSearchQuery.js b/e2e/workspaces/wikipedia_es_ES/scripts/getSearchQuery.js new file mode 100644 index 0000000000..f8a184206f --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/scripts/getSearchQuery.js @@ -0,0 +1 @@ +output.result = 'qwerty'; diff --git a/e2e/workspaces/wikipedia_es_ES/subflows/launch-clearstate-android.yaml b/e2e/workspaces/wikipedia_es_ES/subflows/launch-clearstate-android.yaml new file mode 100644 index 0000000000..6272a7014b --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/subflows/launch-clearstate-android.yaml @@ -0,0 +1,6 @@ +appId: org.wikipedia +--- +- launchApp: + clearState: true +- assertVisible: "Saltar" +- assertVisible: "CONTINUAR" \ No newline at end of file diff --git a/e2e/workspaces/wikipedia_es_ES/subflows/launch-clearstate-ios.yaml b/e2e/workspaces/wikipedia_es_ES/subflows/launch-clearstate-ios.yaml new file mode 100644 index 0000000000..befb7ca2ef --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/subflows/launch-clearstate-ios.yaml @@ -0,0 +1,6 @@ +appId: org.wikimedia.wikipedia +--- +- launchApp: + clearState: true +- assertVisible: "Siguiente" +- assertVisible: "Omitir" \ No newline at end of file diff --git a/e2e/workspaces/wikipedia_es_ES/subflows/onboarding-android.yaml b/e2e/workspaces/wikipedia_es_ES/subflows/onboarding-android.yaml new file mode 100644 index 0000000000..7aafc62f5d --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/subflows/onboarding-android.yaml @@ -0,0 +1,12 @@ +appId: org.wikipedia +--- +- launchApp: + clearState: true +- tapOn: + id: "org.wikipedia:id/fragment_onboarding_forward_button" +- tapOn: + id: "org.wikipedia:id/fragment_onboarding_forward_button" +- tapOn: + id: "org.wikipedia:id/fragment_onboarding_forward_button" +- tapOn: + id: "org.wikipedia:id/fragment_onboarding_done_button" diff --git a/e2e/workspaces/wikipedia_es_ES/subflows/onboarding-ios.yaml b/e2e/workspaces/wikipedia_es_ES/subflows/onboarding-ios.yaml new file mode 100644 index 0000000000..1e104931b0 --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/subflows/onboarding-ios.yaml @@ -0,0 +1,12 @@ +appId: org.wikimedia.wikipedia +--- +- launchApp: + clearState: true +- repeat: + times: 3 + commands: + - swipe: + direction: LEFT + duration: 400 + - waitForAnimationToEnd +- tapOn: Empezar diff --git a/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/auth/login.yml b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/auth/login.yml new file mode 100644 index 0000000000..526854599b --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/auth/login.yml @@ -0,0 +1,14 @@ +appId: org.wikipedia +--- +- tapOn: "More" +- tapOn: "LOG IN.*" +- tapOn: + id: ".*create_account_login_button" +- runScript: "../scripts/fetchTestUser.js" +- tapOn: "Username" +- inputText: "${output.test_user.username}" +- tapOn: "Password" +- inputText: "No provided" +- tapOn: "LOG IN" +- back +- back diff --git a/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/auth/signup.yml b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/auth/signup.yml new file mode 100644 index 0000000000..dc1e0218fa --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/auth/signup.yml @@ -0,0 +1,17 @@ +appId: org.wikipedia +--- +- tapOn: "More" +- tapOn: "LOG IN.*" +- runScript: "../scripts/generateCredentials.js" +- tapOn: "Username" +- inputText: "${output.credentials.username}" +- tapOn: "Password" +- inputText: "${output.credentials.password}" +- tapOn: "Repeat password" +- inputText: "${output.credentials.password}" +- tapOn: "Email.*" +- inputText: "${output.credentials.email}" + +# We won't actually create the account +- back +- back diff --git a/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/copy-paste.yml b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/copy-paste.yml new file mode 100644 index 0000000000..cf54bde7a1 --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/copy-paste.yml @@ -0,0 +1,13 @@ +appId: org.wikipedia +--- +- tapOn: "Explore" +- scrollUntilVisible: + element: "Top read" +- copyTextFrom: + id: ".*view_list_card_item_title" + index: 0 +- tapOn: "Explore" +- tapOn: "Search Wikipedia" +- inputText: "${maestro.copiedText}" +- back +- back diff --git a/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/feed.yml b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/feed.yml new file mode 100644 index 0000000000..7794f8a02d --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/feed.yml @@ -0,0 +1,7 @@ +appId: org.wikipedia +--- +- tapOn: "Explore" +- scrollUntilVisible: + element: "Today on Wikipedia.*" +- tapOn: "Today on Wikipedia.*" +- back diff --git a/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/main.yml b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/main.yml new file mode 100644 index 0000000000..a571b86ac1 --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/main.yml @@ -0,0 +1,6 @@ +appId: org.wikipedia +--- +- runFlow: "search.yml" +- runFlow: "saved.yml" +- runFlow: "feed.yml" +- runFlow: "copy-paste.yml" diff --git a/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/saved.yml b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/saved.yml new file mode 100644 index 0000000000..be21915c06 --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/saved.yml @@ -0,0 +1,7 @@ +appId: org.wikipedia +--- +- tapOn: "Saved" +- tapOn: "Default list for your saved articles" +- assertVisible: "Sun" +- assertVisible: "Star at the center of the Solar System" +- back diff --git a/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/search.yml b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/search.yml new file mode 100644 index 0000000000..5a79e8a68d --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/dashboard/search.yml @@ -0,0 +1,12 @@ +appId: org.wikipedia +--- +- tapOn: "Search Wikipedia" +- inputText: "Sun" +- assertVisible: "Star at the center of the Solar System" +- tapOn: + id: ".*page_list_item_title" +- tapOn: + id: ".*page_save" +- back +- back +- back diff --git a/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/onboarding/add-language.yml b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/onboarding/add-language.yml new file mode 100644 index 0000000000..bd498d6017 --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/onboarding/add-language.yml @@ -0,0 +1,10 @@ +appId: org.wikipedia +--- +- tapOn: "ADD OR EDIT.*" +- tapOn: "ADD LANGUAGE" +- tapOn: + id: ".*menu_search_language" +- inputText: "Greek" +- assertVisible: "Ελληνικά" +- tapOn: "Ελληνικά" +- tapOn: "Navigate up" diff --git a/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/onboarding/main.yml b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/onboarding/main.yml new file mode 100644 index 0000000000..855810f7dd --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/onboarding/main.yml @@ -0,0 +1,11 @@ +appId: org.wikipedia +--- +- runFlow: "add-language.yml" +- runFlow: "remove-language.yml" +- tapOn: "Continue" +- assertVisible: "New ways to explore" +- tapOn: "Continue" +- assertVisible: "Reading lists with sync" +- tapOn: "Continue" +- assertVisible: "Send anonymous data" +- tapOn: "Get started" diff --git a/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/onboarding/remove-language.yml b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/onboarding/remove-language.yml new file mode 100644 index 0000000000..9dfe1c1045 --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/onboarding/remove-language.yml @@ -0,0 +1,13 @@ +appId: org.wikipedia +--- +- tapOn: "ADD OR EDIT.*" +- tapOn: "More options" +- tapOn: "Remove language" +- tapOn: + id: ".*wiki_language_checkbox" + index: 1 +- tapOn: + id: ".*menu_delete_selected" +- tapOn: "OK" +- assertNotVisible: "Ελληνικά" +- tapOn: "Navigate up" diff --git a/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/run-test.yml b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/run-test.yml new file mode 100644 index 0000000000..0eaad46e06 --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/run-test.yml @@ -0,0 +1,11 @@ +appId: org.wikipedia +tags: + - android + - passing +--- +- launchApp: + clearState: true +- runFlow: "onboarding/main.yml" +- runFlow: "dashboard/main.yml" +- runFlow: "auth/signup.yml" +- runFlow: "auth/login.yml" diff --git a/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/scripts/fetchTestUser.js b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/scripts/fetchTestUser.js new file mode 100644 index 0000000000..1a058660b7 --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/scripts/fetchTestUser.js @@ -0,0 +1,13 @@ +// Fetches test user from API +function getTestUserFromApi() { + const url = `https://jsonplaceholder.typicode.com/users/1`; + var response = http.get(url); + var data = json(response.body); + + return { + username: data.username, + email: data.email, + }; +} + +output.test_user = getTestUserFromApi(); diff --git a/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/scripts/generateCredentials.js b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/scripts/generateCredentials.js new file mode 100644 index 0000000000..46f8cce261 --- /dev/null +++ b/e2e/workspaces/wikipedia_es_ES/wikipedia-android-advanced/scripts/generateCredentials.js @@ -0,0 +1,23 @@ +function username() { + var date = new Date().getTime().toString(); + var username = `test_user_placeholder`.replace("placeholder", date); + return username; +} + +function email() { + var date = new Date().getTime().toString(); + var email = `test-user-placeholder@test.com`.replace("placeholder", date); + return email; +} + +function password() { + var date = new Date().getTime().toString(); + var password = `test-user-password-placeholder`.replace("placeholder", date); + return password; +} + +output.credentials = { + email: email(), + password: password(), + username: username(), +}; diff --git a/maestro-cli/src/main/java/maestro/cli/session/MaestroSessionManager.kt b/maestro-cli/src/main/java/maestro/cli/session/MaestroSessionManager.kt index 6905798def..af0f32fdf4 100644 --- a/maestro-cli/src/main/java/maestro/cli/session/MaestroSessionManager.kt +++ b/maestro-cli/src/main/java/maestro/cli/session/MaestroSessionManager.kt @@ -73,6 +73,8 @@ object MaestroSessionManager { try { Thread.sleep(1000) // Add a 1-second delay here for fixing race condition SessionStore.heartbeat(sessionId, selectedDevice.platform) + } catch (interruptedException: InterruptedException) { + // noop if a test session was cancelled manually } catch (e: Exception) { logger.error("Failed to record heartbeat", e) }