Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for proxy servers #47

Merged
merged 3 commits into from
Nov 29, 2016
Merged

Conversation

Cruikshanks
Copy link
Member

@Cruikshanks Cruikshanks commented Nov 28, 2016

This change adds support to Quke to specify a proxy server when using the PhantomJS, Firefox, and Chrome drivers.

The reasoning is that a connection to the internet may be been setup to go via a proxy server for security purposes in some build environments. With no way currently to tell Quke, it would not be able to access the site under test.

To add this support the following changes have been made

  • Quke::Configuration will now accept a new section in the .config.yml called proxy, containing the values host and port
  • Quke::Configuration has a new helper method which returns whether proxy settings need to be applied to the driver
  • Quke::DriverRegistration now contains logic specific to each driver for specifying proxy details (if required)
  • The methods which returned config options for Poltergeist and PhantomJS have been moved to Quke::DriverRegistration (more details below)

Though it was envisaged that users could set the options for each driver by simply adding some key value pairs into the .config.yml, adding support for using a proxy has shown in practise this is not always the case. For example we need to instantiate a Selenium::WebDriver::Firefox::Profile.new in order to support setting the proxy for the Firefox driver.

Therefore these place holders for passing in options have been removed, and the driver configuration for poltergeist and phantomjs has been moved out of Quke::Configuration into Quke::DriverRegistration. This brings it inline with the other drivers and now means Quke::Configuration is responsible solely for what is (or can be) specified in the config yml file.

@Cruikshanks Cruikshanks added the enhancement New feature or request label Nov 28, 2016
@Cruikshanks Cruikshanks self-assigned this Nov 28, 2016
@Cruikshanks Cruikshanks force-pushed the feature/use-proxy-with-drivers branch from 981b0a3 to 92903d0 Compare November 29, 2016 00:38
@Cruikshanks Cruikshanks changed the title Add ability to set proxy for selenium/phantomjs Add support for proxy servers Nov 29, 2016
@Cruikshanks Cruikshanks force-pushed the feature/use-proxy-with-drivers branch from 92903d0 to bfdeeb7 Compare November 29, 2016 08:37
This change adds support to **Quke** to specify a proxy server when using the **PhantomJS**, **Firefox**, and **Chrome** drivers.

The reasoning is that a connection to the internet may be been setup to go via a proxy server for security purposes in some build environments. With no way currently to tell **Quke**, it would not be able to access the site under test.

To add this support the following changes have been made

- `Quke::Configuration` will now accept a new section in the `.config.yml` called `proxy`, containing the values `host` and `port`
- `Quke::Configuration` has a new helper method which returns whether proxy settings need to be applied to the driver
- `Quke::DriverRegistration` now contains logic specific to each driver for specifying proxy details (if required)
- The methods which returned config options for **Poltergeist** and **PhantomJS** have been moved to `Quke::DriverRegistration` (more details below)

Though it was envisaged that users could set the options for each driver by simply adding some key value pairs into the `.config.yml`, adding support for using a proxy has shown in practise this is not always the case. For example we need to instantiate a `Selenium::WebDriver::Firefox::Profile.new` in order to support setting the proxy for the Firefox driver.

Therefore these place holders for passing in options have been removed, and the driver configuration for poltergeist and phantomjs has been moved out of `Quke::Configuration` into `Quke::DriverRegistration`. This brings it inline with the other drivers and now means `Quke::Configuration` is responsible solely for what is (or can be) specified in the config yml file.
@Cruikshanks Cruikshanks force-pushed the feature/use-proxy-with-drivers branch from bfdeeb7 to a192b06 Compare November 29, 2016 15:33
Completing the changes for proxy server support ( 62d33f9 ) meant adding more configuration logic to the existing `Quke::DriverRegistration` class. This put it over the line of being **monolithic**, and felt like we were mixing two different domains; the driver registration logic, and the logic for determining each driver's configuration settings.

So this change moves the driver configuration logic into a new class called `Quke::DriverConfiguration`. This has led to knock on changes of how we initialise each of the objects, and how each driver is registered.

The benefits are that both classes are now much easier to maintain, and more of our code has test coverage (something that helped spot some omissions in setting up the **Browserstack** capabilities).
Found that these files did not have execute permissions when we attempted to use them so this change fixes that.

It also adds `require`'s for all the **Quke** classes, which should make working with them in IRB a little easier.
@Cruikshanks Cruikshanks force-pushed the feature/use-proxy-with-drivers branch from a192b06 to c8b86f0 Compare November 29, 2016 15:46
@Cruikshanks
Copy link
Member Author

This will resolve #46 when its merged.

@Cruikshanks Cruikshanks merged commit ab3fdb6 into master Nov 29, 2016
@Cruikshanks Cruikshanks deleted the feature/use-proxy-with-drivers branch November 29, 2016 15:50
Cruikshanks added a commit that referenced this pull request Dec 1, 2016
Having previously thought we had done enough to support using **Quke** in an environment where a proxy server is in use (PR #47), we found that is not the case. The problem is that a common configuration is to only use the proxy server when making external connections, but not for local ones.

So without the ability to allow **Quke** to configure the drivers in this was, when the **selenium** based drivers attempt to make local connections to the selenium server **Quke** falls over.

This change will add support for specifying this option. In the same manner as PR #47 the user simply has to provide the details in the config file, **Quke** will handle how to configure the drivers with this information when registering them with [Capybara](https://github.com/teamcapybara/capybara).
Cruikshanks added a commit that referenced this pull request Dec 2, 2016
Having previously thought we had done enough to support using **Quke** in an environment where a proxy server is in use (PR #47), we found that is not the case. The problem is that a common configuration is to only use the proxy server when making external connections, but not for local ones.

So without the ability to allow **Quke** to configure the drivers in this was, when the **selenium** based drivers attempt to make local connections to the selenium server **Quke** falls over.

This change will add support for specifying this option. In the same manner as PR #47 the user simply has to provide the details in the config file, **Quke** will handle how to configure the drivers with this information when registering them with [Capybara](https://github.com/teamcapybara/capybara).
Cruikshanks added a commit that referenced this pull request Dec 2, 2016
Having previously thought we had done enough to support using **Quke** in an environment where a proxy server is in use (PR #47), we found that is not the case. The problem is that a common configuration is to only use the proxy server when making external connections, but not for local ones.

So without the ability to allow **Quke** to configure the drivers in this was, when the **selenium** based drivers attempt to make local connections to the selenium server **Quke** falls over.

This change will add support for specifying this option. In the same manner as PR #47 the user simply has to provide the details in the config file, **Quke** will handle how to configure the drivers with this information when registering them with [Capybara](https://github.com/teamcapybara/capybara).
Cruikshanks added a commit that referenced this pull request Dec 2, 2016
Having previously thought we had done enough to support using **Quke** in an environment where a proxy server is in use (PR #47), we found that is not the case. The problem is that a common configuration is to only use the proxy server when making external connections, but not for local ones.

So without the ability to allow **Quke** to configure the drivers in this was, when the **selenium** based drivers attempt to make local connections to the selenium server **Quke** falls over.

This change will add support for specifying this option. In the same manner as PR #47 the user simply has to provide the details in the config file, **Quke** will handle how to configure the drivers with this information when registering them with [Capybara](https://github.com/teamcapybara/capybara).
Cruikshanks added a commit that referenced this pull request Dec 13, 2016
Having previously thought we had done enough to support using **Quke** in an environment where a proxy server is in use (PR #47), we found that is not the case. The problem is that a common configuration is to only use the proxy server when making external connections, but not for local ones.

So without the ability to allow **Quke** to configure the drivers in this was, when the **selenium** based drivers attempt to make local connections to the selenium server **Quke** falls over.

This change will add support for specifying this option. In the same manner as PR #47 the user simply has to provide the details in the config file, **Quke** will handle how to configure the drivers with this information when registering them with [Capybara](https://github.com/teamcapybara/capybara).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant