Skip to content

Commit

Permalink
Option to select WebDriver port and allow insecure SSL cert (#482)
Browse files Browse the repository at this point in the history
* Option to select WebDriver port and allow insecure SSL cert
* Added configuration flag to specifiy port number for the WebDriver instance to listen on (instead of the default randomized one). Currently, Chrome-family ONLY!
* Added configuration flag to allow insecure SSL certs to be accepted, as without this, Chrome Headless is all but useless. Currently, Chrome-family ONLY!
* Added documentation of above mentioned changes in correct file.
* A lot of stylistic cleanup, reformatting and reflowing suggested by Fantomas formatter tool.

* Option to select WebDriver port and allow insecure SSL cert
* Added configuration flag to specify port number for the WebDriver instance to listen on (instead of the default randomized one). Currently Chrome-family ONLY!
* Added configuration flag to allow insecure SSL certs to be accepted, as without this, Chrome Headless is all but useless. Currently, Chrome-Family ONLY!
* Added documentation of above mentioned changes in correct file.
  • Loading branch information
OmanF authored and lefthandedgoat committed Oct 21, 2019
1 parent d68ca55 commit fc048ba
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/content/configuration.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,21 @@ failureMessagesThatShoulBeTreatedAsSkip
* Default is empty list
*)
failureMessagesThatShoulBeTreatedAsSkip <- ["message 1"; "message 2"]

(**
webdriverPort
------------
* Allow specifying a port on which the **WebDriver** instance wil start (instead of a random one)
* Defualt is `None` and it **must** be an `Option` type, i.e. `None` or `Some x`
* Do **NOT** use if running tests in parallel!
*)
webdriverPort <- Some 4444

(**
acceptInsecureSslCerts
------------
* Allow the driver to navigate to sites with self-signed SSL certificates
* Crucial for Chrome Headless testing
* Default is true
*)
acceptInsecureSslCerts <- true
6 changes: 6 additions & 0 deletions src/canopy/canopy.parallell.functions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,12 @@ let private chromeDriverService dir =
let service = Chrome.ChromeDriverService.CreateDefaultService(dir);
service.HostName <- driverHostName
service.HideCommandPromptWindow <- hideCommandPromptWindow;
match acceptInsecureSslCerts with
| false -> ()
| true -> service.WhitelistedIPAddresses <- ""
match webdriverPort with
| Some value -> service.Port <- value
| None -> ()
service

let private chromeWithUserAgent dir userAgent =
Expand Down
4 changes: 4 additions & 0 deletions src/canopy/configuration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ let mutable skipRemainingTestsInContextOnFailure = false
let mutable failureMessagesThatShoulBeTreatedAsSkip : string list = []
(* documented/configuration *)
let mutable driverHostName = "127.0.0.1"
(* documented/configuration *)
let mutable webdriverPort: int option = None
(* documented/configuration *)
let mutable acceptInsecureSslCerts = true

//do not touch
let mutable wipTest = false

0 comments on commit fc048ba

Please sign in to comment.