Sha256: 02fd48b0cf9c740698c7d70b66f4dd39facab370d68eb5a5418c8e15e9952447

Contents?: true

Size: 1.05 KB

Versions: 13

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

RSpec.configure do |config|
  config.before(:each, :js => true) do
    config.rspeckled_logger.debug("Before Each  - Start - #{__FILE__}")

    page.driver.reset!

    config.rspeckled_logger.debug("Before Each  - End   - #{__FILE__}")
  end

  # Focus The Browser on Activation
  config.around(:each, :js => true, :autofocus => true) do |example|
    config.rspeckled_logger.debug("Around Each  - Start - #{__FILE__}")

    browser_name = example.metadata[:driver].to_s.capitalize

    ::Thread.new do
      sleep 1.5

      `
        osascript -e '
          tell the application named "#{browser_name}"
            activate

            set theWindow to the first item of windows

            if index of theWindow is not 1 then
              set index to 1
              set visible to false
              set visible to true
            end if
          end tell
        ' > /dev/null
      `
    end

    example.run

    sleep example.metadata[:delay]

    config.rspeckled_logger.debug("Around Each  - End   - #{__FILE__}")
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rspeckled-2.0.1 lib/rspeckled/plugins/hooks/capybara.rb
rspeckled-2.0.0 lib/rspeckled/plugins/hooks/capybara.rb
rspeckled-1.4.0 lib/rspeckled/plugins/hooks/capybara.rb
rspeckled-1.3.1 lib/rspeckled/plugins/hooks/capybara.rb
rspeckled-1.3.0 lib/rspeckled/plugins/hooks/capybara.rb
rspeckled-1.2.1 lib/rspeckled/plugins/hooks/capybara.rb
rspeckled-1.2.0 lib/rspeckled/plugins/hooks/capybara.rb
rspeckled-1.1.3 lib/rspeckled/plugins/hooks/capybara.rb
rspeckled-1.1.2 lib/rspeckled/plugins/hooks/capybara.rb
rspeckled-1.1.1 lib/rspeckled/plugins/hooks/capybara.rb
rspeckled-1.1.0 lib/rspeckled/plugins/hooks/capybara.rb
rspeckled-1.0.5 lib/rspeckled/plugins/hooks/capybara.rb
rspeckled-1.0.4 lib/rspeckled/plugins/hooks/capybara.rb