mercredi 21 décembre 2016

Got "uninitialized constant Selenium::RSpec" error when trying to use "capture_system_state" method from "selenium-client" lib (Ruby + Appium + Rspec)

I have the following code:

require 'rubygems'
require 'rspec/core'
require 'touch_action'
require 'appium_lib'
require 'rspec/expectations'
require "selenium"
require "selenium/client"
require "selenium-client"

RSpec.configure do |config|
  config.include RSpec::Matchers
  config.include Selenium
  config.before(:example) do |example|
    desired_caps = {
        caps: {
            platformName: 'Android',
            versionNumber: '6.0.1',
            deviceName: 'Galaxy S6',
            device: 'Android',
            takesScreenshot: true,
            screenshotWaitTimeout: 20,
            app: '../app-mockBLE_SK.apk'
        }
    }

    @driver = Appium::Driver.new(desired_caps).start_driver
    @driver.manage.timeouts.implicit_wait = 120
  end
  Appium::Logger.level = Logger::INFO

  config.after do |result|
    a = Selenium::RSpec::Reporting::SystemCapture.capture_system_state(@driver, self)
    puts a.to_s
    driver.save_screenshot '../Reports/1.png'
    @driver.remove_app 'com.medtronicndt.envisionpro.mock'
    @driver.quit
  end

end

But when I run my TC I see "uninitialized constant Selenium::RSpec" error. Why it doesn't allows me to call "capture_system_state" method? The reason of I am trying call this method is to determine when TC fails and do screenshot.

Aucun commentaire:

Enregistrer un commentaire