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

feat: add e2e for device locales #2160

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 2 additions & 0 deletions e2e/update_samples
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
13 changes: 13 additions & 0 deletions e2e/workspaces/wikipedia_es_ES/android-advanced-flow.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions e2e/workspaces/wikipedia_es_ES/android-flow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
appId: org.wikipedia
tags:
- android
- passing
---
- launchApp
23 changes: 23 additions & 0 deletions e2e/workspaces/wikipedia_es_ES/ios-advanced-flow.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions e2e/workspaces/wikipedia_es_ES/ios-flow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
appId: org.wikimedia.wikipedia
tags:
- ios
- passing
---
- launchApp
1 change: 1 addition & 0 deletions e2e/workspaces/wikipedia_es_ES/scripts/getSearchQuery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
output.result = 'qwerty';
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
appId: org.wikipedia
---
- launchApp:
clearState: true
- assertVisible: "Saltar"
- assertVisible: "CONTINUAR"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
appId: org.wikimedia.wikipedia
---
- launchApp:
clearState: true
- assertVisible: "Siguiente"
- assertVisible: "Omitir"
12 changes: 12 additions & 0 deletions e2e/workspaces/wikipedia_es_ES/subflows/onboarding-android.yaml
Original file line number Diff line number Diff line change
@@ -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"
12 changes: 12 additions & 0 deletions e2e/workspaces/wikipedia_es_ES/subflows/onboarding-ios.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
appId: org.wikimedia.wikipedia
---
- launchApp:
clearState: true
- repeat:
times: 3
commands:
- swipe:
direction: LEFT
duration: 400
- waitForAnimationToEnd
- tapOn: Empezar
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
appId: org.wikipedia
---
- tapOn: "Explore"
- scrollUntilVisible:
element: "Today on Wikipedia.*"
- tapOn: "Today on Wikipedia.*"
- back
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
appId: org.wikipedia
---
- runFlow: "search.yml"
- runFlow: "saved.yml"
- runFlow: "feed.yml"
- runFlow: "copy-paste.yml"
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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();
Original file line number Diff line number Diff line change
@@ -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 = `[email protected]`.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(),
};
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Loading