symbiont 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 }
@@ -1,9 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module SeleniumWebDriver
4
-
5
- require_relative('platform_selenium/platform_object')
6
-
7
- end # module: SeleniumWebDriver
8
- end # module: Platforms
9
- end # module: Symbiont
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
@@ -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
@@ -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