5

So I'm trying to test deep links.

The process we use locally is to first run a simple test (checking that the app loaded) with the appium --no-reset cap. This ensures that the app is present on the simulator when we try to navigate to it from safari.

# env.rb

caps = {
  caps: {
    appiumVersion: "1.4.3",
    deviceName: "iPhone 6",
    "device-orientation" => "portrait",
    platformName: "iOS",
    platformVersion: ENV['IOS_VERSION'],
    app: ENV['APP_PATH'],
    browserName: '',
    noReset: 'true'
    build: ENV['BUILD_TAG'],
  },
  appium_lib: {
    sauce_username: ENV['SAUCE_USER_NAME'],
    sauce_access_key: ENV['SAUCE_API_KEY'],
  }
}

Appium::Driver.new(caps)

Before do |scenario|
  $driver.start_driver
end

Next we run a cucumber step that starts a new driver to use safari to access the app through the deep link

# deep_link_steps.rb 

safari_caps =
  $driver.caps.deep_merge(
{
  browserName: 'safari',
  noReset: 'true',
  app: 'nil'
})

@safari_driver = Appium::Driver.new(caps: safari_caps)
@safari_driver.start_driver

# changing timeout keeps it from hanging on app load  
driver.manage.timeouts.page_load = 5
# uses webdriver to go to the link  
driver.get("AppName://SomewhereInTheApp")
# changing the context allows us to inspect the native app
@safari_driver.set_context('NATIVE_APP')

So we can't get this to work since it appears sauce kills the session when the driver changes. This negates the first step which installs the app, it also seems that you can't pass an app and a browser cap to sauce in the same session.

Has anyone dealt with anything like this?

Joe Susnick
  • 5,298
  • 4
  • 35
  • 47

0 Answers0