symbiont 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/README.md +12 -0
- data/lib/symbiont/factory.rb +5 -1
- data/lib/symbiont/pages.rb +31 -0
- data/lib/symbiont/version.rb +1 -1
- data/lib/symbiont.rb +2 -0
- data/spec/symbiont/page_spec.rb +17 -0
- data/symbiont.gemspec +8 -7
- data/test/symbiont-script.rb +3 -3
- metadata +47 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0d743af01968067b8d47f402817f4958ccb3e43
|
4
|
+
data.tar.gz: db46be1f58ed30af742038e4e47a54ed0d4a1eeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2a68b9558ba508248101eaff5034998021ed029bdcce64040c9050ae5e055d0ffb48ee9bc1ff16908e52bcfce7bcc12ef9c0ed3f0bca837b9485c52f24e5bbb
|
7
|
+
data.tar.gz: e92524a6df1e92b75de5f6734837391fcf9b54e4b9fcddb953e7275ae3fef16ef2570506b4223c7a862706c1ab331f86aa0115e1f38fceec452d1dd0e4050f46
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -10,6 +10,18 @@ Symbiont provides a semantic domain-specific language that can be used to constr
|
|
10
10
|
|
11
11
|
[![Gitter chat](https://badges.gitter.im/jnyman/symbiont.png)](https://gitter.im/jnyman/symbiont)
|
12
12
|
[![endorse](https://api.coderwall.com/jnyman/endorsecount.png)](https://coderwall.com/jnyman)
|
13
|
+
[![Stories in Ready](https://badge.waffle.io/jnyman/symbiont.png?label=ready&title=Ready)](https://waffle.io/jnyman/symbiont)
|
14
|
+
|
15
|
+
|
16
|
+
## What is this?
|
17
|
+
|
18
|
+
Symbiont is a test solution micro-framework.
|
19
|
+
|
20
|
+
A micro-framework provides a focused solution, which means it does one thing and one thing only, instead of trying to solve each and every problem. While doing that one thing it does well, the micro-framework should do it while being expressive and concise. Further, it should be able to serve as one component of your own custom modularized framework, allowing you to compose solutions.
|
21
|
+
|
22
|
+
To that end, you can use Symbiont directly as an automated test library or you can use it with other tools such as [RSpec](http://rspec.info/), [Cucumber](http://cukes.info/), or my own [Lucid](https://github.com/jnyman/lucid) tool.
|
23
|
+
|
24
|
+
In terms of what Symbiont does, it provides a way to describe your application in terms of activity and page definitions. Those definitions can then be referenced by the [Watir-WebDriver test library](https://github.com/watir/watir-webdriver) using the DSL and API that Symbiont provides. The DSL provides a fluent interface that can be used for constructing test execution logic. This fluent interface promotes the idea of compressibility of your test logic, allowing for more factoring, more reuse, and less repetition.
|
13
25
|
|
14
26
|
|
15
27
|
## Installation
|
data/lib/symbiont/factory.rb
CHANGED
@@ -15,6 +15,11 @@ module Symbiont
|
|
15
15
|
|
16
16
|
if @context.kind_of?(definition)
|
17
17
|
block.call @context if block
|
18
|
+
|
19
|
+
unless @page.kind_of?(definition)
|
20
|
+
@page = @context
|
21
|
+
end
|
22
|
+
|
18
23
|
return @context
|
19
24
|
end
|
20
25
|
|
@@ -72,7 +77,6 @@ module Symbiont
|
|
72
77
|
def on_set(definition, &block)
|
73
78
|
on(definition, &block)
|
74
79
|
@context = @page
|
75
|
-
@page
|
76
80
|
end
|
77
81
|
end
|
78
82
|
end
|
data/lib/symbiont/pages.rb
CHANGED
@@ -118,6 +118,35 @@ module Symbiont
|
|
118
118
|
result
|
119
119
|
end
|
120
120
|
|
121
|
+
# Used to identify a web element or action on a web element as existing
|
122
|
+
# within an enclosing window object. The window can be referenced using
|
123
|
+
# either the title attribute of the window or a direct URL. The URL does
|
124
|
+
# not have to be the entire URL; it can just be a page name.
|
125
|
+
#
|
126
|
+
# @param locator [Hash] the :title or :url of the window
|
127
|
+
# @param block [Proc] any code that should be executed as an
|
128
|
+
# action on or within the window
|
129
|
+
def within_window(locator, &block)
|
130
|
+
identifier = {locator.keys.first => /#{Regexp.escape(locator.values.first)}/}
|
131
|
+
browser.window(identifier).use(&block)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Used to identify a web element as existing within an enclosing object
|
135
|
+
# like a modal dialog box. What this does is override the normal call to
|
136
|
+
# showModalDialog and opens a window instead. In order to use this new
|
137
|
+
# window, you have to attach to it.
|
138
|
+
def within_modal(&block)
|
139
|
+
convert_modal_to_window = %Q{
|
140
|
+
window.showModalDialog = function(sURL, vArguments, sFeatures) {
|
141
|
+
window.dialogArguments = vArguments;
|
142
|
+
modalWin = window.open(sURL, 'modal', sFeatures);
|
143
|
+
return modalWin;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
browser.execute_script(convert_modal_to_window)
|
147
|
+
yield if block_given?
|
148
|
+
end
|
149
|
+
|
121
150
|
alias_method :current_url, :url
|
122
151
|
alias_method :page_url, :url
|
123
152
|
alias_method :html, :markup
|
@@ -129,5 +158,7 @@ module Symbiont
|
|
129
158
|
alias_method :execute_script, :run_script
|
130
159
|
alias_method :remove_cookies, :clear_cookies
|
131
160
|
alias_method :refresh_page, :refresh
|
161
|
+
alias_method :select_window, :within_window
|
162
|
+
alias_method :attach_to, :within_window
|
132
163
|
end
|
133
164
|
end
|
data/lib/symbiont/version.rb
CHANGED
data/lib/symbiont.rb
CHANGED
data/spec/symbiont/page_spec.rb
CHANGED
@@ -156,5 +156,22 @@ describe Symbiont::Page do
|
|
156
156
|
expect(watir_browser).to receive(:execute_script).twice
|
157
157
|
watir_definition.will_prompt('Testing') {}
|
158
158
|
end
|
159
|
+
|
160
|
+
it 'should be able to attach to a window by using the title' do
|
161
|
+
allow(watir_browser).to receive(:window).with(:title => /Display\ Results/).and_return(watir_browser)
|
162
|
+
allow(watir_browser).to receive(:use)
|
163
|
+
watir_definition.within_window(title: 'Display Results')
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'should be able to attach to a window by using the url' do
|
167
|
+
allow(watir_browser).to receive(:window).with(:url => /results\.html/).and_return(watir_browser)
|
168
|
+
allow(watir_browser).to receive(:use)
|
169
|
+
watir_definition.within_window(url: 'results.html')
|
170
|
+
end
|
171
|
+
|
172
|
+
it 'should be able to convert a modal popup to a window' do
|
173
|
+
allow(watir_browser).to receive(:execute_script)
|
174
|
+
watir_definition.within_modal {}
|
175
|
+
end
|
159
176
|
end
|
160
177
|
end
|
data/symbiont.gemspec
CHANGED
@@ -25,22 +25,23 @@ Gem::Specification.new do |spec|
|
|
25
25
|
}
|
26
26
|
spec.homepage = 'https://github.com/jnyman/symbiont'
|
27
27
|
spec.license = 'MIT'
|
28
|
-
spec.requirements << 'Watir-WebDriver, Colorize'
|
29
28
|
|
30
29
|
spec.files = `git ls-files -z`.split("\x0")
|
31
30
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
32
31
|
spec.test_files = spec.files.grep(%r{^(test|spec|specs|features)/})
|
33
32
|
spec.require_paths = %w(lib)
|
34
33
|
|
35
|
-
spec.required_ruby_version = '>=
|
34
|
+
spec.required_ruby_version = '>= 2.0'
|
36
35
|
spec.required_rubygems_version = '>= 1.8.29'
|
37
36
|
|
38
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
39
|
-
spec.add_development_dependency 'rake'
|
40
|
-
spec.add_development_dependency 'rspec', '
|
37
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
38
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
41
40
|
|
42
|
-
spec.add_runtime_dependency 'colorize', '
|
43
|
-
spec.add_runtime_dependency 'watir-webdriver', '
|
41
|
+
spec.add_runtime_dependency 'colorize', '~> 0.7'
|
42
|
+
spec.add_runtime_dependency 'watir-webdriver', '~> 0.6'
|
43
|
+
spec.add_runtime_dependency 'watir-dom-wait'
|
44
|
+
spec.add_runtime_dependency 'watir-scroll'
|
44
45
|
|
45
46
|
spec.post_install_message = %{
|
46
47
|
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
|
data/test/symbiont-script.rb
CHANGED
@@ -147,13 +147,13 @@ end
|
|
147
147
|
|
148
148
|
#basic
|
149
149
|
|
150
|
-
|
150
|
+
symbiont_browser
|
151
151
|
|
152
|
-
@page = Dialogic.new(@
|
152
|
+
@page = Dialogic.new(@browser)
|
153
153
|
@page.view
|
154
154
|
@page.login_as_admin
|
155
155
|
|
156
|
-
@page = Practice.new(@
|
156
|
+
@page = Practice.new(@browser)
|
157
157
|
@page.view
|
158
158
|
@page.enable_sith_list.set
|
159
159
|
@page.sith_power.select 'Sundering Assault'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symbiont
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Nyman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,70 +16,98 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.7'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: colorize
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.7'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: watir-webdriver
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.6'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.6'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: watir-dom-wait
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
87
|
- - '>='
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0
|
89
|
+
version: '0'
|
62
90
|
type: :runtime
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
94
|
- - '>='
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: watir-
|
98
|
+
name: watir-scroll
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
101
|
- - '>='
|
74
102
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0
|
103
|
+
version: '0'
|
76
104
|
type: :runtime
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
108
|
- - '>='
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0
|
110
|
+
version: '0'
|
83
111
|
description: "\n Symbiont is a framework that allows you to describe your application
|
84
112
|
in\n terms of activity and page definitions. Those definitions can then be\n
|
85
113
|
\ referenced by test libraries using the DSL that Symbiont provides. The\n DSL
|
@@ -134,7 +162,7 @@ licenses:
|
|
134
162
|
- MIT
|
135
163
|
metadata: {}
|
136
164
|
post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n
|
137
|
-
\ Symbiont 0.
|
165
|
+
\ Symbiont 0.8.0 has been installed.\n\n(::) (::) (::) (::) (::) (::) (::) (::)
|
138
166
|
(::) (::) (::) (::)\n "
|
139
167
|
rdoc_options: []
|
140
168
|
require_paths:
|
@@ -143,14 +171,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
171
|
requirements:
|
144
172
|
- - '>='
|
145
173
|
- !ruby/object:Gem::Version
|
146
|
-
version:
|
174
|
+
version: '2.0'
|
147
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
176
|
requirements:
|
149
177
|
- - '>='
|
150
178
|
- !ruby/object:Gem::Version
|
151
179
|
version: 1.8.29
|
152
|
-
requirements:
|
153
|
-
- Watir-WebDriver, Colorize
|
180
|
+
requirements: []
|
154
181
|
rubyforge_project:
|
155
182
|
rubygems_version: 2.0.14
|
156
183
|
signing_key:
|
@@ -171,3 +198,4 @@ test_files:
|
|
171
198
|
- spec/symbiont/factory_spec.rb
|
172
199
|
- spec/symbiont/page_spec.rb
|
173
200
|
- test/symbiont-script.rb
|
201
|
+
has_rdoc:
|