|
2 | 2 |
|
3 | 3 | # $ rake test:func:ios TEST=test/functional/ios/ios/mobile_commands_test.rb
|
4 | 4 | class AppiumLibCoreTest
|
5 |
| - class DriverTest < AppiumLibCoreTest::Function::TestCase |
| 5 | + class MobileCommandsTest < AppiumLibCoreTest::Function::TestCase |
| 6 | + def setup |
| 7 | + @core = ::Appium::Core.for(Caps.ios) |
| 8 | + end |
| 9 | + |
6 | 10 | def teardown
|
7 | 11 | save_reports(@driver)
|
8 | 12 | end
|
@@ -33,5 +37,35 @@ def test_permission
|
33 | 37 | el = @driver.find_element(:accessibility_id, 'Never')
|
34 | 38 | assert_equal 'Never', el.value
|
35 | 39 | end
|
| 40 | + |
| 41 | + # @since Appium 1.10.0 |
| 42 | + def test_siri |
| 43 | + @driver = @core.start_driver |
| 44 | + assert @driver.app_state('com.example.apple-samplecode.UICatalog') == :running_in_foreground |
| 45 | + siri_state = @driver.app_state('com.apple.SiriViewService') |
| 46 | + assert [:running_in_background_suspended, :not_running].include? siri_state |
| 47 | + |
| 48 | + @driver.execute_script 'mobile: activateSiri', { text: 'hello, siri' } |
| 49 | + |
| 50 | + e = @driver.find_element :accessibility_id, 'hello, siri' |
| 51 | + assert_equal 'hello, siri', e.text |
| 52 | + |
| 53 | + assert_equal :running_in_foreground, @driver.app_state('com.example.apple-samplecode.UICatalog') |
| 54 | + assert @driver.app_state('com.apple.SiriViewService') == :running_in_background |
| 55 | + |
| 56 | + @driver.activate_app 'com.example.apple-samplecode.UICatalog' |
| 57 | + sleep 1 # wait a bit for switching siri service with the test target app |
| 58 | + assert_equal :running_in_background_suspended, @driver.app_state('com.apple.SiriViewService') |
| 59 | + end |
| 60 | + |
| 61 | + def test_source |
| 62 | + @driver = @core.start_driver |
| 63 | + |
| 64 | + json = @driver.execute_script 'mobile: source', { format: :json } |
| 65 | + xml = @driver.execute_script 'mobile: source', { format: :xml } |
| 66 | + |
| 67 | + assert !json.empty? |
| 68 | + assert !xml.empty? |
| 69 | + end |
36 | 70 | end
|
37 | 71 | end
|
0 commit comments