Sha256: 21c25c57698bacfb2d125ab141ae5f7a28ce6cf1597bfaf5b60a78c2b581a97c
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
require 'quke/configuration' Before('~@nonweb') do # We have to make a special case for phantomjs when it comes to implementing # the ability to override the user agent. Unlike the selinium backed drivers # specifying the user agent is not part of the arguments we pass in when # initialising the driver. Instead its something we call on the driver once # its been instantiated # https://github.com/teampoltergeist/poltergeist#manipulating-request-headers # That might not have been so bad, the folks behind poltergeist have also # made it so that custom changes to the header only last for as long as the # test is running. Once a test finishes, the changes are lost. # Hence the only way we can ensure its set across all tests is by making use # of the Before hook, and adding the User-Agent header each time. if Quke::Quke.config.driver == 'phantomjs' unless Quke::Quke.config.user_agent.empty? page.driver.add_header( 'User-Agent', Quke::Quke.config.user_agent, permanent: true ) end end end
Version data entries
5 entries across 5 versions & 1 rubygems