Sha256: 0e1dae76b55cbc701549998f3f6c1365e82b7ae8f23f30a2a81451ac03eafbef

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

describe TestCentricity::Browsers, web: true do
  before(:context) do
    # instantiate local test environment
    @environs ||= EnvironData
    @environs.find_environ('LOCAL', :yaml)
    ENV['WEB_BROWSER'] = 'chrome_headless'
  end

  context 'web browser with multiple tabs/windows' do
    it 'returns number of browser windows/tabs' do
      WebDriverConnect.initialize_web_driver
      Capybara.current_session.open_new_window
      Capybara.current_session.open_new_window
      expect(Browsers.num_browser_instances).to eql 3
    end

    it 'closes original browser instance' do
      WebDriverConnect.initialize_web_driver
      Capybara.current_session.open_new_window
      Browsers.close_old_browser_instance
      expect(Browsers.num_browser_instances).to eql 1
    end

    it 'closes current browser instance' do
      WebDriverConnect.initialize_web_driver
      Capybara.current_session.open_new_window
      Browsers.switch_to_new_browser_instance
      Capybara.current_session.open_new_window
      Browsers.close_current_browser_instance
      expect(Browsers.num_browser_instances).to eql 2
    end
  end

  after(:each) do
    Browsers.close_all_browser_instances
    Capybara.current_session.quit
    Environ.session_state = :quit
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
testcentricity-3.0.4 spec/testcentricity/web/browser_spec.rb
testcentricity-3.0.3 spec/testcentricity/web/browser_spec.rb
testcentricity-3.0.2 spec/testcentricity/web/browser_spec.rb
testcentricity-3.0.1 spec/testcentricity/web/browser_spec.rb
testcentricity-3.0.0 spec/testcentricity/web/browser_spec.rb