test_abstractions 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/test_abstractions.rb +2 -0
- data/lib/test_abstractions/client.rb +20 -36
- data/lib/test_abstractions/configuration.rb +1 -0
- data/lib/test_abstractions/context.rb +10 -3
- data/lib/test_abstractions/session.rb +9 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9798a615f745891fc3fc5e470c89fd65d6b8f790
|
4
|
+
data.tar.gz: 3653970b01a4e6b76c54d94e2a866b237e7d64d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e0f4d32a45814b83103ad051760f1ae76f88ff5288044b08659cb099bea488c5fde2961bece333bf4dfc28f8a85935e7a61faa987a1990feb58ace83a417263
|
7
|
+
data.tar.gz: 2c8e7bb34fe82dd7f2709b9678f424a12fb729b3b900d36b015022634468ebd8c0e22c4c8aab4eaae47d12eb69bfb37baa34e844543aed47523b8325d1daddb0
|
data/lib/test_abstractions.rb
CHANGED
@@ -9,6 +9,7 @@ require 'capybara/poltergeist'
|
|
9
9
|
require 'virtus'
|
10
10
|
require 'initializer'
|
11
11
|
|
12
|
+
require 'test_abstractions/session'
|
12
13
|
require 'test_abstractions/client'
|
13
14
|
require 'test_abstractions/configuration'
|
14
15
|
require 'test_abstractions/context'
|
@@ -17,3 +18,4 @@ require 'test_abstractions/evidence'
|
|
17
18
|
require 'test_abstractions/fields'
|
18
19
|
require 'test_abstractions/filler'
|
19
20
|
require 'test_abstractions/form'
|
21
|
+
require 'test_abstractions/data_object'
|
@@ -14,18 +14,10 @@ module TestAbstractions
|
|
14
14
|
|
15
15
|
def self.build(base_uri: nil, driver: nil)
|
16
16
|
base_uri ||= Context.instance.base_uri
|
17
|
-
|
18
|
-
driver ||= cls.driver
|
19
|
-
instance = cls.new base_uri, driver
|
20
|
-
instance
|
21
|
-
end
|
17
|
+
driver = Context.instance.driver
|
22
18
|
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.only_poltergeist_for_now__selenium_would_also_be_useful
|
28
|
-
Poltergeist
|
19
|
+
instance = new base_uri, driver
|
20
|
+
instance
|
29
21
|
end
|
30
22
|
|
31
23
|
def method_missing(meth, *args, &block)
|
@@ -36,35 +28,27 @@ module TestAbstractions
|
|
36
28
|
driver.send meth, *args, &block
|
37
29
|
end
|
38
30
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
Capybara::Session.new :poltergeist
|
44
|
-
end
|
45
|
-
|
46
|
-
def open(uri)
|
47
|
-
uri = absolute_uri(uri)
|
48
|
-
driver.visit(uri)
|
49
|
-
end
|
31
|
+
def open(uri)
|
32
|
+
uri = absolute_uri(uri)
|
33
|
+
driver.visit(uri)
|
34
|
+
end
|
50
35
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
36
|
+
def absolute_uri(uri)
|
37
|
+
base = URI(base_uri)
|
38
|
+
u = URI(uri)
|
39
|
+
(base + u).to_s
|
40
|
+
end
|
56
41
|
|
57
|
-
|
58
|
-
|
59
|
-
|
42
|
+
def enter(content, selector)
|
43
|
+
driver.fill_in(selector, :with => content)
|
44
|
+
end
|
60
45
|
|
61
|
-
|
62
|
-
|
63
|
-
|
46
|
+
def select(option, selector)
|
47
|
+
driver.select(option, :from => selector)
|
48
|
+
end
|
64
49
|
|
65
|
-
|
66
|
-
|
67
|
-
end
|
50
|
+
def click(selector)
|
51
|
+
click_on(selector)
|
68
52
|
end
|
69
53
|
|
70
54
|
module Accessor
|
@@ -2,15 +2,22 @@ module TestAbstractions
|
|
2
2
|
class Context
|
3
3
|
include Initializer
|
4
4
|
|
5
|
-
initializer :base_uri
|
5
|
+
initializer :base_uri, :driver
|
6
6
|
|
7
7
|
def self.instance
|
8
8
|
@instance ||= build
|
9
9
|
end
|
10
10
|
|
11
|
-
def self.build(configuration: nil)
|
11
|
+
def self.build(configuration: nil, driver: nil)
|
12
12
|
configuration ||= Configuration.instance
|
13
|
-
|
13
|
+
|
14
|
+
base_uri = configuration.base_uri
|
15
|
+
|
16
|
+
driver_name = configuration.driver_name
|
17
|
+
|
18
|
+
driver = Session.build driver_name
|
19
|
+
|
20
|
+
instance = new base_uri, driver
|
14
21
|
instance
|
15
22
|
end
|
16
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_abstractions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Bellware
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- lib/test_abstractions/fields.rb
|
125
125
|
- lib/test_abstractions/filler.rb
|
126
126
|
- lib/test_abstractions/form.rb
|
127
|
+
- lib/test_abstractions/session.rb
|
127
128
|
homepage: https://github.com/sbellware/test_abstractions
|
128
129
|
licenses:
|
129
130
|
- MIT
|