selenium-grid-parser 0.0.1 → 0.0.2

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: 421cc5fd051b83f53df4dc063d64011711a696c2
4
- data.tar.gz: a38e5f7b782457f6e317ea98ce66780ab975e42b
3
+ metadata.gz: 6c67b67b2c32df2a55bdbb0f198cef4a9e3114ce
4
+ data.tar.gz: 34d19cb4a5ef692dc51ca872ac3dea1157fbb828
5
5
  SHA512:
6
- metadata.gz: f4668a8e84d99f1a4410e62e41083e30e022a73698f5c51c4c2f139d3aa9a699e34007f0790315d90a41d75fafa890aa4200b5a39396c964eaae312810f1061c
7
- data.tar.gz: 945edfb912845155f9eef6109e887f594deab8035c1da85a1d35ce39f9b610b50043a70bbb751b74af7c2199ed517c401e4ea983dd1db51807e7ee43e927a660
6
+ metadata.gz: cfc61932a8031f3c59561b3e15fb40da91e6ac11bbd9c3d167a26cbf8d18fda06069a346cd120273406ce6c3f1979197003c670e3e5330aa991938a19f5676b5
7
+ data.tar.gz: 6a4e58bb35885f396b1ae9c9fd97ef4315801fa3a00cfacbd3cc895c1b8e617a4d4bbc03248500e98c036228b525f7d374f1f8e2cb3c671e583ea061500536ad
@@ -1,12 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- selenium-grid-parser (0.0.1)
4
+ selenium-grid-parser (0.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- byebug (9.0.5)
10
9
  httparty (0.14.0)
11
10
  multi_xml (>= 0.5.2)
12
11
  mini_portile2 (2.1.0)
@@ -20,11 +19,10 @@ PLATFORMS
20
19
 
21
20
  DEPENDENCIES
22
21
  bundler (~> 1.7)
23
- byebug
24
22
  httparty (~> 0.13)
25
23
  nokogiri (~> 1.6)
26
24
  rake (~> 10.0)
27
25
  selenium-grid-parser!
28
26
 
29
27
  BUNDLED WITH
30
- 1.12.5
28
+ 1.13.6
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
- # Selenium::Grid::Parser
1
+ # Selenium-Grid-Parser
2
2
 
3
- TODO: Write a gem description
3
+ Selenium-Grid doesn't have a pretty API so this gem is for parser the result of
4
+ /grid/console to know which nodes are free to use them when running your tests
4
5
 
5
6
  ## Installation
6
7
 
@@ -20,11 +21,187 @@ Or install it yourself as:
20
21
 
21
22
  ## Usage
22
23
 
23
- TODO: Write usage instructions here
24
+ ### Script
25
+
26
+ bin/parse -u [selenium-grid-url] -o [json|hash]
27
+ -u: The selenium-grid-url (By default: 'http://0.0.0.0:4444')
28
+ -o: The output format (By default: hash)
29
+
30
+ Example:
31
+
32
+ bin/parse -u http://0.0.0.0:4444 -o json
33
+
34
+ It will return:
35
+
36
+ [
37
+ {
38
+ "remoteHost": "http://0.0.0.0:4725",
39
+ "configuration": {
40
+ "browserTimeout": "0",
41
+ "debug": "false",
42
+ "help": "false",
43
+ "jettyMaxThreads": "-1",
44
+ "port": "4725",
45
+ "role": "node",
46
+ "timeout": "30000",
47
+ "cleanUpCycle": "2000",
48
+ "host": "0.0.0.0",
49
+ "maxSession": "6",
50
+ "capabilities": {
51
+ "browserName": "Samsung S6",
52
+ "platformName": "ANDROID",
53
+ "maxInstances": "1",
54
+ "applicationName": "Samsung S6"
55
+ },
56
+ "id": "http://0.0.0.0:4725",
57
+ "hubHost": "0.0.0.0",
58
+ "hubPort": "4444",
59
+ "nodeStatusCheckTimeout": "5000",
60
+ "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
61
+ "register": "true",
62
+ "registerCycle": "5000"
63
+ },
64
+ "free": true
65
+ },
66
+ {
67
+ "remoteHost": "http://0.0.0.0:4726",
68
+ "configuration": {
69
+ "browserTimeout": "0",
70
+ "debug": "false",
71
+ "help": "false",
72
+ "jettyMaxThreads": "-1",
73
+ "port": "4726",
74
+ "role": "node",
75
+ "timeout": "30000",
76
+ "cleanUpCycle": "2000",
77
+ "host": "0.0.0.0",
78
+ "maxSession": "6",
79
+ "capabilities": {
80
+ "browserName": "Nexus5",
81
+ "platformName": "ANDROID",
82
+ "maxInstances": "1",
83
+ "applicationName": "Nexus5"
84
+ },
85
+ "id": "http://0.0.0.0:4726",
86
+ "hubHost": "0.0.0.0",
87
+ "hubPort": "4444",
88
+ "nodeStatusCheckTimeout": "5000",
89
+ "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
90
+ "register": "true",
91
+ "registerCycle": "5000"
92
+ },
93
+ "free": true
94
+ }
95
+ ]
96
+
97
+ ### Lib
98
+
99
+ Easy, just call:
100
+
101
+ selenium_grid_url = "http://0.0.0.0:4444"
102
+ nodes = SeleniumGridConsoleParser.nodes(selenium_grid_url)
103
+
104
+ It will return a node_set.
105
+
106
+ nodes.free_nodes #It'll return all nodes that aren't been used.
107
+ node_available = nodes.first_free_node #It'll return the first free node available
108
+ nodes.to_json =>
109
+ [
110
+ {
111
+ "remoteHost": "http://0.0.0.0:4725",
112
+ "configuration": {
113
+ "browserTimeout": "0",
114
+ "debug": "false",
115
+ "help": "false",
116
+ "jettyMaxThreads": "-1",
117
+ "port": "4725",
118
+ "role": "node",
119
+ "timeout": "30000",
120
+ "cleanUpCycle": "2000",
121
+ "host": "0.0.0.0",
122
+ "maxSession": "6",
123
+ "capabilities": {
124
+ "browserName": "Samsung S6",
125
+ "platformName": "ANDROID",
126
+ "maxInstances": "1",
127
+ "applicationName": "Samsung S6"
128
+ },
129
+ "id": "http://0.0.0.0:4725",
130
+ "hubHost": "0.0.0.0",
131
+ "hubPort": "4444",
132
+ "nodeStatusCheckTimeout": "5000",
133
+ "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
134
+ "register": "true",
135
+ "registerCycle": "5000"
136
+ },
137
+ "free": true
138
+ },
139
+ {
140
+ "remoteHost": "http://0.0.0.0:4726",
141
+ "configuration": {
142
+ "browserTimeout": "0",
143
+ "debug": "false",
144
+ "help": "false",
145
+ "jettyMaxThreads": "-1",
146
+ "port": "4726",
147
+ "role": "node",
148
+ "timeout": "30000",
149
+ "cleanUpCycle": "2000",
150
+ "host": "0.0.0.0",
151
+ "maxSession": "6",
152
+ "capabilities": {
153
+ "browserName": "Nexus5",
154
+ "platformName": "ANDROID",
155
+ "maxInstances": "1",
156
+ "applicationName": "Nexus5"
157
+ },
158
+ "id": "http://0.0.0.0:4726",
159
+ "hubHost": "0.0.0.0",
160
+ "hubPort": "4444",
161
+ "nodeStatusCheckTimeout": "5000",
162
+ "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
163
+ "register": "true",
164
+ "registerCycle": "5000"
165
+ },
166
+ "free": true
167
+ }
168
+ ]
169
+
170
+ And if we only have a node...
171
+
172
+ node.free? #It'll return if the node is available or not
173
+ node.to_hash =>
174
+
175
+ {
176
+ "remoteHost"=>"http://0.0.0.0:4726",
177
+ "configuration"=> {
178
+ "browserTimeout"=>"0",
179
+ "debug"=>"false",
180
+ "help"=>"false",
181
+ "jettyMaxThreads"=>"-1",
182
+ "port"=>"4726",
183
+ "role"=>"node",
184
+ "timeout"=>"30000",
185
+ "cleanUpCycle"=>"2000", "host"=>"0.0.0.0",
186
+ "maxSession"=>"6",
187
+ "capabilities"=>{
188
+ "browserName"=>"Chrome",
189
+ "maxInstances"=>"1",
190
+ "applicationName"=>"Nexus5"},
191
+ "id"=>"http://0.0.0.0:4726",
192
+ "hubHost"=>"0.0.0.0",
193
+ "hubPort"=>"4444",
194
+ "nodeStatusCheckTimeout"=>"5000",
195
+ "proxy"=>"org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
196
+ "register"=>"true", "registerCycle"=>"5000"},
197
+ "free"=>true
198
+ }
199
+
200
+
24
201
 
25
202
  ## Contributing
26
203
 
27
- 1. Fork it ( https://github.com/[my-github-username]/selenium-grid-parser/fork )
204
+ 1. Fork it ( https://github.com/jjortega/selenium-grid-parser/fork )
28
205
  2. Create your feature branch (`git checkout -b my-new-feature`)
29
206
  3. Commit your changes (`git commit -am 'Add some feature'`)
30
207
  4. Push to the branch (`git push origin my-new-feature`)
data/bin/parse CHANGED
@@ -3,12 +3,12 @@
3
3
  $stderr.sync = true
4
4
 
5
5
  require 'optparse'
6
-
6
+ require 'bundler/setup'
7
7
  require 'selenium_grid_console_parser'
8
8
 
9
9
  # default options
10
10
  url = "http://0.0.0.0:4444"
11
- output = "hasg"
11
+ output = "hash"
12
12
 
13
13
  # parse arguments
14
14
  file = __FILE__
@@ -1,5 +1,4 @@
1
- require "nodes/configuration/capabilities"
2
- require "byebug"
1
+ require 'nodes/configuration/capabilities'
3
2
 
4
3
  module SeleniumGridConsoleParser
5
4
  module GridNode
@@ -1,4 +1,4 @@
1
- require "json"
1
+ require 'json'
2
2
 
3
3
  module SeleniumGridConsoleParser
4
4
  module Nodes
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "selenium-grid-parser"
7
- spec.version = "0.0.1"
7
+ spec.version = "0.0.2"
8
8
  spec.authors = ["jjortega"]
9
9
  spec.email = ["juanjortcan@gmail.com"]
10
10
  spec.summary = %q{Selenium-Grid doesn't have a pretty API so let parse it!}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium-grid-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jjortega
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-21 00:00:00.000000000 Z
11
+ date: 2016-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler