Skip to content

Commit 0b3e0cf

Browse files
Add open_notifications. Fix #210
1 parent 05125b4 commit 0b3e0cf

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

android_tests/lib/android/specs/common/device.rb

+29
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,35 @@ def must_return_element element
9999
long_press_keycode 176
100100
end
101101

102+
t 'open_notifications' do
103+
# test & comments from https://github.com/appium/appium/blob/master/test/functional/android/apidemos/notifications-specs.js#L19
104+
# get to the notification page
105+
wait { scroll_to('App').click }
106+
wait { scroll_to('Notification').click }
107+
wait { scroll_to('Status Bar').click }
108+
# create a notification
109+
wait { button(':-|').click }
110+
open_notifications
111+
# shouldn't see the elements behind shade
112+
wait_true { !exists { find(':-|') } }
113+
# should see the notification
114+
wait_true { text_exact 'Mood ring' }
115+
# return to app
116+
back
117+
# should be able to see elements from app
118+
wait_true { button(':-|') }
119+
120+
# go back, waiting for each page to load.
121+
# if we go back using 3.times { back }
122+
# then android will flake out and discard some back events
123+
back
124+
wait { text('Status Bar') }
125+
back
126+
wait { text('Notification') }
127+
back
128+
wait { text('App') }
129+
end
130+
102131
t 'action_chain' do
103132
wait do
104133
e = find_element(:name, 'Accessibility')

lib/appium_lib/device/device.rb

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module Device
66

77
NoArgMethods = {
88
post: {
9+
open_notifications: 'session/:session_id/appium/device/open_notifications',
910
shake: 'session/:session_id/appium/device/shake',
1011
launch: 'session/:session_id/appium/app/launch',
1112
close_app: 'session/:session_id/appium/app/close',

0 commit comments

Comments
 (0)