quke 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27be44353121331dc3014432665279b4fe608e67
4
- data.tar.gz: bc5a878ce04b08f922b07a9a7095850431c6c01f
3
+ metadata.gz: 1bb1e5484a903fbc8b00b9d67b3eabc25a2abf6e
4
+ data.tar.gz: 6d19bda0cc6cd6837a10518e62afb43378f7d6f5
5
5
  SHA512:
6
- metadata.gz: 483988fb09729678369293055188026e51e7fb17579681a0a0cbe151b6199e0e985fd017f818796fe3f8e42bd24c976e8af9baf01043915ee5c48fe03c2197a8
7
- data.tar.gz: e516dd83556b3a6c0b6da0f2bd4d02f254b766c1b4cf44cae7eab7de85bf69998cbafd9000b27c68c8bb175596ca0b531cbebd1cb860f084af06a9e1e6863e40
6
+ metadata.gz: 3a00d9f8f551ff3457facfd76de6c95e0c99e114ecd54ea5ff5d405d1b52b7022709ca522a65de7a9a8653277058af329d231039465377ed80f8f26090465674
7
+ data.tar.gz: 428e1141fa40375500a329a665afc474fb43ad261060b53f02b6a039d23e3401b88a27e0e6f75988fb6ec65165b136aa3d206092a7b9f2e9751babaaf6be785f
@@ -31,6 +31,14 @@ stop_on_error: 1
31
31
  # elements that take some time to load you can increase this default.
32
32
  max_wait_time: 5
33
33
 
34
+ # Tell the driver Quke is using to send a different user-agent value to the site
35
+ # under test. Useful if you want the underlying driver to spoof what kind of
36
+ # browser the request is coming from. For example you may want to pretend to be
37
+ # a mobile browser so you can check what you get back versus the desktop
38
+ # version. Or you want to pretend to be another kind of browser, because the one
39
+ # you have is not supported by the site.
40
+ user_agent: "Mozilla/5.0 (MSIE 10.0; Windows NT 6.1; Trident/5.0)"
41
+
34
42
  # Anything you place under the 'custom' node in the `.config.yml` file will be
35
43
  # available within your steps and page objects by calling
36
44
  # `Quke::Quke.config.custom`. So using the example below we could access its
data/.gitignore CHANGED
@@ -16,7 +16,7 @@ vendor/overcommit_bundle
16
16
  /tags
17
17
 
18
18
  *~
19
- .DS_Store
19
+ *.DS_Store
20
20
  .svn
21
21
  .*.swp
22
22
  ___*
@@ -1,117 +1,131 @@
1
1
  # Change Log
2
2
 
3
- ## [Unreleased](https://github.com/EnvironmentAgency/quke/tree/HEAD)
3
+ ## [v0.3.0](https://github.com/DEFRA/quke/tree/v0.3.0) (2017-03-07)
4
+ [Full Changelog](https://github.com/DEFRA/quke/compare/v0.2.8...v0.3.0)
4
5
 
5
- [Full Changelog](https://github.com/EnvironmentAgency/quke/compare/v0.2.7...HEAD)
6
+ **Merged pull requests:**
7
+
8
+ - Add ability to pass in custom values via config [\#55](https://github.com/DEFRA/quke/pull/55) ([Cruikshanks](https://github.com/Cruikshanks))
9
+ - Fix missing documentation for max\_wait\_time [\#54](https://github.com/DEFRA/quke/pull/54) ([Cruikshanks](https://github.com/Cruikshanks))
10
+ - Expose Capybara default\_max\_wait\_time config value [\#53](https://github.com/DEFRA/quke/pull/53) ([Cruikshanks](https://github.com/Cruikshanks))
11
+
12
+ ## [v0.2.8](https://github.com/DEFRA/quke/tree/v0.2.8) (2017-01-20)
13
+ [Full Changelog](https://github.com/DEFRA/quke/compare/v0.2.7...v0.2.8)
14
+
15
+ **Closed issues:**
16
+
17
+ - Handling tests using javascript during headless testing [\#27](https://github.com/DEFRA/quke/issues/27)
6
18
 
7
19
  **Merged pull requests:**
8
20
 
9
- - Add support 4 setting 'no proxy' arg. in drivers [\#49](https://github.com/EnvironmentAgency/quke/pull/49) ([Cruikshanks](https://github.com/Cruikshanks))
21
+ - Update EA references after org name change [\#52](https://github.com/DEFRA/quke/pull/52) ([Cruikshanks](https://github.com/Cruikshanks))
22
+ - \[ci skip\] Updating CHANGELOG.md [\#51](https://github.com/DEFRA/quke/pull/51) ([Cruikshanks](https://github.com/Cruikshanks))
23
+ - Add support 4 setting 'no proxy' arg. in drivers [\#49](https://github.com/DEFRA/quke/pull/49) ([Cruikshanks](https://github.com/Cruikshanks))
10
24
 
11
- ## [v0.2.7](https://github.com/EnvironmentAgency/quke/tree/v0.2.7) (2016-12-13)
12
- [Full Changelog](https://github.com/EnvironmentAgency/quke/compare/v0.2.6...v0.2.7)
25
+ ## [v0.2.7](https://github.com/DEFRA/quke/tree/v0.2.7) (2016-12-13)
26
+ [Full Changelog](https://github.com/DEFRA/quke/compare/v0.2.6...v0.2.7)
13
27
 
14
- ## [v0.2.6](https://github.com/EnvironmentAgency/quke/tree/v0.2.6) (2016-11-29)
15
- [Full Changelog](https://github.com/EnvironmentAgency/quke/compare/v0.2.5...v0.2.6)
28
+ ## [v0.2.6](https://github.com/DEFRA/quke/tree/v0.2.6) (2016-11-29)
29
+ [Full Changelog](https://github.com/DEFRA/quke/compare/v0.2.5...v0.2.6)
16
30
 
17
31
  **Closed issues:**
18
32
 
19
- - Ability to specify a proxy for each driver [\#46](https://github.com/EnvironmentAgency/quke/issues/46)
20
- - focus label left against rspec tests stops all tests running [\#43](https://github.com/EnvironmentAgency/quke/issues/43)
33
+ - Ability to specify a proxy for each driver [\#46](https://github.com/DEFRA/quke/issues/46)
34
+ - focus label left against rspec tests stops all tests running [\#43](https://github.com/DEFRA/quke/issues/43)
21
35
 
22
36
  **Merged pull requests:**
23
37
 
24
- - Update version for merge of proxy server support [\#48](https://github.com/EnvironmentAgency/quke/pull/48) ([Cruikshanks](https://github.com/Cruikshanks))
25
- - Add support for proxy servers [\#47](https://github.com/EnvironmentAgency/quke/pull/47) ([Cruikshanks](https://github.com/Cruikshanks))
26
- - \[ci skip\] Updating CHANGELOG.md [\#45](https://github.com/EnvironmentAgency/quke/pull/45) ([Cruikshanks](https://github.com/Cruikshanks))
38
+ - Update version for merge of proxy server support [\#48](https://github.com/DEFRA/quke/pull/48) ([Cruikshanks](https://github.com/Cruikshanks))
39
+ - Add support for proxy servers [\#47](https://github.com/DEFRA/quke/pull/47) ([Cruikshanks](https://github.com/Cruikshanks))
40
+ - \[ci skip\] Updating CHANGELOG.md [\#45](https://github.com/DEFRA/quke/pull/45) ([Cruikshanks](https://github.com/Cruikshanks))
27
41
 
28
- ## [v0.2.5](https://github.com/EnvironmentAgency/quke/tree/v0.2.5) (2016-11-28)
29
- [Full Changelog](https://github.com/EnvironmentAgency/quke/compare/v0.2.4...v0.2.5)
42
+ ## [v0.2.5](https://github.com/DEFRA/quke/tree/v0.2.5) (2016-11-28)
43
+ [Full Changelog](https://github.com/DEFRA/quke/compare/v0.2.4...v0.2.5)
30
44
 
31
45
  **Closed issues:**
32
46
 
33
- - Don't use driver as an assumption of running on CI [\#41](https://github.com/EnvironmentAgency/quke/issues/41)
47
+ - Don't use driver as an assumption of running on CI [\#41](https://github.com/DEFRA/quke/issues/41)
34
48
 
35
49
  **Merged pull requests:**
36
50
 
37
- - Fix rspec focus label left in tests [\#44](https://github.com/EnvironmentAgency/quke/pull/44) ([Cruikshanks](https://github.com/Cruikshanks))
51
+ - Fix rspec focus label left in tests [\#44](https://github.com/DEFRA/quke/pull/44) ([Cruikshanks](https://github.com/Cruikshanks))
38
52
 
39
- ## [v0.2.4](https://github.com/EnvironmentAgency/quke/tree/v0.2.4) (2016-11-28)
40
- [Full Changelog](https://github.com/EnvironmentAgency/quke/compare/v0.2.3...v0.2.4)
53
+ ## [v0.2.4](https://github.com/DEFRA/quke/tree/v0.2.4) (2016-11-28)
54
+ [Full Changelog](https://github.com/DEFRA/quke/compare/v0.2.3...v0.2.4)
41
55
 
42
56
  **Closed issues:**
43
57
 
44
- - Launchy showing blank pages on error [\#39](https://github.com/EnvironmentAgency/quke/issues/39)
58
+ - Launchy showing blank pages on error [\#39](https://github.com/DEFRA/quke/issues/39)
45
59
 
46
60
  **Merged pull requests:**
47
61
 
48
- - Change after\_hook error to use config not assume [\#42](https://github.com/EnvironmentAgency/quke/pull/42) ([Cruikshanks](https://github.com/Cruikshanks))
62
+ - Change after\_hook error to use config not assume [\#42](https://github.com/DEFRA/quke/pull/42) ([Cruikshanks](https://github.com/Cruikshanks))
49
63
 
50
- ## [v0.2.3](https://github.com/EnvironmentAgency/quke/tree/v0.2.3) (2016-10-05)
51
- [Full Changelog](https://github.com/EnvironmentAgency/quke/compare/v0.2.2...v0.2.3)
64
+ ## [v0.2.3](https://github.com/DEFRA/quke/tree/v0.2.3) (2016-10-05)
65
+ [Full Changelog](https://github.com/DEFRA/quke/compare/v0.2.2...v0.2.3)
52
66
 
53
67
  **Merged pull requests:**
54
68
 
55
- - Fix Quke not loading .config.yml correctly [\#37](https://github.com/EnvironmentAgency/quke/pull/37) ([Cruikshanks](https://github.com/Cruikshanks))
56
- - Update CHANGELOG.md [\#36](https://github.com/EnvironmentAgency/quke/pull/36) ([Cruikshanks](https://github.com/Cruikshanks))
69
+ - Fix Quke not loading .config.yml correctly [\#37](https://github.com/DEFRA/quke/pull/37) ([Cruikshanks](https://github.com/Cruikshanks))
70
+ - Update CHANGELOG.md [\#36](https://github.com/DEFRA/quke/pull/36) ([Cruikshanks](https://github.com/Cruikshanks))
57
71
 
58
- ## [v0.2.2](https://github.com/EnvironmentAgency/quke/tree/v0.2.2) (2016-10-05)
59
- [Full Changelog](https://github.com/EnvironmentAgency/quke/compare/v0.2.1...v0.2.2)
72
+ ## [v0.2.2](https://github.com/DEFRA/quke/tree/v0.2.2) (2016-10-05)
73
+ [Full Changelog](https://github.com/DEFRA/quke/compare/v0.2.1...v0.2.2)
60
74
 
61
75
  **Merged pull requests:**
62
76
 
63
- - Fix Cucumber not loading lib/features correctly [\#35](https://github.com/EnvironmentAgency/quke/pull/35) ([Cruikshanks](https://github.com/Cruikshanks))
64
- - Add Github\_changelog\_generator support [\#34](https://github.com/EnvironmentAgency/quke/pull/34) ([Cruikshanks](https://github.com/Cruikshanks))
65
- - Add Rubygems version badge to README [\#33](https://github.com/EnvironmentAgency/quke/pull/33) ([Cruikshanks](https://github.com/Cruikshanks))
77
+ - Fix Cucumber not loading lib/features correctly [\#35](https://github.com/DEFRA/quke/pull/35) ([Cruikshanks](https://github.com/Cruikshanks))
78
+ - Add Github\_changelog\_generator support [\#34](https://github.com/DEFRA/quke/pull/34) ([Cruikshanks](https://github.com/Cruikshanks))
79
+ - Add Rubygems version badge to README [\#33](https://github.com/DEFRA/quke/pull/33) ([Cruikshanks](https://github.com/Cruikshanks))
66
80
 
67
- ## [v0.2.1](https://github.com/EnvironmentAgency/quke/tree/v0.2.1) (2016-10-05)
68
- [Full Changelog](https://github.com/EnvironmentAgency/quke/compare/v0.2.0...v0.2.1)
81
+ ## [v0.2.1](https://github.com/DEFRA/quke/tree/v0.2.1) (2016-10-05)
82
+ [Full Changelog](https://github.com/DEFRA/quke/compare/v0.2.0...v0.2.1)
69
83
 
70
84
  **Merged pull requests:**
71
85
 
72
- - Remove bundler-audit from codeclimate config [\#32](https://github.com/EnvironmentAgency/quke/pull/32) ([Cruikshanks](https://github.com/Cruikshanks))
86
+ - Remove bundler-audit from codeclimate config [\#32](https://github.com/DEFRA/quke/pull/32) ([Cruikshanks](https://github.com/Cruikshanks))
73
87
 
74
- ## [v0.2.0](https://github.com/EnvironmentAgency/quke/tree/v0.2.0) (2016-10-04)
75
- [Full Changelog](https://github.com/EnvironmentAgency/quke/compare/v0.1.0...v0.2.0)
88
+ ## [v0.2.0](https://github.com/DEFRA/quke/tree/v0.2.0) (2016-10-04)
89
+ [Full Changelog](https://github.com/DEFRA/quke/compare/v0.1.0...v0.2.0)
76
90
 
77
91
  **Merged pull requests:**
78
92
 
79
- - Convert to gem [\#31](https://github.com/EnvironmentAgency/quke/pull/31) ([Cruikshanks](https://github.com/Cruikshanks))
93
+ - Convert to gem [\#31](https://github.com/DEFRA/quke/pull/31) ([Cruikshanks](https://github.com/Cruikshanks))
80
94
 
81
- ## [v0.1.0](https://github.com/EnvironmentAgency/quke/tree/v0.1.0) (2016-08-01)
95
+ ## [v0.1.0](https://github.com/DEFRA/quke/tree/v0.1.0) (2016-08-01)
82
96
  **Closed issues:**
83
97
 
84
- - save\_and\_open\_page\(\) outputs to project root [\#12](https://github.com/EnvironmentAgency/quke/issues/12)
85
- - Use Capybara's implicit wait system [\#9](https://github.com/EnvironmentAgency/quke/issues/9)
86
- - Running tests against different environments [\#8](https://github.com/EnvironmentAgency/quke/issues/8)
98
+ - save\_and\_open\_page\(\) outputs to project root [\#12](https://github.com/DEFRA/quke/issues/12)
99
+ - Use Capybara's implicit wait system [\#9](https://github.com/DEFRA/quke/issues/9)
100
+ - Running tests against different environments [\#8](https://github.com/DEFRA/quke/issues/8)
87
101
 
88
102
  **Merged pull requests:**
89
103
 
90
- - Add browserstack support [\#30](https://github.com/EnvironmentAgency/quke/pull/30) ([Cruikshanks](https://github.com/Cruikshanks))
91
- - Add dependencyci badge to README.md [\#29](https://github.com/EnvironmentAgency/quke/pull/29) ([Cruikshanks](https://github.com/Cruikshanks))
92
- - Clear up references to poltergeist and phantomjs [\#28](https://github.com/EnvironmentAgency/quke/pull/28) ([Cruikshanks](https://github.com/Cruikshanks))
93
- - Add support for multiple config filespty message aborts the commit [\#26](https://github.com/EnvironmentAgency/quke/pull/26) ([Cruikshanks](https://github.com/Cruikshanks))
94
- - Move poltergeist driver options to Quke::Config [\#25](https://github.com/EnvironmentAgency/quke/pull/25) ([Cruikshanks](https://github.com/Cruikshanks))
95
- - Add support for a yaml \(.yml\) config file [\#24](https://github.com/EnvironmentAgency/quke/pull/24) ([Cruikshanks](https://github.com/Cruikshanks))
96
- - Add missing @quke tag to css\_selectors feature [\#23](https://github.com/EnvironmentAgency/quke/pull/23) ([Cruikshanks](https://github.com/Cruikshanks))
97
- - Add examples of CSS selectors to project [\#22](https://github.com/EnvironmentAgency/quke/pull/22) ([Cruikshanks](https://github.com/Cruikshanks))
98
- - Add explanation to demo pages on what tests show [\#21](https://github.com/EnvironmentAgency/quke/pull/21) ([Cruikshanks](https://github.com/Cruikshanks))
99
- - Replace title in README with new logo image [\#20](https://github.com/EnvironmentAgency/quke/pull/20) ([Cruikshanks](https://github.com/Cruikshanks))
100
- - Integrate quke with codeclimate [\#19](https://github.com/EnvironmentAgency/quke/pull/19) ([Cruikshanks](https://github.com/Cruikshanks))
101
- - Integrate with Travis-CI [\#18](https://github.com/EnvironmentAgency/quke/pull/18) ([Cruikshanks](https://github.com/Cruikshanks))
102
- - Stop saving to root when save\_and\_open\_page used [\#17](https://github.com/EnvironmentAgency/quke/pull/17) ([Cruikshanks](https://github.com/Cruikshanks))
103
- - Tidy up of the code [\#16](https://github.com/EnvironmentAgency/quke/pull/16) ([Cruikshanks](https://github.com/Cruikshanks))
104
- - Add example of interacting with radio-buttons [\#15](https://github.com/EnvironmentAgency/quke/pull/15) ([Cruikshanks](https://github.com/Cruikshanks))
105
- - Add embedded test website [\#14](https://github.com/EnvironmentAgency/quke/pull/14) ([Cruikshanks](https://github.com/Cruikshanks))
106
- - Enable Capybara implicit waits in Quke [\#13](https://github.com/EnvironmentAgency/quke/pull/13) ([Cruikshanks](https://github.com/Cruikshanks))
107
- - Make url endpoint to be tested configurable [\#11](https://github.com/EnvironmentAgency/quke/pull/11) ([Cruikshanks](https://github.com/Cruikshanks))
108
- - Expand readme with better documentation [\#7](https://github.com/EnvironmentAgency/quke/pull/7) ([Cruikshanks](https://github.com/Cruikshanks))
109
- - Add function to open page on fail [\#6](https://github.com/EnvironmentAgency/quke/pull/6) ([Cruikshanks](https://github.com/Cruikshanks))
110
- - Save custom quke args to global env vars [\#5](https://github.com/EnvironmentAgency/quke/pull/5) ([Cruikshanks](https://github.com/Cruikshanks))
111
- - Make use of hooks clearer in project [\#4](https://github.com/EnvironmentAgency/quke/pull/4) ([Cruikshanks](https://github.com/Cruikshanks))
112
- - Fix use of BROWSER instead of DRIVER in rake [\#3](https://github.com/EnvironmentAgency/quke/pull/3) ([Cruikshanks](https://github.com/Cruikshanks))
113
- - Structure project 2 avoid conflicts with upstream [\#2](https://github.com/EnvironmentAgency/quke/pull/2) ([Cruikshanks](https://github.com/Cruikshanks))
114
- - Rename env var BROWSER to DRIVER to fix Launchy [\#1](https://github.com/EnvironmentAgency/quke/pull/1) ([Cruikshanks](https://github.com/Cruikshanks))
104
+ - Add browserstack support [\#30](https://github.com/DEFRA/quke/pull/30) ([Cruikshanks](https://github.com/Cruikshanks))
105
+ - Add dependencyci badge to README.md [\#29](https://github.com/DEFRA/quke/pull/29) ([Cruikshanks](https://github.com/Cruikshanks))
106
+ - Clear up references to poltergeist and phantomjs [\#28](https://github.com/DEFRA/quke/pull/28) ([Cruikshanks](https://github.com/Cruikshanks))
107
+ - Add support for multiple config filespty message aborts the commit [\#26](https://github.com/DEFRA/quke/pull/26) ([Cruikshanks](https://github.com/Cruikshanks))
108
+ - Move poltergeist driver options to Quke::Config [\#25](https://github.com/DEFRA/quke/pull/25) ([Cruikshanks](https://github.com/Cruikshanks))
109
+ - Add support for a yaml \(.yml\) config file [\#24](https://github.com/DEFRA/quke/pull/24) ([Cruikshanks](https://github.com/Cruikshanks))
110
+ - Add missing @quke tag to css\_selectors feature [\#23](https://github.com/DEFRA/quke/pull/23) ([Cruikshanks](https://github.com/Cruikshanks))
111
+ - Add examples of CSS selectors to project [\#22](https://github.com/DEFRA/quke/pull/22) ([Cruikshanks](https://github.com/Cruikshanks))
112
+ - Add explanation to demo pages on what tests show [\#21](https://github.com/DEFRA/quke/pull/21) ([Cruikshanks](https://github.com/Cruikshanks))
113
+ - Replace title in README with new logo image [\#20](https://github.com/DEFRA/quke/pull/20) ([Cruikshanks](https://github.com/Cruikshanks))
114
+ - Integrate quke with codeclimate [\#19](https://github.com/DEFRA/quke/pull/19) ([Cruikshanks](https://github.com/Cruikshanks))
115
+ - Integrate with Travis-CI [\#18](https://github.com/DEFRA/quke/pull/18) ([Cruikshanks](https://github.com/Cruikshanks))
116
+ - Stop saving to root when save\_and\_open\_page used [\#17](https://github.com/DEFRA/quke/pull/17) ([Cruikshanks](https://github.com/Cruikshanks))
117
+ - Tidy up of the code [\#16](https://github.com/DEFRA/quke/pull/16) ([Cruikshanks](https://github.com/Cruikshanks))
118
+ - Add example of interacting with radio-buttons [\#15](https://github.com/DEFRA/quke/pull/15) ([Cruikshanks](https://github.com/Cruikshanks))
119
+ - Add embedded test website [\#14](https://github.com/DEFRA/quke/pull/14) ([Cruikshanks](https://github.com/Cruikshanks))
120
+ - Enable Capybara implicit waits in Quke [\#13](https://github.com/DEFRA/quke/pull/13) ([Cruikshanks](https://github.com/Cruikshanks))
121
+ - Make url endpoint to be tested configurable [\#11](https://github.com/DEFRA/quke/pull/11) ([Cruikshanks](https://github.com/Cruikshanks))
122
+ - Expand readme with better documentation [\#7](https://github.com/DEFRA/quke/pull/7) ([Cruikshanks](https://github.com/Cruikshanks))
123
+ - Add function to open page on fail [\#6](https://github.com/DEFRA/quke/pull/6) ([Cruikshanks](https://github.com/Cruikshanks))
124
+ - Save custom quke args to global env vars [\#5](https://github.com/DEFRA/quke/pull/5) ([Cruikshanks](https://github.com/Cruikshanks))
125
+ - Make use of hooks clearer in project [\#4](https://github.com/DEFRA/quke/pull/4) ([Cruikshanks](https://github.com/Cruikshanks))
126
+ - Fix use of BROWSER instead of DRIVER in rake [\#3](https://github.com/DEFRA/quke/pull/3) ([Cruikshanks](https://github.com/Cruikshanks))
127
+ - Structure project 2 avoid conflicts with upstream [\#2](https://github.com/DEFRA/quke/pull/2) ([Cruikshanks](https://github.com/Cruikshanks))
128
+ - Rename env var BROWSER to DRIVER to fix Launchy [\#1](https://github.com/DEFRA/quke/pull/1) ([Cruikshanks](https://github.com/Cruikshanks))
115
129
 
116
130
 
117
131
 
@@ -0,0 +1,24 @@
1
+ require 'quke/configuration'
2
+
3
+ Before('~@nonweb') do
4
+ # We have to make a special case for phantomjs when it comes to implementing
5
+ # the ability to override the user agent. Unlike the selinium backed drivers
6
+ # specifying the user agent is not part of the arguments we pass in when
7
+ # initialising the driver. Instead its something we call on the driver once
8
+ # its been instantiated
9
+ # https://github.com/teampoltergeist/poltergeist#manipulating-request-headers
10
+ # That might not have been so bad, the folks behind poltergeist have also
11
+ # made it so that custom changes to the header only last for as long as the
12
+ # test is running. Once a test finishes, the changes are lost.
13
+ # Hence the only way we can ensure its set across all tests is by making use
14
+ # of the Before hook, and adding the User-Agent header each time.
15
+ if Quke::Quke.config.driver == 'phantomjs'
16
+ unless Quke::Quke.config.user_agent.empty?
17
+ page.driver.add_header(
18
+ 'User-Agent',
19
+ Quke::Quke.config.user_agent,
20
+ permanent: true
21
+ )
22
+ end
23
+ end
24
+ end
@@ -105,6 +105,17 @@ module Quke #:nodoc:
105
105
  @data['max_wait_time']
106
106
  end
107
107
 
108
+ # Return the value set for +user_agent+.
109
+ #
110
+ # Useful if you want the underlying driver to spoof what kind of browser the
111
+ # request is coming from. For example you may want to pretend to be a mobile
112
+ # browser so you can check what you get back versus the desktop version. Or
113
+ # you want to pretend to be another kind of browser, because the one you
114
+ # have is not supported by the site.
115
+ def user_agent
116
+ @data['user_agent']
117
+ end
118
+
108
119
  # Return the hash of +browserstack+ options.
109
120
  #
110
121
  # If you select the browserstack driver, there are a number of options you
@@ -165,6 +176,7 @@ module Quke #:nodoc:
165
176
  'pause' => (data['pause'] || '0').to_s.downcase.strip.to_i,
166
177
  'stop_on_error' => (data['stop_on_error'] || 'false').to_s.downcase.strip,
167
178
  'max_wait_time' => (data['max_wait_time'] || Capybara.default_max_wait_time).to_s.downcase.strip.to_i,
179
+ 'user_agent' => (data['user_agent'] || '').strip,
168
180
  'custom' => (data['custom'] || nil)
169
181
  )
170
182
  end
@@ -48,6 +48,8 @@ module Quke #:nodoc:
48
48
  # Capybara::Poltergeist::Driver.new(app, my_driver_config.poltergeist)
49
49
  #
50
50
  def poltergeist
51
+ # The arguments we can pass to poltergeist are documented here
52
+ # https://github.com/teampoltergeist/poltergeist#customization
51
53
  {
52
54
  # Javascript errors will get re-raised in our tests causing them to fail
53
55
  js_errors: true,
@@ -99,14 +101,17 @@ module Quke #:nodoc:
99
101
  # )
100
102
  #
101
103
  def phantomjs
104
+ # For future reference the options we pass through to phantomjs appear to
105
+ # mirror those you can actually supply on the command line.
106
+ # http://phantomjs.org/api/command-line.html
102
107
  options = [
103
108
  '--load-images=no',
104
109
  '--disk-cache=false',
105
110
  '--ignore-ssl-errors=yes'
106
111
  ]
107
- if config.use_proxy?
108
- options.push("--proxy=#{config.proxy['host']}:#{config.proxy['port']}")
109
- end
112
+
113
+ options.push("--proxy=#{config.proxy['host']}:#{config.proxy['port']}") if config.use_proxy?
114
+
110
115
  options
111
116
  end
112
117
 
@@ -120,7 +125,8 @@ module Quke #:nodoc:
120
125
  # browser: :chrome,
121
126
  # switches: [
122
127
  # "--proxy-server=localhost:8080",
123
- # "--proxy-bypass-list=127.0.0.1,192.168.0.1"
128
+ # "--proxy-bypass-list=127.0.0.1,192.168.0.1",
129
+ # "--user-agent=Mozilla/5.0 (MSIE 10.0; Windows NT 6.1; Trident/5.0)"
124
130
  # ]
125
131
  # )
126
132
  #
@@ -145,6 +151,8 @@ module Quke #:nodoc:
145
151
  result.push("--proxy-server=#{host}:#{port}") if config.use_proxy?
146
152
  result.push("--proxy-bypass-list=#{no_proxy}") unless config.proxy['no_proxy'].empty?
147
153
 
154
+ result.push("--user-agent=#{config.user_agent}") unless config.user_agent.empty?
155
+
148
156
  result
149
157
  end
150
158
  # rubocop:enable Metrics/AbcSize
@@ -160,6 +168,7 @@ module Quke #:nodoc:
160
168
  # http: "10.10.2.70:8080",
161
169
  # ssl: "10.10.2.70:8080"
162
170
  # )
171
+ # my_profile['general.useragent.override'] = "Mozilla/5.0 (MSIE 10.0; Windows NT 6.1; Trident/5.0)"
163
172
  # Capybara::Selenium::Driver.new(
164
173
  # app,
165
174
  # profile: my_profile
@@ -180,16 +189,15 @@ module Quke #:nodoc:
180
189
  profile = Selenium::WebDriver::Firefox::Profile.new
181
190
 
182
191
  settings = {}
183
- host = config.proxy['host']
184
- port = config.proxy['port']
185
- no_proxy = config.proxy['no_proxy']
186
192
 
187
- settings[:http] = "#{host}:#{port}" if config.use_proxy?
193
+ settings[:http] = "#{config.proxy['host']}:#{config.proxy['port']}" if config.use_proxy?
188
194
  settings[:ssl] = settings[:http] if config.use_proxy?
189
- settings[:no_proxy] = no_proxy unless config.proxy['no_proxy'].empty?
195
+ settings[:no_proxy] = config.proxy['no_proxy'] unless config.proxy['no_proxy'].empty?
190
196
 
191
197
  profile.proxy = Selenium::WebDriver::Proxy.new(settings) if config.use_proxy?
192
198
 
199
+ profile['general.useragent.override'] = config.user_agent unless config.user_agent.empty?
200
+
193
201
  profile
194
202
  end
195
203
  # rubocop:enable Metrics/AbcSize
@@ -46,6 +46,8 @@ module Quke #:nodoc:
46
46
  # For future reference the options we pass through to phantomjs appear to
47
47
  # mirror those you can actually supply on the command line.
48
48
  # http://phantomjs.org/api/command-line.html
49
+ # The arguments we can pass to poltergeist are documented here
50
+ # https://github.com/teampoltergeist/poltergeist#customization
49
51
  Capybara.register_driver :phantomjs do |app|
50
52
  # We ignore the next line (and those like it in the subsequent methods)
51
53
  # from code coverage because we never actually execute them from Quke.
@@ -1,3 +1,3 @@
1
1
  module Quke #:nodoc:
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Cruikshanks
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-07 00:00:00.000000000 Z
11
+ date: 2017-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -248,6 +248,7 @@ files:
248
248
  - exe/quke
249
249
  - lib/features/support/after_hook.rb
250
250
  - lib/features/support/after_step_hook.rb
251
+ - lib/features/support/before_hook.rb
251
252
  - lib/features/support/env.rb
252
253
  - lib/quke.rb
253
254
  - lib/quke/configuration.rb