watir_setup 0.0.1
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/.rspec +3 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +57 -0
- data/lib/watir_setup/base_page.rb +50 -0
- data/lib/watir_setup/current_browser.rb +28 -0
- data/lib/watir_setup/page_helper.rb +9 -0
- data/lib/watir_setup/version.rb +1 -0
- data/lib/watir_setup.rb +10 -0
- data/spec/google_spec.rb +14 -0
- data/spec/spec_helper.rb +24 -0
- metadata +55 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: edebb2a22d3ea2f3ccc36cba8d85451d20d01109
|
|
4
|
+
data.tar.gz: 8801d8f71b79e8557d02fd3ac189a63fcf36abba
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 2a120c495d35795828d96af28c4ccb13850a9086720b70a088658152ece7becb6d1628994084b836618770b46def3c63ab5ebfc254ff1a813cc284c79178d44d
|
|
7
|
+
data.tar.gz: 6ea065b5fec59fb392703e4f8a642af656dd401006b4276461a88c35939430f3f53630ff62b2898581874ada153f45ba09f033c6a68796265700960e8a7d7599
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
childprocess (0.6.3)
|
|
5
|
+
ffi (~> 1.0, >= 1.0.11)
|
|
6
|
+
coderay (1.1.1)
|
|
7
|
+
diff-lcs (1.3)
|
|
8
|
+
ffi (1.9.18)
|
|
9
|
+
interception (0.5)
|
|
10
|
+
method_source (0.8.2)
|
|
11
|
+
pry (0.10.4)
|
|
12
|
+
coderay (~> 1.1.0)
|
|
13
|
+
method_source (~> 0.8.1)
|
|
14
|
+
slop (~> 3.4)
|
|
15
|
+
pry-rescue (1.4.5)
|
|
16
|
+
interception (>= 0.5)
|
|
17
|
+
pry
|
|
18
|
+
require_all (1.4.0)
|
|
19
|
+
rspec (3.5.0)
|
|
20
|
+
rspec-core (~> 3.5.0)
|
|
21
|
+
rspec-expectations (~> 3.5.0)
|
|
22
|
+
rspec-mocks (~> 3.5.0)
|
|
23
|
+
rspec-core (3.5.4)
|
|
24
|
+
rspec-support (~> 3.5.0)
|
|
25
|
+
rspec-expectations (3.5.0)
|
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
27
|
+
rspec-support (~> 3.5.0)
|
|
28
|
+
rspec-mocks (3.5.0)
|
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
30
|
+
rspec-support (~> 3.5.0)
|
|
31
|
+
rspec-support (3.5.0)
|
|
32
|
+
rubyzip (1.2.1)
|
|
33
|
+
selenium-webdriver (3.3.0)
|
|
34
|
+
childprocess (~> 0.5)
|
|
35
|
+
rubyzip (~> 1.0)
|
|
36
|
+
websocket (~> 1.0)
|
|
37
|
+
slop (3.6.0)
|
|
38
|
+
watir (6.2.1)
|
|
39
|
+
selenium-webdriver (~> 3.0)
|
|
40
|
+
watir-webdriver (0.9.9)
|
|
41
|
+
selenium-webdriver (>= 2.46.2)
|
|
42
|
+
websocket (1.2.4)
|
|
43
|
+
|
|
44
|
+
PLATFORMS
|
|
45
|
+
ruby
|
|
46
|
+
|
|
47
|
+
DEPENDENCIES
|
|
48
|
+
bundler
|
|
49
|
+
pry-rescue
|
|
50
|
+
require_all
|
|
51
|
+
rspec (= 3.5.0)
|
|
52
|
+
selenium-webdriver (~> 3.3)
|
|
53
|
+
watir (~> 6.2)
|
|
54
|
+
watir-webdriver
|
|
55
|
+
|
|
56
|
+
BUNDLED WITH
|
|
57
|
+
1.14.6
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module Pages
|
|
2
|
+
class BasePage
|
|
3
|
+
include PageHelper
|
|
4
|
+
|
|
5
|
+
def initialize(browser)
|
|
6
|
+
@browser = browser
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.url(url)
|
|
10
|
+
define_method("url") do
|
|
11
|
+
if url.is_a?(Hash)
|
|
12
|
+
build_url(url)
|
|
13
|
+
else
|
|
14
|
+
url
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def method_missing(sym, *args, &block)
|
|
20
|
+
@browser.send(sym, *args, &block)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def goto
|
|
24
|
+
@browser.goto(self.url)
|
|
25
|
+
self
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
def build_url(options={})
|
|
30
|
+
path = options[:path] || ''
|
|
31
|
+
port = options[:port] || ENV['PORT'] || '9292'
|
|
32
|
+
password = options[:basic_auth_password] || ENV['BASIC_AUTH_PASSWORD']
|
|
33
|
+
hostname = options[:hostname] || ENV['HOSTNAME'] || "localhost"
|
|
34
|
+
protocol = options[:protocol] || 'http'
|
|
35
|
+
|
|
36
|
+
user = options[:basic_auth_user] || ENV['BASIC_AUTH_USER']
|
|
37
|
+
password = options[:basic_auth_password]
|
|
38
|
+
basic_auth = user && password ? "#{user}:#{password}" : nil
|
|
39
|
+
|
|
40
|
+
url = "#{protocol}://"
|
|
41
|
+
url += "#{basic_auth}@" if basic_auth
|
|
42
|
+
url += "#{hostname}"
|
|
43
|
+
port ? url += ":#{port}/" : url += "/"
|
|
44
|
+
if path
|
|
45
|
+
url += "/" if url[-1] != "/" && path[0] != "/"
|
|
46
|
+
url += path
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class CurrentBrowser < SimpleDelegator
|
|
2
|
+
include Singleton
|
|
3
|
+
|
|
4
|
+
attr_accessor :browser, :client
|
|
5
|
+
|
|
6
|
+
BROWSER_RES_X = 1366 #1280
|
|
7
|
+
BROWSER_RES_Y = 768 #924
|
|
8
|
+
|
|
9
|
+
def initialize
|
|
10
|
+
super(self.browser)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def start_browser(env)
|
|
14
|
+
self.browser ||= browser_builder(env)
|
|
15
|
+
resize_browser
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def resize_browser(x = BROWSER_RES_X, y = BROWSER_RES_Y)
|
|
19
|
+
browser.window.resize_to(x, y)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def browser_builder(env)
|
|
25
|
+
env = env.to_sym if env
|
|
26
|
+
Watir::Browser.new(env || :chrome)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "0.0.1"
|
data/lib/watir_setup.rb
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler'
|
|
3
|
+
require 'watir'
|
|
4
|
+
require 'pry-rescue'
|
|
5
|
+
require 'require_all'
|
|
6
|
+
|
|
7
|
+
require_relative "watir_setup/base_page"
|
|
8
|
+
require_relative "watir_setup/page_helper"
|
|
9
|
+
require_relative "watir_setup/current_browser"
|
|
10
|
+
require_relative "watir_setup/version"
|
data/spec/google_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler'
|
|
3
|
+
require 'watir'
|
|
4
|
+
require 'rspec'
|
|
5
|
+
require 'pry-rescue'
|
|
6
|
+
require 'require_all'
|
|
7
|
+
require_rel '../lib'
|
|
8
|
+
|
|
9
|
+
RSpec.configure do |config|
|
|
10
|
+
include PageHelper
|
|
11
|
+
|
|
12
|
+
config.before(:all) do
|
|
13
|
+
init_browser
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
config.after(:suite) do
|
|
17
|
+
CurrentBrowser.instance.browser.close rescue Errno::ECONNREFUSED
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def init_browser
|
|
22
|
+
CurrentBrowser.instance.start_browser(ENV['BROWSER'])
|
|
23
|
+
@browser = CurrentBrowser.instance.browser
|
|
24
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: watir_setup
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Krzysztof Bober
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2017-03-31 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: It sets up all you need to work with Watir w/ Page Objects pattern
|
|
14
|
+
email:
|
|
15
|
+
- krizzb@gmail.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- ".rspec"
|
|
21
|
+
- Gemfile
|
|
22
|
+
- Gemfile.lock
|
|
23
|
+
- lib/watir_setup.rb
|
|
24
|
+
- lib/watir_setup/base_page.rb
|
|
25
|
+
- lib/watir_setup/current_browser.rb
|
|
26
|
+
- lib/watir_setup/page_helper.rb
|
|
27
|
+
- lib/watir_setup/version.rb
|
|
28
|
+
- spec/google_spec.rb
|
|
29
|
+
- spec/spec_helper.rb
|
|
30
|
+
homepage: https://github.com/krizo/watir_setup
|
|
31
|
+
licenses: []
|
|
32
|
+
metadata: {}
|
|
33
|
+
post_install_message:
|
|
34
|
+
rdoc_options: []
|
|
35
|
+
require_paths:
|
|
36
|
+
- lib
|
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - ">="
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '0'
|
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
requirements: []
|
|
48
|
+
rubyforge_project:
|
|
49
|
+
rubygems_version: 2.4.8
|
|
50
|
+
signing_key:
|
|
51
|
+
specification_version: 4
|
|
52
|
+
summary: Watir with page objects setup
|
|
53
|
+
test_files:
|
|
54
|
+
- spec/google_spec.rb
|
|
55
|
+
- spec/spec_helper.rb
|