We are using the Selenium Cucumber framework with Watir.
We have split one scenario into different features and all these features needs to run on one browser to complete the scenario.
Currently 1 feature completes and then the browser is closed and then a new instance of Firefox is opened; not preserving the state of the previous instance.
For our tests to run effectively, we need these features to be completed on the same browser instance.
How do we prevent a new browser instance open after each feature has been executed?
Here is our test structure:
W2.1.1-Set_Project_Information.feature
W2.1.2-Select_Shotlist.feature
W2.1.3-Flag_shotlist_requiring_physical_inspection.feature
W2.1.4-Select_applicable_shotlist_task.feature
W2.1.5-Record_Primary_Applicant.feature
My env.rb
:
require 'rubygems'
require 'watir'
require 'selenium-webdriver'
require 'rspec'
browser = Watir::Browser.new :firefox
Before do
#browser = Watir::Browser.new :chrome
@browser = browser
@browser.goto "https://test.branzartisan.com"
@browser.window.maximize
sleep(5)
puts "###Browser Invoke###"
end
After do |scenario|
@browser.cookies.clear
@browser.refresh
end