Skip to content

Commit fe85b91

Browse files
committed
update screenshot tool for the master bar
1 parent 9fb30cb commit fe85b91

File tree

2 files changed

+49
-79
lines changed

2 files changed

+49
-79
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ WordPress/src/main/res/values/com_crashlytics_export_strings.xml
4646
# Monkey runner settings
4747
WordPress/src/androidTest/monkeys/settings.py
4848
*.pyc
49+
WordPress/src/androidTest/monkeys/*.png
4950

5051
# Buck
5152
.buckd

WordPress/src/androidTest/monkeys/playstore-screenshots.py

Lines changed: 48 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -21,88 +21,51 @@ def action_login(device, serialno):
2121
device.press('KEYCODE_DPAD_DOWN')
2222
time.sleep(1)
2323

24-
def action_open_drawer(device, serialno):
25-
print("open drawer")
24+
def action_open_my_sites(device, serialno):
25+
print("open my sites")
26+
device.press('KEYCODE_TAB')
2627
for i in range(5):
27-
device.press('KEYCODE_DPAD_UP')
2828
device.press('KEYCODE_DPAD_LEFT')
29-
device.press('KEYCODE_ENTER')
30-
# Wait for the animation to finish
31-
time.sleep(1)
32-
33-
# Menu drawer should be opened when calling this
34-
def action_open_notifications(device, serialno):
35-
print("open notifications")
36-
for i in range(5):
37-
device.press('KEYCODE_DPAD_UP')
38-
device.press('KEYCODE_DPAD_DOWN')
39-
device.press('KEYCODE_DPAD_DOWN')
40-
device.press('KEYCODE_ENTER')
41-
# lose focus
42-
time.sleep(1)
43-
device.press('KEYCODE_DPAD_DOWN')
4429
# Wait for gravatars to load
45-
time.sleep(10)
30+
time.sleep(2)
4631

47-
# Menu drawer should be opened when calling this
48-
def action_open_reader_posts_i_like(device, serialno):
32+
def action_open_reader_freshlypressed(device, serialno):
4933
print("open reader")
5034
# Open the reader
51-
for i in range(3):
52-
device.press('KEYCODE_DPAD_UP')
53-
device.press('KEYCODE_DPAD_DOWN')
54-
device.press('KEYCODE_ENTER')
55-
time.sleep(1)
56-
# Be sure to focus the hamburger
57-
for i in range(3):
58-
device.press('KEYCODE_DPAD_UP')
35+
for i in range(5):
5936
device.press('KEYCODE_DPAD_LEFT')
60-
# Select dropdown
6137
device.press('KEYCODE_DPAD_RIGHT')
62-
device.press('KEYCODE_ENTER')
63-
for i in range(3):
64-
device.press('KEYCODE_DPAD_UP')
65-
# Select Post I Like
66-
device.press('KEYCODE_DPAD_DOWN')
67-
device.press('KEYCODE_DPAD_DOWN')
68-
device.press('KEYCODE_ENTER')
69-
device.press('KEYCODE_SEARCH')
7038
# Wait for the reader to load articles / pictures
71-
time.sleep(10)
72-
lose_focus(serialno)
39+
time.sleep(5)
7340

74-
# Menu drawer should be opened when calling this
75-
def action_open_media(device, serialno):
76-
print("open media")
41+
def action_open_notifications(device, serialno):
42+
print("open notifications tab")
7743
# Open the reader
44+
for i in range(5):
45+
device.press('KEYCODE_DPAD_LEFT')
46+
for i in range(4):
47+
device.press('KEYCODE_DPAD_RIGHT')
48+
time.sleep(5)
49+
50+
def action_open_me(device, serialno):
51+
print("open me tab")
52+
# Open the reader
53+
for i in range(5):
54+
device.press('KEYCODE_DPAD_LEFT')
7855
for i in range(3):
79-
device.press('KEYCODE_DPAD_UP')
80-
device.press('KEYCODE_DPAD_DOWN')
81-
device.press('KEYCODE_DPAD_DOWN')
82-
device.press('KEYCODE_DPAD_DOWN')
83-
device.press('KEYCODE_DPAD_DOWN')
84-
device.press('KEYCODE_ENTER')
85-
# Wait for the reader to load articles / pictures
86-
time.sleep(10)
56+
device.press('KEYCODE_DPAD_RIGHT')
57+
time.sleep(5)
8758

88-
# Menu drawer should be opened when calling this
8959
def action_open_editor_and_type_text(device, serialno):
9060
print("open editor")
91-
# Open Posts
92-
for i in range(3):
93-
device.press('KEYCODE_DPAD_UP')
94-
device.press('KEYCODE_DPAD_DOWN')
95-
device.press('KEYCODE_DPAD_DOWN')
61+
# Open My Sites
62+
for i in range(5):
63+
device.press('KEYCODE_DPAD_LEFT')
64+
# Select FAB and open the editor
9665
device.press('KEYCODE_DPAD_DOWN')
9766
device.press('KEYCODE_ENTER')
9867
time.sleep(1)
99-
# Open editor
100-
device.press('KEYCODE_DPAD_RIGHT')
101-
device.press('KEYCODE_ENTER')
102-
time.sleep(1)
103-
device.press('KEYCODE_TAB')
104-
device.press('KEYCODE_DPAD_DOWN')
105-
# Type a sample text (spaces can't be entered via device.type())
68+
# Type a sample text (spaces can't be entered via device.type())
10669
for word in settings.example_post_content.split():
10770
device.type(word)
10871
device.press('KEYCODE_SPACE')
@@ -154,28 +117,34 @@ def back(device):
154117
# Main scenario + screenshots
155118

156119
def run_tests_for_device_and_lang(device, serialno, filename, lang, packagename, apk):
120+
# Install the apk`
157121
reinstall_apk(serialno, packagename, apk)
122+
123+
# Change language setting
158124
change_lang_settings(serialno, lang)
125+
126+
# Launch the app
159127
launch_activity(device, packagename, "org.wordpress.android.ui.WPLaunchActivity")
160128
take_screenshot(serialno, lang + "-login-screen-" + filename)
129+
130+
# Login into the app
161131
action_login(device, serialno)
162-
take_screenshot(serialno, lang + "-post-login-" + filename)
163-
action_open_drawer(device, serialno)
164-
take_screenshot(serialno, lang + "-drawer-opened-" + filename)
132+
133+
# Action!
134+
action_open_my_sites(device, serialno)
135+
take_screenshot(serialno, lang + "-1-my-sites-" + filename)
136+
action_open_reader_freshlypressed(device, serialno)
137+
take_screenshot(serialno, lang + "-2-reader-freshlypressed-" + filename)
138+
action_open_me(device, serialno)
139+
take_screenshot(serialno, lang + "-3-me-tab-" + filename)
165140
action_open_notifications(device, serialno)
166-
take_screenshot(serialno, lang + "-notifications-" + filename)
167-
action_open_drawer(device, serialno)
168-
action_open_reader_posts_i_like(device, serialno)
169-
take_screenshot(serialno, lang + "-reader-" + filename)
170-
action_open_drawer(device, serialno)
171-
action_open_media(device, serialno)
172-
take_screenshot(serialno, lang + "-media-" + filename)
173-
action_open_drawer(device, serialno)
174-
action_open_editor_and_type_text(device, serialno)
175-
take_screenshot(serialno, lang + "-editor-" + filename)
141+
take_screenshot(serialno, lang + "-4-notifications-" + filename)
142+
143+
#action_open_editor_and_type_text(device, serialno)
144+
#take_screenshot(serialno, lang + "-editor-" + filename)
176145
# Close virtual keyboard and editor
177-
back(device)
178-
back(device)
146+
#back(device)
147+
#back(device)
179148

180149
def list_devices():
181150
devices = []

0 commit comments

Comments
 (0)