Skip to content

Commit

Permalink
add an example for after hook
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Oct 1, 2017
1 parent 9b20430 commit 3f23a8d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions example/spec/capybara_init.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'rspec'
require 'capybara'
require 'capybara/rspec'
require 'appium_capybara'
require 'site_prism'
Expand All @@ -8,10 +9,10 @@
url = "http://localhost:4723/wd/hub"

Capybara.register_driver(:appium) do |app|
all_options = caps.merge(appium_lib: {server_url: url})
puts all_options.inspect
all_options = caps.merge(appium_lib: {server_url: url})
puts all_options.inspect

Appium::Capybara::Driver.new app, all_options
Appium::Capybara::Driver.new app, all_options
end

Capybara.default_driver = :appium
2 changes: 1 addition & 1 deletion example/spec/ios_example_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
describe 'UICatalog smoke test' do
it 'should detect the nav bar' do
home_page = Pages::Home.new
expect(home_page.navigation_bar.first).to be_truthy
expect(home_page.navigation_bar.first).to be_falsey
end
end
4 changes: 4 additions & 0 deletions example/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
config.after(:each) do |result|
Capybara.current_session.driver.quit
end

config.after do |result|
Capybara.current_session.driver.save_screenshot 'error.png' if result.exception
end
end
2 changes: 1 addition & 1 deletion lib/appium_capybara/driver/appium/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def reset!
@appium_driver.reset if @appium_driver
end

# new
# @deprecated This method is being removed
def browser_initialized?
!! @browser
end
Expand Down

0 comments on commit 3f23a8d

Please sign in to comment.