symbiote 0.1.0 → 0.2.0
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 +4 -4
- data/.gitignore +39 -18
- data/.hound.yml +62 -0
- data/.rspec +3 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +5 -14
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +0 -2
- data/LICENSE.txt +17 -18
- data/README.md +47 -28
- data/Rakefile +27 -11
- data/bin/console +10 -0
- data/bin/setup +8 -0
- data/lib/symbiote.rb +26 -51
- data/lib/symbiote/data_setter.rb +51 -0
- data/lib/symbiote/elements.rb +60 -0
- data/lib/symbiote/factory.rb +24 -0
- data/lib/symbiote/pages.rb +65 -0
- data/lib/symbiote/situation.rb +53 -0
- data/lib/symbiote/version.rb +12 -1
- data/symbiote.gemspec +27 -21
- metadata +58 -60
- data/HISTORY.md +0 -7
- data/lib/symbiote/errors.rb +0 -8
- data/lib/symbiote/generators.rb +0 -21
- data/lib/symbiote/logger.rb +0 -5
- data/lib/symbiote/platform_selenium.rb +0 -18
- data/lib/symbiote/platform_selenium/platform_object.rb +0 -21
- data/lib/symbiote/platform_watir.rb +0 -18
- data/lib/symbiote/platform_watir/platform_object.rb +0 -21
- data/lib/symbiote/platforms.rb +0 -31
- data/spec/spec_helper.rb +0 -33
- data/spec/symbiote/generators_spec.rb +0 -63
- data/spec/symbiote/platform_object_spec.rb +0 -31
- data/spec/symbiote/symbiote_spec.rb +0 -7
data/HISTORY.md
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
Change Log and History
|
2
|
-
======================
|
3
|
-
|
4
|
-
Version 0.1.0 / 2013-10-06
|
5
|
-
--------------------------
|
6
|
-
|
7
|
-
Initial development release of Symbiote. This initial release handles browser drivers, platform objects, and the start of the generators mechanism. Support is in place for both Watir-WebDriver and Selenium-WebDriver.
|
data/lib/symbiote/errors.rb
DELETED
data/lib/symbiote/generators.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module Symbiote
|
2
|
-
module Generators
|
3
|
-
|
4
|
-
def url_is(url)
|
5
|
-
define_method('view') do
|
6
|
-
platform.visit(url)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def title_is(title)
|
11
|
-
define_method('has_title?') do
|
12
|
-
validation_msg = "Expected title: '#{title}'; Actual title: '#{browser.title}'"
|
13
|
-
valid_title = title == browser.title if title.kind_of?(String)
|
14
|
-
valid_title = title =~ browser.title if title.kind_of?(Regexp)
|
15
|
-
raise Errors::TitleNotMatched, validation_msg unless valid_title
|
16
|
-
valid_title
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
data/lib/symbiote/logger.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module Symbiote
|
2
|
-
module Platforms
|
3
|
-
module SeleniumWebDriver
|
4
|
-
|
5
|
-
def self.create_platform_object_for(browser)
|
6
|
-
require 'symbiote/platform_selenium/platform_object'
|
7
|
-
return SeleniumWebDriver::PlatformObject.new(browser)
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.works_with(browser)
|
11
|
-
browser.is_a?(::Selenium::WebDriver::Driver)
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
Symbiote::Platforms.register(:selenium_webdriver, Symbiote::Platforms::SeleniumWebDriver)
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Symbiote
|
2
|
-
module Platforms
|
3
|
-
module SeleniumWebDriver
|
4
|
-
class PlatformObject
|
5
|
-
|
6
|
-
attr_reader :browser
|
7
|
-
|
8
|
-
def initialize(browser)
|
9
|
-
@browser = browser
|
10
|
-
end
|
11
|
-
|
12
|
-
## Browser-Level Actions ##
|
13
|
-
|
14
|
-
def visit(url)
|
15
|
-
browser.navigate.to(url)
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Symbiote
|
2
|
-
module Platforms
|
3
|
-
module WatirWebDriver
|
4
|
-
|
5
|
-
def self.create_platform_object_for(browser)
|
6
|
-
require 'symbiote/platform_watir/platform_object'
|
7
|
-
return WatirWebDriver::PlatformObject.new(browser)
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.works_with(browser)
|
11
|
-
browser.is_a?(::Watir::Browser)
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
Symbiote::Platforms.register(:watir_webdriver, Symbiote::Platforms::WatirWebDriver)
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Symbiote
|
2
|
-
module Platforms
|
3
|
-
module WatirWebDriver
|
4
|
-
class PlatformObject
|
5
|
-
|
6
|
-
attr_reader :browser
|
7
|
-
|
8
|
-
def initialize(browser)
|
9
|
-
@browser = browser
|
10
|
-
end
|
11
|
-
|
12
|
-
## Browser-Level Actions ##
|
13
|
-
|
14
|
-
def visit(url)
|
15
|
-
browser.goto(url)
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/symbiote/platforms.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
module Symbiote
|
2
|
-
module Platforms
|
3
|
-
|
4
|
-
@drivers = {}
|
5
|
-
|
6
|
-
def self.list
|
7
|
-
@drivers
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.register(driver, platform)
|
11
|
-
@drivers[driver] = platform
|
12
|
-
end
|
13
|
-
|
14
|
-
# This module determines what execution platform Symbiote will use.
|
15
|
-
# The decision is based on the browser that has been established for
|
16
|
-
# the execution profile.
|
17
|
-
#
|
18
|
-
# @param [Object] browser the browser to establish the platform for
|
19
|
-
# @returns [Object] a platform object to execute tests against
|
20
|
-
def get_platform_for(browser)
|
21
|
-
Symbiote::Platforms.list.each_value do |driver|
|
22
|
-
return driver.create_platform_object_for(browser) if driver.works_with(browser)
|
23
|
-
end
|
24
|
-
raise Errors::UnableToCreatePlatform, "Unable to create a platform object for #{browser}"
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
require 'symbiote/platform_watir'
|
31
|
-
require 'symbiote/platform_selenium'
|
data/spec/spec_helper.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
$LOAD_PATH.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
|
3
|
-
|
4
|
-
require 'coveralls'
|
5
|
-
Coveralls.wear!
|
6
|
-
|
7
|
-
unless ENV['CI']
|
8
|
-
require 'simplecov'
|
9
|
-
|
10
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
11
|
-
SimpleCov::Formatter::HTMLFormatter,
|
12
|
-
Coveralls::SimpleCov::Formatter
|
13
|
-
]
|
14
|
-
SimpleCov.start
|
15
|
-
end
|
16
|
-
|
17
|
-
require 'symbiote'
|
18
|
-
require 'watir-webdriver'
|
19
|
-
require 'selenium-webdriver'
|
20
|
-
|
21
|
-
def mock_browser_for_watir
|
22
|
-
watir_browser = double('watir')
|
23
|
-
watir_browser.stub(:is_a?).with(Watir::Browser).and_return(true)
|
24
|
-
watir_browser.stub(:is_a?).with(Selenium::WebDriver::Driver).and_return(false)
|
25
|
-
watir_browser
|
26
|
-
end
|
27
|
-
|
28
|
-
def mock_browser_for_selenium
|
29
|
-
selenium_browser = double('selenium')
|
30
|
-
selenium_browser.stub(:is_a?).with(Watir::Browser).and_return(false)
|
31
|
-
selenium_browser.stub(:is_a?).with(Selenium::WebDriver::Driver).and_return(true)
|
32
|
-
selenium_browser
|
33
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require_relative '../spec_helper'
|
2
|
-
|
3
|
-
class PageGenerators
|
4
|
-
include Symbiote
|
5
|
-
|
6
|
-
url_is 'http://localhost:4567'
|
7
|
-
title_is 'Symbiote'
|
8
|
-
end
|
9
|
-
|
10
|
-
describe Symbiote::Generators do
|
11
|
-
let(:watir_browser) { mock_browser_for_watir }
|
12
|
-
let(:watir_definition) { PageGenerators.new(watir_browser) }
|
13
|
-
|
14
|
-
let(:selenium_browser) { mock_browser_for_selenium }
|
15
|
-
let(:selenium_definition) { PageGenerators.new(selenium_browser) }
|
16
|
-
|
17
|
-
context 'any page definition' do
|
18
|
-
context 'providing a page title to be verified' do
|
19
|
-
it 'should specify and verify the page title' do
|
20
|
-
watir_browser.should_receive(:title).twice.and_return('Symbiote')
|
21
|
-
watir_definition.has_title?
|
22
|
-
|
23
|
-
selenium_browser.should_receive(:title).twice.and_return('Symbiote')
|
24
|
-
selenium_definition.has_title?
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should raise an error if the page title is not verified' do
|
28
|
-
msg = "Expected title: 'Symbiote'; Actual title: 'Testing'"
|
29
|
-
watir_browser.should_receive(:title).twice.and_return('Testing')
|
30
|
-
expect { watir_definition.has_title? }.to raise_error(Symbiote::Errors::TitleNotMatched, msg)
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should validate the title if provided a regular expression' do
|
34
|
-
class QuickDefinition
|
35
|
-
include Symbiote
|
36
|
-
title_is (/\w+/)
|
37
|
-
end
|
38
|
-
|
39
|
-
selenium_browser.should_receive(:title).twice.and_return('Symbiote')
|
40
|
-
QuickDefinition.new(selenium_browser).has_title?
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'a definition using watir-webdriver' do
|
46
|
-
context 'providing a url' do
|
47
|
-
it 'should navigate to the page when viewed' do
|
48
|
-
watir_browser.should_receive(:goto)
|
49
|
-
watir_definition.view
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
context 'a definition using selenium-webdriver' do
|
55
|
-
context 'providing a url' do
|
56
|
-
it 'should navigate to the page when viewed' do
|
57
|
-
selenium_browser.should_receive(:navigate).and_return(selenium_browser)
|
58
|
-
selenium_browser.should_receive(:to)
|
59
|
-
selenium_definition.view
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require_relative '../spec_helper'
|
2
|
-
|
3
|
-
class PageDefinition
|
4
|
-
include Symbiote
|
5
|
-
end
|
6
|
-
|
7
|
-
describe Symbiote do
|
8
|
-
let(:watir_browser) { mock_browser_for_watir }
|
9
|
-
let(:selenium_browser) { mock_browser_for_selenium }
|
10
|
-
let(:watir_definition) { PageDefinition.new(watir_browser) }
|
11
|
-
let(:selenium_definition) { PageDefinition.new(selenium_browser) }
|
12
|
-
|
13
|
-
context 'a definition using watir-webdriver' do
|
14
|
-
it 'should return a watir platform object' do
|
15
|
-
watir_definition.platform.should be_kind_of Symbiote::Platforms::WatirWebDriver::PlatformObject
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'a definition using selenium-webdriver' do
|
20
|
-
it 'should return a selenium platform object' do
|
21
|
-
selenium_definition.platform.should be_kind_of Symbiote::Platforms::SeleniumWebDriver::PlatformObject
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'a definition using an unrecognized driver' do
|
26
|
-
it 'should raise an exception' do
|
27
|
-
msg = 'Unable to create a platform object for unknown_browser'
|
28
|
-
expect { PageDefinition.new(:unknown_browser) }.to raise_error(Symbiote::Errors::UnableToCreatePlatform, msg)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|