symbiont 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.hound.yml +76 -0
- data/.rspec +2 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +18 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +0 -3
- data/README.md +16 -8
- data/Rakefile +13 -2
- data/bin/console +2 -2
- data/lib/symbiont/accessor.rb +9 -9
- data/lib/symbiont/assertions.rb +33 -33
- data/lib/symbiont/data_builder.rb +35 -35
- data/lib/symbiont/data_reader.rb +20 -22
- data/lib/symbiont/data_setter.rb +39 -32
- data/lib/symbiont/elements.rb +186 -185
- data/lib/symbiont/errors.rb +9 -9
- data/lib/symbiont/factory.rb +75 -87
- data/lib/symbiont/helpers.rb +52 -50
- data/lib/symbiont/pages.rb +161 -164
- data/lib/symbiont/service_objects.rb +15 -15
- data/lib/symbiont/soap_methods.rb +47 -46
- data/lib/symbiont/version.rb +1 -1
- data/lib/symbiont.rb +28 -30
- data/symbiont.gemspec +7 -4
- metadata +53 -20
- data/lib/symbiont/workflows.rb +0 -88
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4dd5da4488bf024530d92fe4153d35de0cb682b
|
4
|
+
data.tar.gz: 63df367508079f7fe43c1764f9b31639d7dbd223
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92eaac0062c704ef7cbd99dc51c67f90e5f73d7232176ce18ef45093884b0d8040a452fb6dfe800c755a62dcdc8f2abd23ba1a985f06f62a1dd86a67a5ac53df
|
7
|
+
data.tar.gz: 820896b1c967e3a3954925237e11856ffae0632a094cc6b7674d873c34800230c53e5b8da13608ac7353a5673a5756e2b70c511775f5573bf22fa123b211f7b2
|
data/.gitignore
CHANGED
data/.hound.yml
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- symbiont.gemspec
|
4
|
+
- test/*.rb
|
5
|
+
- spec/**/*
|
6
|
+
|
7
|
+
# missing top-level module documentation comment
|
8
|
+
Style/Documentation:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
# prefer reduce over inject
|
12
|
+
Style/CollectionMethods:
|
13
|
+
PreferredMethods:
|
14
|
+
reduce: 'inject'
|
15
|
+
|
16
|
+
# use each_with_object instead of inject
|
17
|
+
Style/EachWithObject:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
# removing the preference for string single quotes
|
21
|
+
Style/StringLiterals:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
# prefer fail over raise
|
25
|
+
Style/SignalException:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Style/TrailingComma:
|
29
|
+
EnforcedStyleForMultiline: comma
|
30
|
+
|
31
|
+
# this never works for validations
|
32
|
+
Style/AlignHash:
|
33
|
+
EnforcedLastArgumentHashStyle: ignore_implicit
|
34
|
+
|
35
|
+
# align multi-line params with previous line
|
36
|
+
Style/AlignParameters:
|
37
|
+
EnforcedStyle: with_fixed_indentation
|
38
|
+
|
39
|
+
# indent `when` clause one step from `case`
|
40
|
+
Style/CaseIndentation:
|
41
|
+
IndentOneStep: true
|
42
|
+
|
43
|
+
# don't force crappy var names for reduce/inject loops
|
44
|
+
Style/SingleLineBlockParams:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
# for method chains, keep the dot with the method name
|
48
|
+
Style/DotPosition:
|
49
|
+
EnforcedStyle: leading
|
50
|
+
|
51
|
+
Style/AccessorMethodName:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
# stop nesting so hard
|
55
|
+
Metrics/BlockNesting:
|
56
|
+
Max: 2
|
57
|
+
|
58
|
+
# short methods
|
59
|
+
Metrics/MethodLength:
|
60
|
+
Max: 20
|
61
|
+
|
62
|
+
Metrics/LineLength:
|
63
|
+
Max: 105
|
64
|
+
|
65
|
+
# fewer parameters
|
66
|
+
Metrics/ParameterLists:
|
67
|
+
Max: 5
|
68
|
+
|
69
|
+
Metrics/AbcSize:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
Metrics/ModuleLength:
|
73
|
+
Max: 120
|
74
|
+
|
75
|
+
Metrics/CyclomaticComplexity:
|
76
|
+
Max: 7
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Symbiont
|
2
2
|
|
3
|
-
[
|
4
|
-
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/jnyman/symbiont/badge.svg?branch=master)](https://coveralls.io/r/jnyman/symbiont?branch=master)
|
3
|
+
[![Build Status](https://travis-ci.org/jnyman/symbiont.svg)](https://travis-ci.org/jnyman/symbiont)
|
6
4
|
[![Gem Version](https://badge.fury.io/rb/symbiont.svg)](http://badge.fury.io/rb/symbiont)
|
7
5
|
[![Dependency Status](https://gemnasium.com/jnyman/symbiont.png)](https://gemnasium.com/jnyman/symbiont)
|
8
6
|
[![Code Climate](https://codeclimate.com/github/jnyman/symbiont/badges/gpa.svg)](https://codeclimate.com/github/jnyman/symbiont)
|
@@ -16,20 +14,26 @@ Symbiont provides a semantic domain-specific language that can be used to constr
|
|
16
14
|
|
17
15
|
Symbiont is a test solution micro-framework.
|
18
16
|
|
19
|
-
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
|
17
|
+
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 yet concise. Further, it should be able to serve as one component of your own custom modularized framework, allowing you to compose solutions. 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 [Specify](https://github.com/jnyman/specify) tool.
|
20
18
|
|
21
|
-
|
19
|
+
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 as part of the DSL that Symbiont provides. This DSL can be utilized in the context of the [Watir-WebDriver test library](https://github.com/watir/watir-webdriver).
|
22
20
|
|
23
|
-
|
21
|
+
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.
|
24
22
|
|
25
23
|
|
26
24
|
## Installation
|
27
25
|
|
28
|
-
|
26
|
+
To get the latest stable release, add this line to your application's Gemfile:
|
29
27
|
|
30
28
|
gem 'symbiont'
|
31
29
|
|
32
|
-
|
30
|
+
To get the latest code:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
gem 'symbiont', git: https://github.com/jnyman/symbiont
|
34
|
+
```
|
35
|
+
|
36
|
+
After doing one of the above, execute the following command:
|
33
37
|
|
34
38
|
$ bundle
|
35
39
|
|
@@ -57,6 +61,10 @@ So, with that bit of context, think of this library as a facultative, endosymbio
|
|
57
61
|
|
58
62
|
## Contributing
|
59
63
|
|
64
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/jnyman/symbiont](https://github.com/jnyman/symbiont). The testing ecosystem of Ruby is very large and this project is intended to be a welcoming arena for collaboration on yet another testing tool. As such, contributors are very much welcome but are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
65
|
+
|
66
|
+
To contribute to Symbiont:
|
67
|
+
|
60
68
|
1. [Fork the project](http://gun.io/blog/how-to-github-fork-branch-and-pull-request/) ( https://github.com/[my-github-username]/symbiont/fork ).
|
61
69
|
2. Create your feature branch. (`git checkout -b my-new-feature`)
|
62
70
|
3. Commit your changes. (`git commit -am 'new feature'`)
|
data/Rakefile
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
require 'bundler/gem_tasks'
|
3
|
+
require 'rdoc/task'
|
4
|
+
require 'rubocop/rake_task'
|
3
5
|
require 'rspec/core/rake_task'
|
4
6
|
|
7
|
+
RuboCop::RakeTask.new
|
8
|
+
|
5
9
|
namespace :test do
|
6
10
|
desc 'Run the Symbiont script.'
|
7
11
|
task :script do
|
@@ -15,7 +19,7 @@ namespace :spec do
|
|
15
19
|
system('rm -rf spec/reports')
|
16
20
|
end
|
17
21
|
|
18
|
-
RSpec::Core::RakeTask.new(:
|
22
|
+
RSpec::Core::RakeTask.new(all: :clean) do |config|
|
19
23
|
options = %w(--color)
|
20
24
|
options += %w(--format documentation)
|
21
25
|
options += %w(--format html --out spec/reports/symbiont-test-report.html)
|
@@ -24,4 +28,11 @@ namespace :spec do
|
|
24
28
|
end
|
25
29
|
end
|
26
30
|
|
27
|
-
|
31
|
+
Rake::RDocTask.new do |rdoc|
|
32
|
+
rdoc.rdoc_dir = 'doc'
|
33
|
+
rdoc.main = 'README.md'
|
34
|
+
rdoc.title = "Symbiont #{Symbiont::VERSION}"
|
35
|
+
rdoc.rdoc_files.include('README*', 'lib/**/*.rb')
|
36
|
+
end
|
37
|
+
|
38
|
+
task default: ['spec:all', :rubocop]
|
data/bin/console
CHANGED
data/lib/symbiont/accessor.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module Accessor
|
3
|
-
# @param element [Symbol] name of Watir-based object
|
4
|
-
# @param locator [Hash] locators for referencing the element
|
5
|
-
def reference_element(element, locator)
|
6
|
-
browser.send(element, locator)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module Symbiont
|
2
|
+
module Accessor
|
3
|
+
# @param element [Symbol] name of Watir-based object
|
4
|
+
# @param locator [Hash] locators for referencing the element
|
5
|
+
def reference_element(element, locator)
|
6
|
+
browser.send(element, locator)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
data/lib/symbiont/assertions.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module Assertion
|
3
|
-
include Helpers
|
4
|
-
|
5
|
-
def url_is(url=nil)
|
6
|
-
url_is_empty if url.nil?
|
7
|
-
@url = url
|
8
|
-
end
|
9
|
-
|
10
|
-
def url_matches(pattern=nil)
|
11
|
-
url_match_is_empty if pattern.nil?
|
12
|
-
url_match_is_empty if pattern.is_a?(String)
|
13
|
-
@url_match = pattern
|
14
|
-
end
|
15
|
-
|
16
|
-
def title_is(title=nil)
|
17
|
-
title_is_empty if title.nil?
|
18
|
-
@title = title
|
19
|
-
end
|
20
|
-
|
21
|
-
def asserted_url
|
22
|
-
@url
|
23
|
-
end
|
24
|
-
|
25
|
-
def url_match
|
26
|
-
@url_match
|
27
|
-
end
|
28
|
-
|
29
|
-
def asserted_title
|
30
|
-
@title
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
1
|
+
module Symbiont
|
2
|
+
module Assertion
|
3
|
+
include Helpers
|
4
|
+
|
5
|
+
def url_is(url = nil)
|
6
|
+
url_is_empty if url.nil? || url.empty?
|
7
|
+
@url = url
|
8
|
+
end
|
9
|
+
|
10
|
+
def url_matches(pattern = nil)
|
11
|
+
url_match_is_empty if pattern.nil?
|
12
|
+
url_match_is_empty if pattern.is_a?(String) && pattern.empty?
|
13
|
+
@url_match = pattern
|
14
|
+
end
|
15
|
+
|
16
|
+
def title_is(title = nil)
|
17
|
+
title_is_empty if title.nil? || title.empty?
|
18
|
+
@title = title
|
19
|
+
end
|
20
|
+
|
21
|
+
def asserted_url
|
22
|
+
@url
|
23
|
+
end
|
24
|
+
|
25
|
+
def url_match
|
26
|
+
@url_match
|
27
|
+
end
|
28
|
+
|
29
|
+
def asserted_title
|
30
|
+
@title
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,35 +1,35 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module DataBuilder
|
3
|
-
extend DataReader
|
4
|
-
|
5
|
-
class << self
|
6
|
-
attr_accessor :data_source
|
7
|
-
|
8
|
-
def default_data_path
|
9
|
-
'data'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def data_about(key, specified={})
|
14
|
-
if key.is_a?(String) && key.match(%r{/})
|
15
|
-
file, record = key.split('/')
|
16
|
-
DataBuilder.load("#{file}.yml")
|
17
|
-
else
|
18
|
-
record = key.to_s
|
19
|
-
DataBuilder.load('default.yml')
|
20
|
-
end
|
21
|
-
|
22
|
-
Symbiont
|
23
|
-
|
24
|
-
data = DataBuilder.data_source[record]
|
25
|
-
raise ArgumentError, "Undefined key for data: #{key}" unless data
|
26
|
-
|
27
|
-
data.merge(specified)
|
28
|
-
end
|
29
|
-
|
30
|
-
alias_method :data_from, :data_about
|
31
|
-
alias_method :data_for, :data_about
|
32
|
-
alias_method :using_data_for, :data_about
|
33
|
-
alias_method :using_data_from, :data_about
|
34
|
-
end
|
35
|
-
end
|
1
|
+
module Symbiont
|
2
|
+
module DataBuilder
|
3
|
+
extend DataReader
|
4
|
+
|
5
|
+
class << self
|
6
|
+
attr_accessor :data_source
|
7
|
+
|
8
|
+
def default_data_path
|
9
|
+
'data'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def data_about(key, specified = {})
|
14
|
+
if key.is_a?(String) && key.match(%r{/})
|
15
|
+
file, record = key.split('/')
|
16
|
+
DataBuilder.load("#{file}.yml")
|
17
|
+
else
|
18
|
+
record = key.to_s
|
19
|
+
DataBuilder.load('default.yml')
|
20
|
+
end
|
21
|
+
|
22
|
+
Symbiont.trace("DataBuilder.data_source = #{DataBuilder.data_source}")
|
23
|
+
|
24
|
+
data = DataBuilder.data_source[record]
|
25
|
+
raise ArgumentError, "Undefined key for data: #{key}" unless data
|
26
|
+
|
27
|
+
data.merge(specified)
|
28
|
+
end
|
29
|
+
|
30
|
+
alias_method :data_from, :data_about
|
31
|
+
alias_method :data_for, :data_about
|
32
|
+
alias_method :using_data_for, :data_about
|
33
|
+
alias_method :using_data_from, :data_about
|
34
|
+
end
|
35
|
+
end
|
data/lib/symbiont/data_reader.rb
CHANGED
@@ -1,22 +1,20 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module DataReader
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
return
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
#
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
1
|
+
module Symbiont
|
2
|
+
module DataReader
|
3
|
+
def data_path=(path)
|
4
|
+
@data_path = path
|
5
|
+
end
|
6
|
+
|
7
|
+
def data_path
|
8
|
+
return @data_path if @data_path
|
9
|
+
return default_data_path if self.respond_to? :default_data_path
|
10
|
+
nil
|
11
|
+
end
|
12
|
+
|
13
|
+
# The data_source name here must match the name used for the
|
14
|
+
# class accessor in the data builder. It is this data_source
|
15
|
+
# variable that connects the reader and the builder.
|
16
|
+
def load(file)
|
17
|
+
@data_source = YAML.load_file "#{data_path}/#{file}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/symbiont/data_setter.rb
CHANGED
@@ -1,32 +1,39 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module DataSetter
|
3
|
-
# @param data [Hash] the data to use
|
4
|
-
def using(data)
|
5
|
-
data.each do |key, value|
|
6
|
-
use_data_with(key, value) if object_enabled_for(key)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
alias_method :using_data, :using
|
11
|
-
alias_method :use_data, :using
|
12
|
-
alias_method :using_values, :using
|
13
|
-
alias_method :use_values, :using
|
14
|
-
|
15
|
-
def use_data_with(key, value)
|
16
|
-
element =
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
1
|
+
module Symbiont
|
2
|
+
module DataSetter
|
3
|
+
# @param data [Hash] the data to use
|
4
|
+
def using(data)
|
5
|
+
data.each do |key, value|
|
6
|
+
use_data_with(key, value) if object_enabled_for(key)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
alias_method :using_data, :using
|
11
|
+
alias_method :use_data, :using
|
12
|
+
alias_method :using_values, :using
|
13
|
+
alias_method :use_values, :using
|
14
|
+
|
15
|
+
def use_data_with(key, value)
|
16
|
+
element = send("#{key}")
|
17
|
+
set_and_select(element, value)
|
18
|
+
check_and_uncheck(element, value)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def set_and_select(element, value)
|
24
|
+
call_method_chain("#{key}.set", value) if element.class == Watir::TextField
|
25
|
+
call_method_chain("#{key}.set") if element.class == Watir::Radio
|
26
|
+
call_method_chain("#{key}.select", value) if element.class == Watir::Select
|
27
|
+
end
|
28
|
+
|
29
|
+
def check_and_uncheck(element, value)
|
30
|
+
return call_method_chain("#{key}.check") if element.class == Watir::CheckBox && value
|
31
|
+
return call_method_chain("#{key}.uncheck") if element.class == Watir::CheckBox
|
32
|
+
end
|
33
|
+
|
34
|
+
def object_enabled_for(key)
|
35
|
+
web_element = send("#{key}")
|
36
|
+
web_element.enabled? && web_element.visible?
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|