如何使用 SauceLabs、Appium 和 Cucumber 在 iOS 上测试深度链接

Joe*_*ick 5 automated-tests cucumber ios saucelabs appium

所以我正在尝试测试深层链接。

我们在本地使用的过程是首先使用 appium --no-reset cap 运行一个简单的测试(检查应用程序是否已加载)。这确保了当我们尝试从 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
Run Code Online (Sandbox Code Playgroud)

接下来我们运行一个黄瓜步骤,启动一个新的驱动程序来使用 safari 通过深层链接访问应用程序

# 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')
Run Code Online (Sandbox Code Playgroud)

所以我们不能让它工作,因为当驱动程序改变时,酱汁似乎会终止会话。这否定了安装应用程序的第一步,似乎您也无法在同一会话中将应用程序和浏览器上限传递给酱汁。

有没有人处理过这样的事情?