Skip to content
Merged
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
7 changes: 7 additions & 0 deletions ios_tests/lib/ios/specs/ios/command/source.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# rake ios[ios/command/source]
describe 'ios/command/source' do
t 'source' do
xcuitest_source(format: :json).is_a?(Hash).must_equal true
xcuitest_source(format: :xml).is_a?(String).must_equal true
end
end
1 change: 1 addition & 0 deletions lib/appium_lib/ios/xcuitest/bridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def self.for(target)
target.extend Appium::Ios::Device
target.extend Appium::Ios::Xcuitest
target.extend Appium::Ios::Xcuitest::Command
target.extend Appium::Ios::Xcuitest::Source
target.extend Appium::Ios::Xcuitest::Helper
target.extend Appium::Ios::Xcuitest::Gesture
target.extend Appium::Ios::Xcuitest::Element
Expand Down
1 change: 1 addition & 0 deletions lib/appium_lib/ios/xcuitest/command.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require_relative 'command/pasteboard'
require_relative 'command/gestures'
require_relative 'command/source'

module Appium
module Ios
Expand Down
20 changes: 20 additions & 0 deletions lib/appium_lib/ios/xcuitest/command/source.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Appium
module Ios
module Xcuitest
module Source
# @param [String|Symbol] format :xml or :json. :xml is by default.
# @option opts [Element] :element Element to swipe on
#
# ```ruby
# xcuitest_source format: :json
# ```
def xcuitest_source(format: :xml)
format = format.to_s if format.is_a? Symbol
args = { format: format }

@driver.execute_script 'mobile: source', args
end
end # module Gesture
end # module Xcuitest
end # module Ios
end # module Appium