quke 0.2.8 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ce6e3b1ba8e4ad298fe85c9b8c857ecda9f35ab
4
- data.tar.gz: 26f007f5de6c8696d3e12f8021e977887d6ff523
3
+ metadata.gz: 27be44353121331dc3014432665279b4fe608e67
4
+ data.tar.gz: bc5a878ce04b08f922b07a9a7095850431c6c01f
5
5
  SHA512:
6
- metadata.gz: 71014eeafeec42cda3731e9421c398c21e377b889da74458bb91980e543ab85cd306c2bf5a62792c3bd9c023711c6121cbce84687912ed802a8e358539d84e7a
7
- data.tar.gz: 044fb0a77767d7429e8a3a2868d99356c217ac090713d44c0039425223082558e790318e700ece6b50da84565e58d479b0677d495daf842ce8de79b819093fc9
6
+ metadata.gz: 483988fb09729678369293055188026e51e7fb17579681a0a0cbe151b6199e0e985fd017f818796fe3f8e42bd24c976e8af9baf01043915ee5c48fe03c2197a8
7
+ data.tar.gz: e516dd83556b3a6c0b6da0f2bd4d02f254b766c1b4cf44cae7eab7de85bf69998cbafd9000b27c68c8bb175596ca0b531cbebd1cb860f084af06a9e1e6863e40
@@ -25,6 +25,37 @@ pause: 1
25
25
  # a detailed response.
26
26
  stop_on_error: 1
27
27
 
28
+ # Capybara will attempt to find an element for a period of time, rather than
29
+ # immediately failing because the element cannot be found. This defaults to 2
30
+ # seconds. However if the site you are working with is slow or features
31
+ # elements that take some time to load you can increase this default.
32
+ max_wait_time: 5
33
+
34
+ # Anything you place under the 'custom' node in the `.config.yml` file will be
35
+ # available within your steps and page objects by calling
36
+ # `Quke::Quke.config.custom`. So using the example below we could access its
37
+ # values in the following ways
38
+ #
39
+ # Quke::Quke.config.custom["default_org_name"] # = "Testy Ltd"
40
+ # Quke::Quke.config.custom["accounts"]["account2"]["username"] # = "john.doe@example.gov.uk"
41
+ # Quke::Quke.config.custom["urls"]["front_office"] # = "http://myservice.service.gov.uk"
42
+ #
43
+ # As long as what you add is valid YAML (check with a tool like
44
+ # http://www.yamllint.com/) Quke will be able to pick it up and make it
45
+ # available in your tests.
46
+ custom:
47
+ default_org_name: "Testy Ltd"
48
+ accounts:
49
+ account1:
50
+ username: jane.doe@example.gov.uk
51
+ password: Av3rystr*ngone
52
+ account2:
53
+ username: john.doe@example.gov.uk
54
+ password: An*th3rstrongone
55
+ urls:
56
+ front_office: "http://myservice.service.gov.uk"
57
+ back_office: "http://admin-myservice.service.gov.uk"
58
+
28
59
  # If you are running Quke behind a proxy you can configure the proxy details
29
60
  # here. You'll need either the hostname or IP of the proxy server (don't include
30
61
  # the http:// bit) and the port number (typically 8080). Currently proxy
@@ -58,7 +89,7 @@ browserstack:
58
89
  project: 'Adding browserstack support'
59
90
 
60
91
  # Allows you to specify an identifier for the test run.
61
- # If you intend to repeat a test this might not be that aplicable, but in the
92
+ # If you intend to repeat a test this might not be that applicable, but in the
62
93
  # case of one off tests it might be useful
63
94
  name: 'Testing google search'
64
95
 
data/README.md CHANGED
@@ -66,7 +66,13 @@ Or install it yourself as
66
66
 
67
67
  ## Configuration
68
68
 
69
- You can use configuration to drive Quke. You can configure Quke using `.config.yml` files. See [.config.example.yml](.config.example.yml) for details of the options to include in your `.config.yml`.
69
+ You can configure Quke using a `.config.yml` file. What can be configured essentially falls into one of 3 groups.
70
+
71
+ - **Quke configuration** - things like which driver to use, whether to pause between steps, or if Quke should stop in the event of an error
72
+ - **Custom configuration** - add your own custom values using the `custom:` node
73
+ - **Browserstack configuration** - specify exactly how you want your Browserstack session to run, for example which browser and OS to test against, the project name, and your credentials.
74
+
75
+ See [.config.example.yml](.config.example.yml) for full details of the options you can specify in your `.config.yml`.
70
76
 
71
77
  ### Multiple configs
72
78
 
@@ -16,6 +16,11 @@ driver = driver_reg.register(Quke::Quke.config.driver)
16
16
  Capybara.default_driver = driver
17
17
  Capybara.javascript_driver = driver
18
18
 
19
+ # default_max_wait_time is the maximum time Capybara will wait for an element
20
+ # to appear. You may wish to override it if you are having to deal with a slow
21
+ # or unresponsive web site.
22
+ Capybara.default_max_wait_time = Quke::Quke.config.max_wait_time
23
+
19
24
  # By default Capybara will try to boot a rack application automatically. This
20
25
  # switches off Capybara's rack server as we are running against a remote
21
26
  # application.
@@ -92,6 +92,19 @@ module Quke #:nodoc:
92
92
  YAML.load(@data['stop_on_error'])
93
93
  end
94
94
 
95
+ # Return the value for +max_wait_time+
96
+ #
97
+ # +max_wait_time+ is the time Capybara will spend waiting for an element
98
+ # to appear. It's default is normally 2 seconds but you may want to increase
99
+ # this is you are having to deal with a site that is not performant or prone
100
+ # to delays.
101
+ #
102
+ # If the value is not set in config file, it will default to whatever is the
103
+ # current Capybara value for default_max_wait_time.
104
+ def max_wait_time
105
+ @data['max_wait_time']
106
+ end
107
+
95
108
  # Return the hash of +browserstack+ options.
96
109
  #
97
110
  # If you select the browserstack driver, there are a number of options you
@@ -122,6 +135,10 @@ module Quke #:nodoc:
122
135
  proxy['host'] == '' ? false : true
123
136
  end
124
137
 
138
+ def custom
139
+ @data['custom']
140
+ end
141
+
125
142
  # Override to_s to output the contents of Config as a readable string rather
126
143
  # than the standard object output you get.
127
144
  def to_s
@@ -138,16 +155,22 @@ module Quke #:nodoc:
138
155
  end
139
156
 
140
157
  # rubocop:disable Metrics/AbcSize
158
+ # rubocop:disable Metrics/CyclomaticComplexity
159
+ # rubocop:disable Metrics/PerceivedComplexity
141
160
  def default_data!(data)
142
161
  data.merge(
143
162
  'features_folder' => (data['features'] || 'features').downcase.strip,
144
163
  'app_host' => (data['app_host'] || '').downcase.strip,
145
164
  'driver' => (data['driver'] || 'phantomjs').downcase.strip,
146
165
  'pause' => (data['pause'] || '0').to_s.downcase.strip.to_i,
147
- 'stop_on_error' => (data['stop_on_error'] || 'false').to_s.downcase.strip
166
+ 'stop_on_error' => (data['stop_on_error'] || 'false').to_s.downcase.strip,
167
+ 'max_wait_time' => (data['max_wait_time'] || Capybara.default_max_wait_time).to_s.downcase.strip.to_i,
168
+ 'custom' => (data['custom'] || nil)
148
169
  )
149
170
  end
150
171
  # rubocop:enable Metrics/AbcSize
172
+ # rubocop:enable Metrics/CyclomaticComplexity
173
+ # rubocop:enable Metrics/PerceivedComplexity
151
174
 
152
175
  # rubocop:disable Metrics/MethodLength
153
176
  def browserstack_data(data)
@@ -1,3 +1,3 @@
1
1
  module Quke #:nodoc:
2
- VERSION = '0.2.8'.freeze
2
+ VERSION = '0.3.0'.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.2.8
4
+ version: 0.3.0
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-01-20 00:00:00.000000000 Z
11
+ date: 2017-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber