Skip to content

Commit feb7f00

Browse files
committed
add context related tests
1 parent 2716285 commit feb7f00

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

test/functional/android/android/device_test.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_context_related
7979
@@driver.set_context webview_context
8080
assert @@driver.current_context.start_with? 'WEBVIEW'
8181

82-
@@driver.set_context 'NATIVE_APP'
82+
@@driver.switch_to_default_context
8383
assert_equal 'NATIVE_APP', @@driver.current_context
8484
end
8585

@@ -266,6 +266,14 @@ def test_ime_available_engins
266266
assert_equal available_ime, @@driver.ime_active_engine
267267
end
268268

269+
def test_within_context
270+
result = @@driver.within_context('NATIVE_APP') do
271+
@@core.wait { @@driver.find_element :accessibility_id, 'App' }.click
272+
end
273+
274+
assert_equal 'App', result.text
275+
end
276+
269277
private
270278

271279
def scroll_to(text)

test/functional/ios/ios/device_test.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_context_related
7474
@@driver.set_context contexts.last
7575
assert_match 'NATIVE_APP', @@driver.current_context
7676

77-
@@driver.set_context 'NATIVE_APP'
77+
@@driver.switch_to_default_context
7878
assert_equal 'NATIVE_APP', @@driver.current_context
7979

8080
@@driver.back # go to top
@@ -183,6 +183,14 @@ def test_hidekeyboard
183183

184184
@@driver.back
185185
end
186+
187+
def test_within_context
188+
result = @@driver.within_context('NATIVE_APP') do
189+
@@core.wait { @@driver.find_element :accessibility_id, 'Buttons' }.click
190+
end
191+
192+
assert_equal 'Buttons', result.name
193+
end
186194
end
187195
end
188196
end

0 commit comments

Comments
 (0)