symbiont 0.0.2 → 0.0.3
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.
- data/.gitignore +16 -5
- data/HISTORY.md +6 -0
- data/README.md +23 -1
- data/Rakefile +1 -0
- data/lib/symbiont/enclosers.rb +26 -0
- data/lib/symbiont/factory.rb +33 -0
- data/lib/symbiont/generators.rb +106 -4
- data/lib/symbiont/logger.rb +5 -0
- data/lib/symbiont/platform_watir/platform_object.rb +114 -13
- data/lib/symbiont/platforms.rb +1 -5
- data/lib/symbiont/version.rb +1 -1
- data/lib/symbiont/web_objects/_common.rb +13 -2
- data/lib/symbiont.rb +10 -5
- data/spec/spec_helper.rb +8 -9
- data/spec/symbiont/enclosers_spec.rb +16 -0
- data/spec/symbiont/factory_spec.rb +35 -0
- data/spec/symbiont/generators/button_generators_spec.rb +37 -18
- data/spec/symbiont/generators/link_generators_spec.rb +27 -16
- data/spec/symbiont/generators/text_field_generators_spec.rb +29 -23
- data/spec/symbiont/generators_spec.rb +27 -17
- data/spec/symbiont/platform_object_spec.rb +1 -9
- data/spec/symbiont/symbiont_spec.rb +2 -2
- data/spec/symbiont/web_object_spec.rb +17 -0
- data/symbiont.gemspec +20 -22
- data/test/symbiont_test.rb +158 -0
- metadata +16 -25
- data/lib/symbiont/platform_selenium/platform_object.rb +0 -71
- data/lib/symbiont/platform_selenium.rb +0 -9
- data/test/base.rb +0 -17
- data/test/symbiont_selenium.rb +0 -35
- data/test/symbiont_watir.rb +0 -35
@@ -1,71 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module Platforms
|
3
|
-
module SeleniumWebDriver
|
4
|
-
|
5
|
-
class PlatformObject
|
6
|
-
|
7
|
-
def initialize(browser)
|
8
|
-
@browser = browser
|
9
|
-
end
|
10
|
-
|
11
|
-
# Platform method to make a call to a specified URL.
|
12
|
-
# See Symbiont::Generators#url_is
|
13
|
-
def visit(url)
|
14
|
-
@browser.navigate.to(url)
|
15
|
-
end
|
16
|
-
|
17
|
-
# Platform method to return a link object.
|
18
|
-
# Link objects are of type: Symbiont::WebObjects::Link
|
19
|
-
# @see Symbiont::Generators#link
|
20
|
-
def get_link_for(locator)
|
21
|
-
web_object = @browser.find_element(locator.keys.first, locator.values.first)
|
22
|
-
WebObjects::Link.new()
|
23
|
-
end
|
24
|
-
|
25
|
-
# Platform method to click a link object.
|
26
|
-
# @see Symbiont::Generators#link
|
27
|
-
def click_link_for(locator)
|
28
|
-
@browser.find_element(locator.keys.first, locator.values.first).click
|
29
|
-
end
|
30
|
-
|
31
|
-
# Platform method to return a button object.
|
32
|
-
# Button objects are of type: Symbiont::WebObjects::Button
|
33
|
-
# @see Symbiont::Generators#button
|
34
|
-
def get_button_for(locator)
|
35
|
-
web_object = @browser.find_element(locator.keys.first, locator.values.first)
|
36
|
-
WebObjects::Button.new()
|
37
|
-
end
|
38
|
-
|
39
|
-
# Platform method to click a button object.
|
40
|
-
# @see Symbiont::Generators#button
|
41
|
-
def click_button_for(locator)
|
42
|
-
@browser.find_element(locator.keys.first, locator.values.first).click
|
43
|
-
end
|
44
|
-
|
45
|
-
# Platform method to return a text field object.
|
46
|
-
# Text field objects are of type: Symbiont::WebObjects::TextField
|
47
|
-
# @see Symbiont::Generators#text_field
|
48
|
-
def get_text_field_for(locator)
|
49
|
-
web_object = @browser.find_element(locator.keys.first, locator.values.first)
|
50
|
-
WebObjects::TextField.new()
|
51
|
-
end
|
52
|
-
|
53
|
-
# Platform method to retrieve text from a text field object.
|
54
|
-
# @see Symbiont::Generators#text_field
|
55
|
-
def get_text_field_value_for(locator)
|
56
|
-
@browser.find_element(locator.keys.first, locator.values.first).attribute('value')
|
57
|
-
end
|
58
|
-
|
59
|
-
# Platform method to enter text into a text field object.
|
60
|
-
# @see Symbiont::Generators#text_field
|
61
|
-
def set_text_field_value_for(locator, value)
|
62
|
-
@browser.find_element(locator.keys.first, locator.values.first).clear
|
63
|
-
@browser.find_element(locator.keys.first, locator.values.first).send_keys(value)
|
64
|
-
end
|
65
|
-
end # class: PlatformObject
|
66
|
-
|
67
|
-
end # module: SeleniumWebDriver
|
68
|
-
end # module: Platforms
|
69
|
-
end # module: Symbiont
|
70
|
-
|
71
|
-
Dir["#{File.dirname(__FILE__)}/../web_objects/**/*.rb"].sort.each { |file| require file }
|
data/test/base.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
|
2
|
-
|
3
|
-
require 'watir-webdriver'
|
4
|
-
require 'symbiont'
|
5
|
-
|
6
|
-
class Login
|
7
|
-
include Symbiont
|
8
|
-
end
|
9
|
-
|
10
|
-
@browser_watir = Watir::Browser.new(:firefox)
|
11
|
-
watir_test = Login.new(@browser_watir)
|
12
|
-
|
13
|
-
@browser_selenium = Selenium::WebDriver.for(:firefox)
|
14
|
-
selenium_test = Login.new(@browser_selenium)
|
15
|
-
|
16
|
-
@browser_watir.close
|
17
|
-
@browser_selenium.close
|
data/test/symbiont_selenium.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
|
2
|
-
|
3
|
-
require 'symbiont'
|
4
|
-
|
5
|
-
class Login
|
6
|
-
include Symbiont
|
7
|
-
|
8
|
-
url_is "http://localhost:4567"
|
9
|
-
begin_at "http://localhost:4567"
|
10
|
-
|
11
|
-
link :test_page, id: "testPage"
|
12
|
-
button :clickme, id: "clickme_id"
|
13
|
-
text_field :book_title, id: "title"
|
14
|
-
end
|
15
|
-
|
16
|
-
@browser_selenium = Selenium::WebDriver.for(:firefox)
|
17
|
-
selenium_test = Login.new(@browser_selenium)
|
18
|
-
selenium_test.view
|
19
|
-
|
20
|
-
test_link = selenium_test.test_page_object
|
21
|
-
puts test_link
|
22
|
-
selenium_test.test_page
|
23
|
-
|
24
|
-
test_text_field = selenium_test.book_title_object
|
25
|
-
puts test_text_field
|
26
|
-
|
27
|
-
selenium_test.book_title = "Revelation Space"
|
28
|
-
book = selenium_test.book_title
|
29
|
-
puts "Book title is '#{book}'."
|
30
|
-
|
31
|
-
test_button = selenium_test.clickme_object
|
32
|
-
puts test_button
|
33
|
-
selenium_test.clickme
|
34
|
-
|
35
|
-
@browser_selenium.close
|
data/test/symbiont_watir.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
|
2
|
-
|
3
|
-
require 'symbiont'
|
4
|
-
|
5
|
-
class Login
|
6
|
-
include Symbiont
|
7
|
-
|
8
|
-
url_is "http://localhost:4567"
|
9
|
-
begin_at "http://localhost:4567"
|
10
|
-
|
11
|
-
link :test_page, id: "testPage"
|
12
|
-
button :clickme, id: "clickme_id"
|
13
|
-
text_field :book_title, id: "title"
|
14
|
-
end
|
15
|
-
|
16
|
-
@browser_watir = Watir::Browser.new(:firefox)
|
17
|
-
watir_test = Login.new(@browser_watir)
|
18
|
-
watir_test.view
|
19
|
-
|
20
|
-
test_link = watir_test.test_page_object
|
21
|
-
puts test_link
|
22
|
-
watir_test.test_page
|
23
|
-
|
24
|
-
test_text_field = watir_test.book_title_object
|
25
|
-
puts test_text_field
|
26
|
-
|
27
|
-
watir_test.book_title = "Revelation Space"
|
28
|
-
book = watir_test.book_title
|
29
|
-
puts "Book title is '#{book}'."
|
30
|
-
|
31
|
-
test_button = watir_test.clickme_object
|
32
|
-
puts test_button
|
33
|
-
watir_test.clickme
|
34
|
-
|
35
|
-
@browser_watir.close
|