project/features/support/hooks.rb in Ifd_Mobile-1.4.0 vs project/features/support/hooks.rb in Ifd_Mobile-1.5.0
- old
+ new
@@ -1,9 +1,35 @@
-Before { $driver.start_driver }
-
-After do
- begin
- selenium.driver_quit
- rescue StandardError => myStandardError
- puts "\nERROR: *** #{myStandardError}"
- end
+Before do | scenario |
+ # need to configure env variables for browser
+ caps = {
+ caps: {
+ browserName: "#{ENV['browserName']}",
+ platformVersion: "#{ENV['platformVersion']}",
+ deviceName: "#{ENV['deviceName']}",
+ platformName: "#{ENV['platformName']}",
+ fullReset: false,
+ noReset: true,
+ dontStopAppOnReset: true,
+ app: "#{ENV['app']}"
+ },
+ appium_lib: {
+ server_url: "http://#{ENV['server_url']}/wd/hub"
+ }
+ }
+
+ @driver = Appium::Driver.new(caps,true)
+ @driver.start_driver
+end
+
+After do | scenario |
+ sessionid = @driver.session_id
+ jobname = "#{scenario.feature.name} - #{scenario.name}"
+ puts "SessionID=#{sessionid} job-name=#{jobname}"
+
+ @driver.driver_quit
+ #
+ # if scenario.passed?
+ # SauceWhisk::Jobs.pass_job sessionid
+ # else
+ # SauceWhisk::Jobs.fail_job sessionid
+ # end
end
\ No newline at end of file