ams_layout 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 +7 -0
- data/.gitignore +22 -0
- data/.pryrc +8 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +134 -0
- data/Guardfile +11 -0
- data/LICENSE +22 -0
- data/README.md +42 -0
- data/Rakefile +116 -0
- data/ams_layout.gemspec +32 -0
- data/bin/ams_layout +10 -0
- data/lib/ams_layout/browser_loader.rb +99 -0
- data/lib/ams_layout/cli/config.rb +250 -0
- data/lib/ams_layout/cli/generate.rb +145 -0
- data/lib/ams_layout/cli.rb +29 -0
- data/lib/ams_layout/client.rb +190 -0
- data/lib/ams_layout/core_ext/string.rb +30 -0
- data/lib/ams_layout/core_ext.rb +11 -0
- data/lib/ams_layout/delegate_writer.rb +348 -0
- data/lib/ams_layout/pages/login_page.rb +69 -0
- data/lib/ams_layout/pages/prequal_detail.rb +26 -0
- data/lib/ams_layout/pages.rb +36 -0
- data/lib/ams_layout/parser.rb +137 -0
- data/lib/ams_layout/version.rb +3 -0
- data/lib/ams_layout/writer.rb +124 -0
- data/lib/ams_layout.rb +198 -0
- data/spec/data/layout-small.yml +25 -0
- data/spec/data/layout-small.yml.aliases +22 -0
- data/spec/data/layout.yml +652 -0
- data/spec/data/layout.yml.aliases +613 -0
- data/spec/lib/ams_layout/ams_layout_spec.rb +7 -0
- data/spec/lib/ams_layout/cli/config_spec.rb +471 -0
- data/spec/lib/ams_layout/cli/generate_spec.rb +188 -0
- data/spec/lib/ams_layout/cli_spec.rb +35 -0
- data/spec/lib/ams_layout/client_spec.rb +93 -0
- data/spec/lib/ams_layout/delegate_writer_spec.rb +80 -0
- data/spec/lib/ams_layout/writer_spec.rb +64 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/spec_helper_spec.rb +27 -0
- data/spec/support/asserts.rb +13 -0
- data/spec/support/dirs.rb +45 -0
- data/spec/support/helpers.rb +46 -0
- metadata +231 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 3941ed8b956ca6321fe54f72d1884a1f6a9a4529
|
|
4
|
+
data.tar.gz: 0e1aa1b796e9367d1ddc31bdd31f5276bbd05523
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 989dcec0c01640f9dab74b17c9bceff7075098386bca135d819d6614660d4918943baedf5f155b63bb487aadd404b0be134d0670bb934bbf8ba1066db145d9e0
|
|
7
|
+
data.tar.gz: b0bec2f87b2b1b6d0e00cf28b9a98c3d3f018b201e57f45df8a2e3bd0abfcf7a572e4c15f46376eb72466daa9f33f27b96df9e966cecb830628b1e77c467be43
|
data/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
InstalledFiles
|
|
7
|
+
_yardoc
|
|
8
|
+
coverage
|
|
9
|
+
doc/
|
|
10
|
+
lib/bundler/man
|
|
11
|
+
pkg
|
|
12
|
+
rdoc
|
|
13
|
+
spec/reports
|
|
14
|
+
test/tmp
|
|
15
|
+
test/version_tmp
|
|
16
|
+
tmp
|
|
17
|
+
*.bundle
|
|
18
|
+
*.so
|
|
19
|
+
*.o
|
|
20
|
+
*.a
|
|
21
|
+
mkmf.log
|
|
22
|
+
chrome-data/
|
data/.pryrc
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Specify your gem's dependencies in ams_layout.gemspec
|
|
4
|
+
gemspec
|
|
5
|
+
|
|
6
|
+
group :development do
|
|
7
|
+
gem 'pry-byebug', :git => 'git://github.com/deivid-rodriguez/pry-byebug.git'#, :tag => 'v1.3.3'
|
|
8
|
+
gem 'pry-doc'
|
|
9
|
+
gem 'pry-docmore'
|
|
10
|
+
gem 'pry-rescue'
|
|
11
|
+
gem 'pry-stack_explorer'
|
|
12
|
+
end
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
GIT
|
|
2
|
+
remote: git://github.com/deivid-rodriguez/pry-byebug.git
|
|
3
|
+
revision: 95f4ff335490b55f0ffe7aafe95ae623df32067c
|
|
4
|
+
specs:
|
|
5
|
+
pry-byebug (1.3.3)
|
|
6
|
+
byebug (~> 2.7)
|
|
7
|
+
pry (~> 0.10)
|
|
8
|
+
|
|
9
|
+
PATH
|
|
10
|
+
remote: .
|
|
11
|
+
specs:
|
|
12
|
+
ams_layout (0.0.2)
|
|
13
|
+
ktutils
|
|
14
|
+
nokogiri
|
|
15
|
+
page-object
|
|
16
|
+
|
|
17
|
+
GEM
|
|
18
|
+
remote: https://rubygems.org/
|
|
19
|
+
specs:
|
|
20
|
+
binding_of_caller (0.7.2)
|
|
21
|
+
debug_inspector (>= 0.0.1)
|
|
22
|
+
byebug (2.7.0)
|
|
23
|
+
columnize (~> 0.3)
|
|
24
|
+
debugger-linecache (~> 1.2)
|
|
25
|
+
celluloid (0.15.2)
|
|
26
|
+
timers (~> 1.1.0)
|
|
27
|
+
childprocess (0.5.6)
|
|
28
|
+
ffi (~> 1.0, >= 1.0.11)
|
|
29
|
+
coderay (1.1.0)
|
|
30
|
+
columnize (0.8.9)
|
|
31
|
+
data_magic (0.21)
|
|
32
|
+
faker (>= 1.1.2)
|
|
33
|
+
yml_reader (>= 0.4)
|
|
34
|
+
debug_inspector (0.0.2)
|
|
35
|
+
debugger-linecache (1.2.0)
|
|
36
|
+
diff-lcs (1.2.5)
|
|
37
|
+
faker (1.4.3)
|
|
38
|
+
i18n (~> 0.5)
|
|
39
|
+
ffi (1.9.3)
|
|
40
|
+
formatador (0.2.5)
|
|
41
|
+
guard (2.6.1)
|
|
42
|
+
formatador (>= 0.2.4)
|
|
43
|
+
listen (~> 2.7)
|
|
44
|
+
lumberjack (~> 1.0)
|
|
45
|
+
pry (>= 0.9.12)
|
|
46
|
+
thor (>= 0.18.1)
|
|
47
|
+
guard-rspec (4.2.10)
|
|
48
|
+
guard (~> 2.1)
|
|
49
|
+
rspec (>= 2.14, < 4.0)
|
|
50
|
+
i18n (0.7.0)
|
|
51
|
+
interception (0.5)
|
|
52
|
+
ktutils (0.0.3)
|
|
53
|
+
listen (2.7.9)
|
|
54
|
+
celluloid (>= 0.15.2)
|
|
55
|
+
rb-fsevent (>= 0.9.3)
|
|
56
|
+
rb-inotify (>= 0.9)
|
|
57
|
+
lumberjack (1.0.9)
|
|
58
|
+
method_source (0.8.2)
|
|
59
|
+
mini_portile (0.6.2)
|
|
60
|
+
multi_json (1.11.2)
|
|
61
|
+
nokogiri (1.6.6.2)
|
|
62
|
+
mini_portile (~> 0.6.0)
|
|
63
|
+
page-object (1.1.0)
|
|
64
|
+
page_navigation (>= 0.9)
|
|
65
|
+
selenium-webdriver (>= 2.44.0)
|
|
66
|
+
watir-webdriver (>= 0.6.11)
|
|
67
|
+
page_navigation (0.9)
|
|
68
|
+
data_magic (>= 0.14)
|
|
69
|
+
pry (0.10.0)
|
|
70
|
+
coderay (~> 1.1.0)
|
|
71
|
+
method_source (~> 0.8.1)
|
|
72
|
+
slop (~> 3.4)
|
|
73
|
+
pry-doc (0.6.0)
|
|
74
|
+
pry (~> 0.9)
|
|
75
|
+
yard (~> 0.8)
|
|
76
|
+
pry-docmore (0.1.1)
|
|
77
|
+
pry
|
|
78
|
+
pry-doc
|
|
79
|
+
pry-rescue (1.4.1)
|
|
80
|
+
interception (>= 0.5)
|
|
81
|
+
pry
|
|
82
|
+
pry-stack_explorer (0.4.9.1)
|
|
83
|
+
binding_of_caller (>= 0.7)
|
|
84
|
+
pry (>= 0.9.11)
|
|
85
|
+
rake (10.3.2)
|
|
86
|
+
rb-fsevent (0.9.4)
|
|
87
|
+
rb-inotify (0.9.5)
|
|
88
|
+
ffi (>= 0.5.0)
|
|
89
|
+
rspec (3.0.0)
|
|
90
|
+
rspec-core (~> 3.0.0)
|
|
91
|
+
rspec-expectations (~> 3.0.0)
|
|
92
|
+
rspec-mocks (~> 3.0.0)
|
|
93
|
+
rspec-core (3.0.2)
|
|
94
|
+
rspec-support (~> 3.0.0)
|
|
95
|
+
rspec-expectations (3.0.2)
|
|
96
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
97
|
+
rspec-support (~> 3.0.0)
|
|
98
|
+
rspec-mocks (3.0.2)
|
|
99
|
+
rspec-support (~> 3.0.0)
|
|
100
|
+
rspec-support (3.0.2)
|
|
101
|
+
rubyzip (1.1.7)
|
|
102
|
+
selenium-webdriver (2.46.2)
|
|
103
|
+
childprocess (~> 0.5)
|
|
104
|
+
multi_json (~> 1.0)
|
|
105
|
+
rubyzip (~> 1.0)
|
|
106
|
+
websocket (~> 1.0)
|
|
107
|
+
slop (3.5.0)
|
|
108
|
+
thor (0.19.1)
|
|
109
|
+
timers (1.1.0)
|
|
110
|
+
watir-webdriver (0.8.0)
|
|
111
|
+
selenium-webdriver (>= 2.46.2)
|
|
112
|
+
websocket (1.2.2)
|
|
113
|
+
yard (0.8.7.3)
|
|
114
|
+
yml_reader (0.5)
|
|
115
|
+
|
|
116
|
+
PLATFORMS
|
|
117
|
+
ruby
|
|
118
|
+
|
|
119
|
+
DEPENDENCIES
|
|
120
|
+
ams_layout!
|
|
121
|
+
bundler (~> 1.6)
|
|
122
|
+
guard
|
|
123
|
+
guard-rspec
|
|
124
|
+
pry (~> 0.10)
|
|
125
|
+
pry-byebug!
|
|
126
|
+
pry-doc
|
|
127
|
+
pry-docmore
|
|
128
|
+
pry-rescue
|
|
129
|
+
pry-stack_explorer
|
|
130
|
+
rake
|
|
131
|
+
rspec
|
|
132
|
+
|
|
133
|
+
BUNDLED WITH
|
|
134
|
+
1.10.5
|
data/Guardfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 Jeff McAffee
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# AmsLayout
|
|
2
|
+
|
|
3
|
+
AmsLayout will generate a delegate class that references all fields on the
|
|
4
|
+
client's Loan Entry screen.
|
|
5
|
+
|
|
6
|
+
The delegate class is used by the testing framework for guideline unit tests.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
Add this line to your application's Gemfile:
|
|
11
|
+
|
|
12
|
+
gem 'ams_layout'
|
|
13
|
+
|
|
14
|
+
And then execute:
|
|
15
|
+
|
|
16
|
+
$ bundle install
|
|
17
|
+
|
|
18
|
+
Or install it yourself as:
|
|
19
|
+
|
|
20
|
+
$ gem install ams_layout
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
TODO: Write usage instructions here
|
|
25
|
+
|
|
26
|
+
## Contributing
|
|
27
|
+
|
|
28
|
+
1. Fork it ( https://github.com/jmcaffee/ams_layout/fork )
|
|
29
|
+
2. Clone it (`git clone git@github.com:[my-github-username]/ams_layout.git`)
|
|
30
|
+
3. Create your feature branch (`git checkout -b my-new-feature`)
|
|
31
|
+
4. Create tests for your feature branch
|
|
32
|
+
5. Commit your changes (`git commit -am 'Add some feature'`)
|
|
33
|
+
6. Push to the branch (`git push origin my-new-feature`)
|
|
34
|
+
7. Create a new Pull Request
|
|
35
|
+
|
|
36
|
+
## LICENSE
|
|
37
|
+
|
|
38
|
+
AmsLayout is licensed under the MIT license.
|
|
39
|
+
|
|
40
|
+
See [LICENSE](https://github.com/jmcaffee/ams_layout/blob/master/LICENSE) for
|
|
41
|
+
details.
|
|
42
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require "rspec/core/rake_task"
|
|
3
|
+
require 'rake/clean'
|
|
4
|
+
|
|
5
|
+
require_relative 'lib/ams_layout/browser_loader'
|
|
6
|
+
|
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
8
|
+
|
|
9
|
+
##############################################################################
|
|
10
|
+
|
|
11
|
+
task :default => :spec
|
|
12
|
+
|
|
13
|
+
##############################################################################
|
|
14
|
+
|
|
15
|
+
desc "start a console"
|
|
16
|
+
task :console do
|
|
17
|
+
require 'rubygems'
|
|
18
|
+
require 'bundler/setup'
|
|
19
|
+
require 'pry'
|
|
20
|
+
ARGV.clear
|
|
21
|
+
|
|
22
|
+
test_pwd = ENV['AMS_TEST_USER_PWD']
|
|
23
|
+
if test_pwd.nil?
|
|
24
|
+
puts "Set AMS_TEST_USER_PWD to the 'test' user's password in an environment variable"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def console_help
|
|
28
|
+
puts <<CONSOLE_HELP
|
|
29
|
+
AmsLayout Console
|
|
30
|
+
-------------------
|
|
31
|
+
|
|
32
|
+
Helper Methods:
|
|
33
|
+
|
|
34
|
+
client - returns the AmsLayout::client object
|
|
35
|
+
login username, password - login to portal
|
|
36
|
+
get_layout - log in and return field layout
|
|
37
|
+
write_layout filename - write a layout file to disk in YAML format
|
|
38
|
+
write_bundle output_dir - write layout, layout class and delegate class
|
|
39
|
+
files to the directory specified.
|
|
40
|
+
write_layout_class filename, layout_file - create Layout class
|
|
41
|
+
write_delegate_class filename, layout_file - create Delegate class
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
CONSOLE_HELP
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def client
|
|
48
|
+
@client ||= AmsLayout::Client.new
|
|
49
|
+
@client
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def login username, password
|
|
53
|
+
client.login username, password
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def logout
|
|
57
|
+
client.logout
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def get_layout
|
|
61
|
+
client.login 'test', test_pwd
|
|
62
|
+
client.get_field_data
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def write_layout filename, write_alias_example = false
|
|
66
|
+
client.login 'test', test_pwd
|
|
67
|
+
client.write_layout filename, write_alias_example
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def write_bundle output_dir
|
|
71
|
+
output_dir = Pathname(output_dir)
|
|
72
|
+
|
|
73
|
+
layout_file = output_dir + 'layout.yml'
|
|
74
|
+
layout_class = output_dir + 'loan_entry_fields.rb'
|
|
75
|
+
layout_delegate = output_dir + 'delegate_loan_entry_fields.rb'
|
|
76
|
+
|
|
77
|
+
write_alias_examples = true
|
|
78
|
+
|
|
79
|
+
write_layout layout_file, write_alias_examples
|
|
80
|
+
client.write_layout_class layout_class, layout_file
|
|
81
|
+
client.write_delegate_class layout_delegate, layout_file
|
|
82
|
+
client.quit
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def write_layout_class filename, layout_file
|
|
86
|
+
client.write_layout_class filename, layout_file
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def write_delegate_class filename, layout_file
|
|
90
|
+
client.write_delegate_class filename, layout_file
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
#def add_credentials env, username, pwd
|
|
94
|
+
# AdminModule.configure do |config|
|
|
95
|
+
# config.credentials[env.to_sym] = [username, pwd]
|
|
96
|
+
# end
|
|
97
|
+
#end
|
|
98
|
+
|
|
99
|
+
#def activate_env env, username, pwd
|
|
100
|
+
# add_credentials env, username, pwd
|
|
101
|
+
# client.environment = env.to_sym
|
|
102
|
+
#end
|
|
103
|
+
|
|
104
|
+
require_relative 'lib/ams_layout'
|
|
105
|
+
|
|
106
|
+
console_help
|
|
107
|
+
Pry.start
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
##############################################################################
|
|
111
|
+
|
|
112
|
+
desc 'Start chrome with data dir'
|
|
113
|
+
task :start_chrome do
|
|
114
|
+
BrowserLoader.init_browser
|
|
115
|
+
end
|
|
116
|
+
|
data/ams_layout.gemspec
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'ams_layout/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "ams_layout"
|
|
8
|
+
spec.version = AmsLayout::VERSION
|
|
9
|
+
spec.authors = ["Jeff McAffee"]
|
|
10
|
+
spec.email = ["jeff@ktechsystems.com"]
|
|
11
|
+
spec.summary = %q{Generate AMS Portal control field configuration data}
|
|
12
|
+
spec.description = %q{Generate AMS Portal control field configuration data}
|
|
13
|
+
spec.homepage = "https://github.com/jmcaffee/ams_layout"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
spec.add_development_dependency "rspec"
|
|
24
|
+
spec.add_development_dependency "guard"
|
|
25
|
+
spec.add_development_dependency "guard-rspec"
|
|
26
|
+
spec.add_development_dependency "pry", "~> 0.10"
|
|
27
|
+
#spec.add_development_dependency "pry-byebug", "~> 1.3.1"
|
|
28
|
+
|
|
29
|
+
spec.add_runtime_dependency 'ktutils'
|
|
30
|
+
spec.add_runtime_dependency 'page-object'
|
|
31
|
+
spec.add_runtime_dependency 'nokogiri'
|
|
32
|
+
end
|
data/bin/ams_layout
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
# File:: browser_loader.rb
|
|
3
|
+
# Purpose:: Create and initialize a browser with Watir
|
|
4
|
+
#
|
|
5
|
+
# Author:: Jeff McAffee 06/21/2014
|
|
6
|
+
# Copyright:: Copyright (c) 2014, kTech Systems LLC. All rights reserved.
|
|
7
|
+
# Website:: http://ktechsystems.com
|
|
8
|
+
##############################################################################
|
|
9
|
+
|
|
10
|
+
require 'watir-webdriver'
|
|
11
|
+
require 'ktutils/os'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
###
|
|
15
|
+
# To start/stop Chrome auto-update, see http://blog.doofix.com/how-to-stop-google-chrome-from-automatic-update/
|
|
16
|
+
#
|
|
17
|
+
# Regedit instructions (in case URL breaks):
|
|
18
|
+
#
|
|
19
|
+
# Set value HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Update\UpdateDefault to 0 to turn off auto-update.
|
|
20
|
+
# Set to 1 to turn on auto-update, or delete the value (UpdateDefault).
|
|
21
|
+
#
|
|
22
|
+
|
|
23
|
+
###
|
|
24
|
+
# Chromedriver updates can be downloaded from http://chromedriver.storage.googleapis.com/index.html
|
|
25
|
+
#
|
|
26
|
+
|
|
27
|
+
class BrowserLoader
|
|
28
|
+
def self.init_browser timeout = 60
|
|
29
|
+
if ENV["BROWSER"] == "ie"
|
|
30
|
+
browser = Watir::Browser.new :ie
|
|
31
|
+
elsif ENV["BROWSER"] == "ff" || ENV["BROWSER"] == "firefox"
|
|
32
|
+
browser = Watir::Browser.new :firefox
|
|
33
|
+
else
|
|
34
|
+
# Specify chrome browser capabilities.
|
|
35
|
+
caps = Selenium::WebDriver::Remote::Capabilities.chrome
|
|
36
|
+
caps['chromeOptions'] = {'binary' => chromium_exe }
|
|
37
|
+
#caps['chromeOptions'] = {'binary' => '/opt/bin/test/chrome-27.0.1453.94.exe' }
|
|
38
|
+
# See http://peter.sh/experiments/chromium-command-line-switches/ for a list of available switches.
|
|
39
|
+
# See https://sites.google.com/a/chromium.org/chromedriver/capabilities for details on setting ChromeDriver caps.
|
|
40
|
+
|
|
41
|
+
# NOTE: The only way I've found to stop the EULA from being displayed is to
|
|
42
|
+
# use the user-data-dir switch and point to a dir where chrome can put the
|
|
43
|
+
# data indicating it (EULA) has already been accepted.
|
|
44
|
+
|
|
45
|
+
# ignore-certificate-errors: Ignores certificate-related errors.
|
|
46
|
+
# disable-popup-blocking: Disable pop-up blocking.
|
|
47
|
+
# disable-translate: Allows disabling of translate from the command line to assist with automated browser testing
|
|
48
|
+
# no-first-run: Skip First Run tasks, whether or not it's actually the First Run.
|
|
49
|
+
# log-level: Sets the minimum log level. Valid values are from 0 to 3: INFO = 0, WARNING = 1, LOG_ERROR = 2, LOG_FATAL = 3.
|
|
50
|
+
# test-type: As of v35, chrome displays a message bar stating
|
|
51
|
+
# "You are using an unsupported command-line flag: --ignore-certifcate-errors. Stability and security will suffer."
|
|
52
|
+
# --test-type is supposed to disable the display of the error.
|
|
53
|
+
switches = %w[--ignore-certificate-errors --disable-popup-blocking --disable-translate --no-first-run --log-level=3 --test-type]
|
|
54
|
+
switches << "--user-data-dir=#{user_data_dir}"
|
|
55
|
+
|
|
56
|
+
# Create a client so we can adjust the timeout period.
|
|
57
|
+
client = Selenium::WebDriver::Remote::Http::Default.new
|
|
58
|
+
|
|
59
|
+
# Set the browser timeout. Default is 60 seconds.
|
|
60
|
+
client.timeout = timeout
|
|
61
|
+
|
|
62
|
+
# switches and caps modify chrome (or chromium) browser,
|
|
63
|
+
# service_args modifys chromedriver.
|
|
64
|
+
browser = Watir::Browser.new :chrome,
|
|
65
|
+
:switches => switches,
|
|
66
|
+
:http_client => client,
|
|
67
|
+
:service_log_path => user_data_dir + '/chromedriver.out',
|
|
68
|
+
:desired_capabilities => caps
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
browser
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def self.user_data_path= path
|
|
75
|
+
@user_data_path = path
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def self.user_data_dir
|
|
79
|
+
# Store chrome profile at chrome-data.
|
|
80
|
+
#user_data_dir = File.absolute_path(File.join(__FILE__, '../../../chrome-data'))
|
|
81
|
+
user_data_dir = File.absolute_path(@user_data_path)
|
|
82
|
+
|
|
83
|
+
fail "Chromium user-data directory does not exist at #{user_data_dir}" unless File.exist?(user_data_dir)
|
|
84
|
+
|
|
85
|
+
user_data_dir
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def self.chromium_exe
|
|
89
|
+
if Ktutils::OS.windows?
|
|
90
|
+
# Downloaded from http://chromium.woolyss.com/
|
|
91
|
+
# Package: Chromium Package (32-bit)
|
|
92
|
+
# Version: 37.0.2011.0 (272392)
|
|
93
|
+
chromium_exe = File.absolute_path(File.join(__FILE__, '../../bin/chrome-win32/chrome.exe'))
|
|
94
|
+
else
|
|
95
|
+
chromium_exe = `which chromium-browser`.chomp
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end # BrowserLoader
|
|
99
|
+
|