symbiont 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/Gemfile.lock +22 -7
  2. data/HISTORY.md +6 -0
  3. data/app/public/css/site.css +16 -0
  4. data/app/public/js/site.js +3 -1
  5. data/app/views/comics.erb +23 -1
  6. data/app/views/webobject.erb +1 -1
  7. data/lib/symbiont/data_setter.rb +7 -3
  8. data/lib/symbiont/enclosers.rb +24 -27
  9. data/lib/symbiont/evaluators.rb +52 -23
  10. data/lib/symbiont/factory.rb +19 -75
  11. data/lib/symbiont/generators.rb +172 -44
  12. data/lib/symbiont/platform_watir/platform_object.rb +202 -18
  13. data/lib/symbiont/version.rb +1 -1
  14. data/lib/symbiont/web_objects/button.rb +1 -1
  15. data/lib/symbiont/web_objects/checkbox.rb +1 -1
  16. data/lib/symbiont/web_objects/heading.rb +12 -0
  17. data/lib/symbiont/web_objects/hidden_field.rb +19 -0
  18. data/lib/symbiont/web_objects/label.rb +15 -0
  19. data/lib/symbiont/web_objects/list_item.rb +13 -0
  20. data/lib/symbiont/web_objects/ordered_list.rb +49 -0
  21. data/lib/symbiont/web_objects/radio.rb +1 -1
  22. data/lib/symbiont/web_objects/select_list.rb +1 -1
  23. data/lib/symbiont/web_objects/table.rb +4 -0
  24. data/lib/symbiont/web_objects/table_row.rb +4 -0
  25. data/lib/symbiont/web_objects/text_area.rb +26 -0
  26. data/lib/symbiont/web_objects/unordered_list.rb +49 -0
  27. data/lib/symbiont.rb +7 -0
  28. data/lucid.yml +6 -0
  29. data/spec/spec_helper.rb +70 -16
  30. data/spec/symbiont/data_setter_spec.rb +65 -62
  31. data/spec/symbiont/enclosers_spec.rb +76 -57
  32. data/spec/symbiont/evaluators_spec.rb +95 -75
  33. data/spec/symbiont/factory_spec.rb +174 -122
  34. data/spec/symbiont/generators/button_generators_spec.rb +34 -31
  35. data/spec/symbiont/generators/checkbox_generators_spec.rb +79 -75
  36. data/spec/symbiont/generators/div_generators_spec.rb +56 -52
  37. data/spec/symbiont/generators/hidden_field_generators_spec.rb +65 -0
  38. data/spec/symbiont/generators/link_generators_spec.rb +30 -27
  39. data/spec/symbiont/generators/paragraph_generators_spec.rb +22 -17
  40. data/spec/symbiont/generators/radio_generators_spec.rb +76 -77
  41. data/spec/symbiont/generators/select_list_generators_spec.rb +93 -77
  42. data/spec/symbiont/generators/span_generators_spec.rb +56 -52
  43. data/spec/symbiont/generators/{cell_generators_spec.rb → table_cell_generators_spec.rb} +56 -52
  44. data/spec/symbiont/generators/table_generators_spec.rb +56 -52
  45. data/spec/symbiont/generators/text_area_generators_spec.rb +72 -0
  46. data/spec/symbiont/generators/text_field_generators_spec.rb +30 -27
  47. data/spec/symbiont/generators_spec.rb +38 -28
  48. data/spec/symbiont/locators_spec.rb +68 -68
  49. data/spec/symbiont/platform_object_spec.rb +2 -4
  50. data/spec/symbiont/symbiont_spec.rb +10 -8
  51. data/spec/symbiont/web_object_spec.rb +194 -194
  52. data/spec/symbiont/web_objects/button_spec.rb +38 -30
  53. data/spec/symbiont/web_objects/checkbox_spec.rb +27 -27
  54. data/spec/symbiont/web_objects/div_spec.rb +18 -11
  55. data/spec/symbiont/web_objects/heading_spec.rb +22 -0
  56. data/spec/symbiont/web_objects/hidden_field_spec.rb +18 -0
  57. data/spec/symbiont/web_objects/label_spec.rb +18 -0
  58. data/spec/symbiont/web_objects/link_spec.rb +33 -33
  59. data/spec/symbiont/web_objects/list_item_spec.rb +18 -0
  60. data/spec/symbiont/web_objects/option_spec.rb +9 -9
  61. data/spec/symbiont/web_objects/ordered_list_spec.rb +53 -0
  62. data/spec/symbiont/web_objects/paragraph_spec.rb +9 -2
  63. data/spec/symbiont/web_objects/radio_spec.rb +27 -27
  64. data/spec/symbiont/web_objects/select_list_spec.rb +69 -69
  65. data/spec/symbiont/web_objects/span_spec.rb +18 -11
  66. data/spec/symbiont/web_objects/table_cell_spec.rb +19 -19
  67. data/spec/symbiont/web_objects/table_row_spec.rb +58 -58
  68. data/spec/symbiont/web_objects/table_spec.rb +61 -61
  69. data/spec/symbiont/web_objects/text_area_spec.rb +18 -0
  70. data/spec/symbiont/web_objects/text_field_spec.rb +39 -39
  71. data/spec/symbiont/web_objects/unordered_list_spec.rb +51 -0
  72. data/specs/common/support/browser.rb +25 -0
  73. data/specs/common/support/env.rb +6 -0
  74. data/specs/common/support/events.rb +15 -0
  75. data/specs/enclosers.feature +9 -0
  76. data/specs/evaluators.feature +26 -0
  77. data/specs/pages/characters.rb +22 -0
  78. data/specs/pages/home.rb +9 -0
  79. data/specs/pages/stardate.rb +23 -0
  80. data/specs/pages/web_objects.rb +77 -0
  81. data/specs/select_list.feature +53 -0
  82. data/specs/steps/enclosers_steps.rb +17 -0
  83. data/specs/steps/evaluators_steps.rb +44 -0
  84. data/specs/steps/navigation_steps.rb +14 -0
  85. data/specs/steps/select_list_steps.rb +94 -0
  86. data/specs/steps/table_cell_steps.rb +31 -0
  87. data/specs/steps/table_steps.rb +87 -0
  88. data/specs/table.feature +49 -0
  89. data/specs/table_cell.feature +27 -0
  90. data/symbiont.gemspec +4 -1
  91. metadata +72 -6
  92. data/cucumber.yml +0 -6
@@ -1,61 +1,61 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::Table do
4
- describe "implementation" do
5
- let(:table_object) { double('table_object') }
6
- let(:table_row_object) { double('table_row_object') }
7
- let(:table) { Symbiont::WebObjects::Table }
8
-
9
- it "should reference standard usable selectors" do
10
- [:class, :id, :name, :index, :xpath].each do |s|
11
- locator = table.provide_locator_for s => 'value'
12
- locator.keys.first.should == s
13
- end
14
- end
15
-
16
- it "should register with a table tag" do
17
- ::Symbiont::WebObjects.get_class_for(:table).should == ::Symbiont::WebObjects::Table
18
- end
19
-
20
- context "on the watir platform" do
21
- let(:watir_table) { Symbiont::WebObjects::Table.new(table_object) }
22
-
23
- it "should return a table row when indexed" do
24
- table_object.stub(:[]).with(1).and_return(table_object)
25
- watir_table[1].should be_instance_of Symbiont::WebObjects::TableRow
26
- end
27
-
28
- it "should return the first row" do
29
- table_object.stub(:[]).with(0).and_return(table_object)
30
- watir_table.first_row.should be_instance_of Symbiont::WebObjects::TableRow
31
- end
32
-
33
- it "should return the last row" do
34
- table_object.stub(:[]).with(-1).and_return(table_object)
35
- watir_table.last_row.should be_instance_of Symbiont::WebObjects::TableRow
36
- end
37
-
38
- it "should return a row using text from the first column" do
39
- table_object.stub(:[]).with("row_text").and_return(table_object)
40
- table_object.should_receive(:rows).and_return(table_object)
41
- table_object.should_receive(:find_index).and_return("row_text")
42
- watir_table["row_text"].should be_instance_of Symbiont::WebObjects::TableRow
43
- end
44
-
45
- it "should return the number of rows" do
46
- table_object.should_receive(:wd).and_return(table_object)
47
- table_object.should_receive(:find_elements).with(:xpath, ".//child::tr").and_return(table_object)
48
- table_object.should_receive(:size).and_return(2)
49
- watir_table.rows.should == 2
50
- end
51
-
52
- it "should iterate over the table rows" do
53
- watir_table.should_receive(:rows).and_return(2)
54
- table_object.stub(:[]).and_return(table_object)
55
- count = 0
56
- watir_table.each { |e| count += 1 }
57
- count.should == 2
58
- end
59
- end
60
- end
61
- end
1
+ require 'spec_helper'
2
+
3
+ describe Symbiont::WebObjects::Table do
4
+ describe "implementation" do
5
+ let(:table_object) { double('table_object') }
6
+ let(:table_row_object) { double('table_row_object') }
7
+ let(:table) { Symbiont::WebObjects::Table }
8
+
9
+ it "should reference standard usable selectors" do
10
+ [:class, :id, :name, :index, :xpath].each do |s|
11
+ locator = table.provide_locator_for s => 'value'
12
+ locator.keys.first.should == s
13
+ end
14
+ end
15
+
16
+ it "should register with a table tag" do
17
+ ::Symbiont::WebObjects.get_class_for(:table).should == ::Symbiont::WebObjects::Table
18
+ end
19
+
20
+ context "on the watir platform" do
21
+ let(:watir_table) { Symbiont::WebObjects::Table.new(table_object) }
22
+
23
+ it "should return a table row when indexed" do
24
+ table_object.stub(:[]).with(1).and_return(table_object)
25
+ watir_table[1].should be_instance_of Symbiont::WebObjects::TableRow
26
+ end
27
+
28
+ it "should return the first row" do
29
+ table_object.stub(:[]).with(0).and_return(table_object)
30
+ watir_table.first_row.should be_instance_of Symbiont::WebObjects::TableRow
31
+ end
32
+
33
+ it "should return the last row" do
34
+ table_object.stub(:[]).with(-1).and_return(table_object)
35
+ watir_table.last_row.should be_instance_of Symbiont::WebObjects::TableRow
36
+ end
37
+
38
+ it "should return a row using text from the first column" do
39
+ table_object.stub(:[]).with("row_text").and_return(table_object)
40
+ table_object.should_receive(:rows).and_return(table_object)
41
+ table_object.should_receive(:find_index).and_return("row_text")
42
+ watir_table["row_text"].should be_instance_of Symbiont::WebObjects::TableRow
43
+ end
44
+
45
+ it "should return the number of rows" do
46
+ table_object.should_receive(:wd).and_return(table_object)
47
+ table_object.should_receive(:find_elements).with(:xpath, ".//child::tr").and_return(table_object)
48
+ table_object.should_receive(:size).and_return(2)
49
+ watir_table.rows.should == 2
50
+ end
51
+
52
+ it "should iterate over the table rows" do
53
+ watir_table.should_receive(:rows).and_return(2)
54
+ table_object.stub(:[]).and_return(table_object)
55
+ count = 0
56
+ watir_table.each { |e| count += 1 }
57
+ count.should == 2
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Symbiont::WebObjects::TextArea do
4
+ describe "implementation" do
5
+ let(:text_area_object) { Symbiont::WebObjects::TextArea }
6
+
7
+ it "should reference standard usable selectors" do
8
+ [:class, :id, :name, :index, :xpath, :title, :value, :text, :label].each do |s|
9
+ locator = text_area_object.provide_locator_for s => 'value'
10
+ locator.keys.first.should == s
11
+ end
12
+ end
13
+
14
+ it "should register with a text area tag" do
15
+ ::Symbiont::WebObjects.get_class_for(:textarea).should == ::Symbiont::WebObjects::TextArea
16
+ end
17
+ end
18
+ end
@@ -1,39 +1,39 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::TextField do
4
- describe "implementation" do
5
- let(:text_field_object) { double('text_field_object') }
6
- let(:text_field_definition) { ::Symbiont::WebObjects::TextField.new(text_field_object) }
7
- let(:text_field) { Symbiont::WebObjects::TextField }
8
-
9
- it "should reference standard usable selectors" do
10
- [:class, :id, :name, :index, :xpath].each do |s|
11
- locator = text_field.provide_locator_for s => 'value'
12
- locator.keys.first.should == s
13
- end
14
- end
15
-
16
- it "should get the value of a text field" do
17
- text_field_object.should_receive(:value).and_return("testing")
18
- text_field_definition.value.should == "testing"
19
- end
20
-
21
- it "should set the value of a text field" do
22
- text_field_object.should_receive(:set).with("testing")
23
- text_field_definition.value = "testing"
24
- end
25
-
26
- it "should append text to a text field" do
27
- text_field_object.should_receive(:send_keys).with("testing")
28
- text_field_definition.append "testing"
29
- end
30
-
31
- it "should register with a text type" do
32
- ::Symbiont::WebObjects.get_class_for(:input, :text).should == ::Symbiont::WebObjects::TextField
33
- end
34
-
35
- it "should register with a password type" do
36
- ::Symbiont::WebObjects.get_class_for(:input, :password).should == ::Symbiont::WebObjects::TextField
37
- end
38
- end
39
- end
1
+ require 'spec_helper'
2
+
3
+ describe Symbiont::WebObjects::TextField do
4
+ describe "implementation" do
5
+ let(:text_field_object) { double('text_field_object') }
6
+ let(:text_field_definition) { ::Symbiont::WebObjects::TextField.new(text_field_object) }
7
+ let(:text_field) { Symbiont::WebObjects::TextField }
8
+
9
+ it "should reference standard usable selectors" do
10
+ [:class, :id, :name, :index, :xpath].each do |s|
11
+ locator = text_field.provide_locator_for s => 'value'
12
+ locator.keys.first.should == s
13
+ end
14
+ end
15
+
16
+ it "should get the value of a text field" do
17
+ text_field_object.should_receive(:value).and_return("testing")
18
+ text_field_definition.value.should == "testing"
19
+ end
20
+
21
+ it "should set the value of a text field" do
22
+ text_field_object.should_receive(:set).with("testing")
23
+ text_field_definition.value = "testing"
24
+ end
25
+
26
+ it "should append text to a text field" do
27
+ text_field_object.should_receive(:send_keys).with("testing")
28
+ text_field_definition.append "testing"
29
+ end
30
+
31
+ it "should register with a text type" do
32
+ ::Symbiont::WebObjects.get_class_for(:input, :text).should == ::Symbiont::WebObjects::TextField
33
+ end
34
+
35
+ it "should register with a password type" do
36
+ ::Symbiont::WebObjects.get_class_for(:input, :password).should == ::Symbiont::WebObjects::TextField
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+
3
+ describe Symbiont::WebObjects::UnorderedList do
4
+ describe "implementation" do
5
+ let(:unordered_list_object) { Symbiont::WebObjects::UnorderedList }
6
+
7
+ it "should allow locators to be used" do
8
+ [:class, :id, :index, :xpath, :name].each do |t|
9
+ locator = unordered_list_object.provide_locator_for t => 'value'
10
+ locator.keys.first.should == t
11
+ end
12
+ end
13
+
14
+ it "should register with a unordered list (ul) tag" do
15
+ ::Symbiont::WebObjects.get_class_for(:ul).should == ::Symbiont::WebObjects::UnorderedList
16
+ end
17
+
18
+ context "on the watir platform" do
19
+ let(:ul_element) { double('ul_element') }
20
+ let(:watir_unordered_list) { Symbiont::WebObjects::UnorderedList.new(ul_element) }
21
+
22
+ it "should return a list item when indexed" do
23
+ ul_element.stub(:uls).and_return([ul_element])
24
+ ul_element.stub(:find_elements).and_return(ul_element)
25
+ ul_element.stub(:map).and_return([ul_element])
26
+ ul_element.stub(:parent).and_return(ul_element)
27
+ ul_element.stub(:element).and_return(ul_element)
28
+ ul_element.stub(:==).and_return(true)
29
+ watir_unordered_list[1]
30
+ end
31
+
32
+ it "should know how many list items it contains" do
33
+ ul_element.stub(:uls).and_return([ul_element])
34
+ ul_element.stub(:find_elements).and_return(ul_element)
35
+ ul_element.stub(:map).and_return([ul_element])
36
+ ul_element.stub(:parent).and_return(ul_element)
37
+ ul_element.stub(:element).and_return(ul_element)
38
+ ul_element.stub(:==).and_return(true)
39
+ watir_unordered_list.items.should == 1
40
+ end
41
+
42
+ it "should iterate over the list items" do
43
+ watir_unordered_list.should_receive(:items).and_return(5)
44
+ watir_unordered_list.stub(:[])
45
+ count = 0
46
+ watir_unordered_list.each { |item| count += 1 }
47
+ count.should == 5
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,25 @@
1
+ module Symbiont
2
+ module Browser
3
+
4
+ @@browser = false
5
+
6
+ def self.start
7
+ unless @@browser
8
+ target = ENV['BROWSER']
9
+ @@browser = watir_browser(target)
10
+ end
11
+ @@browser
12
+ end
13
+
14
+ def self.stop
15
+ @@browser.quit if @@browser
16
+ @@browser = false
17
+ end
18
+
19
+ private
20
+
21
+ def self.watir_browser(target)
22
+ Watir::Browser.new(target.to_sym)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,6 @@
1
+ require 'symbiont'
2
+ require 'symbiont/factory'
3
+
4
+ include RSpec::Matchers
5
+
6
+ World(Symbiont::Factory)
@@ -0,0 +1,15 @@
1
+ AfterConfiguration do |config|
2
+ puts("Tests are being executed from: #{config.feature_dirs}")
3
+ end
4
+
5
+ Before do
6
+ @browser = Symbiont::Browser.start
7
+ end
8
+
9
+ After do
10
+ #Symbiont::Browser.stop
11
+ end
12
+
13
+ at_exit do
14
+ Symbiont::Browser.stop
15
+ end
@@ -0,0 +1,9 @@
1
+ Feature: Ability to handle enclosing elements.
2
+
3
+ Scenario: Handling javascript message boxes
4
+ * the alert message is "Alert Message Received"
5
+ * the confirm message is "Confirmation Message Received"
6
+ * the prompt message is "Favorite Sith Lord" and the default value is "Darth Bane"
7
+
8
+ Scenario: Handling framed elements
9
+ * the year for stardate "51887.2" is "2375"
@@ -0,0 +1,26 @@
1
+ Feature: Ability to handle browser and page actions.
2
+
3
+ Scenario: Getting web page text
4
+ * the text "Multiphasic Temporal Convergence" appears on the web objects page
5
+
6
+ Scenario: Getting web page markup
7
+ * the markup "<legend>Tell Us What You Read</legend>" appears in the web objects page
8
+
9
+ Scenario: Getting web page title
10
+ * the title "Web Objects | Symbiote" appears for the web objects page
11
+
12
+ Scenario: Getting the web page url
13
+ * the url "http://localhost:9292/webobject" matches the web objects page
14
+
15
+ Scenario: Getting the type of element with focus
16
+ * the "name" text field should have focus on initial loading of the web objects page
17
+
18
+ Scenario: Setting the focus to an element
19
+ When setting the focus on the chameleoflage armor field
20
+ Then the "cameleoflage armor" checkbox should have focus
21
+
22
+ Scenario: Back, forward, and refresh browser actions
23
+ * going back from the web objects to the home page
24
+ * going forward from the home page to the web objects page
25
+ * refreshing the web objects page
26
+
@@ -0,0 +1,22 @@
1
+ class Characters
2
+ include Symbiont
3
+ include Symbiont::Factory
4
+
5
+ url_is "http://localhost:9292/comics"
6
+ title_is "Comic Heroes and Villains | Symbiote"
7
+
8
+ table :characters_id, id: "comic-grid"
9
+ table :characters_name, name: "comic-grid"
10
+ table :characters_class, class: "display"
11
+ table :characters_xpath, xpath: "//table"
12
+ table :characters_index, index: 0
13
+
14
+ table :publishers, id: "pub-grid"
15
+
16
+ cell :dc_year_id, id: "dc_founded"
17
+ cell :dc_year_name, name: "dc_founded"
18
+ cell :dc_year_class, class: "pub"
19
+ cell :dc_year_xpath, xpath: "//td[@id='dc_founded']"
20
+
21
+ cell :marvel_year_id, id: "marvel_founded"
22
+ end
@@ -0,0 +1,9 @@
1
+ class Home
2
+ include Symbiont
3
+
4
+ url_is "http://localhost:9292"
5
+
6
+ def check_for_title(text)
7
+ self.title.should == text
8
+ end
9
+ end
@@ -0,0 +1,23 @@
1
+ class Stardate
2
+ include Symbiont
3
+
4
+ url_is "http://localhost:9292/stardate"
5
+
6
+ link :calculator, href: "stardate_calc"
7
+
8
+ frame(id: "fancybox-frame") do |context|
9
+ text_field :tng_stardate, name: "stardateTNGValue", frame: context
10
+ text_field :tos_stardate, name: "stardateTOSValue", frame: context
11
+ text_field :tng_value, name: "calendarTNGValue", frame: context
12
+ text_field :tos_value, name: "calendarTOSValue", frame: context
13
+ button :convert_tng, id: "convertTNG", frame: context
14
+ button :convert_tos, id: "convertTOS", frame: context
15
+ end
16
+
17
+ def calculate_tng(value)
18
+ self.wait_for_app(2)
19
+ self.tng_stardate = value
20
+ self.convert_tng
21
+ self.tng_value
22
+ end
23
+ end
@@ -0,0 +1,77 @@
1
+ class WebObjects
2
+ include Symbiont
3
+ include Symbiont::Factory
4
+
5
+ url_is "http://localhost:9292/webobject"
6
+ title_is "Web Objects | Symbiote"
7
+
8
+ text_field :name, id: "name"
9
+ text_field :email, id: "email"
10
+
11
+ checkbox :chameleoflage_armor, id: "camoArmor"
12
+ checkbox :make_sith_active, id: "toggleSith"
13
+
14
+ select_list :sith_power, id: "sith"
15
+ select :physics_id, id: "physics"
16
+ select :physics_name, name: "physics"
17
+ select :physics_xpath, xpath: "//select[@id='physics']"
18
+ select :physics_index, index: 1
19
+
20
+ button :alert, id: "alertButton"
21
+ button :confirm, id: "confirmButton"
22
+ button :prompt, id: "promptButton"
23
+
24
+ def check_for_text(text)
25
+ self.text.include? text
26
+ end
27
+
28
+ def check_for_markup(text)
29
+ self.html.include? text
30
+ end
31
+
32
+ def check_for_title(text)
33
+ self.title.should == text
34
+ end
35
+
36
+ def check_for_url(text)
37
+ self.url.should == text
38
+ end
39
+
40
+ def check_for_focus(element)
41
+ case element
42
+ when "name"
43
+ self.focus.should be_an_instance_of Symbiont::WebObjects::TextField
44
+ when "cameleoflage armor"
45
+ self.focus.should be_an_instance_of Symbiont::WebObjects::CheckBox
46
+ end
47
+ end
48
+
49
+ def set_focus_for(locator)
50
+ self.checkbox_object(locator).focus
51
+ end
52
+
53
+ def generate_alert(text)
54
+ message = self.will_alert do
55
+ self.alert
56
+ end
57
+
58
+ message.should == text
59
+ end
60
+
61
+ def generate_confirm(text)
62
+ message = self.will_confirm(true) do
63
+ self.confirm
64
+ end
65
+
66
+ message.should == text
67
+ end
68
+
69
+ def generate_prompt(text, value)
70
+ message = self.will_prompt("Darth Invictus") do
71
+ self.prompt
72
+ end
73
+
74
+ message[:message].should == text
75
+ message[:default_value].should == value
76
+ end
77
+ end
@@ -0,0 +1,53 @@
1
+ Feature: Work with select list objects
2
+
3
+ Background:
4
+ Given the web objects page
5
+
6
+ Scenario: Checking the state of select lists
7
+ * the physics expertise select list should exist
8
+ * the physics expertise select list should be visible
9
+ * the physics expertise select list should be enabled
10
+ * the physics expertise select list should be a select list object
11
+ * the sith power select list should not be enabled
12
+
13
+ Scenario Outline: Finding a select list on the page
14
+ When the physics expertise select list is searched for by "<identifier>"
15
+ Then it is possible to select a physics topic of "Loop Quantum Gravity"
16
+ And the value of the selected item for physics expertise should be "Loop Quantum Gravity"
17
+ And the value of the selected option for physics expertise should be "lqg"
18
+
19
+ Scenarios:
20
+ | identifier |
21
+ | id |
22
+ | name |
23
+ | xpath |
24
+ | index |
25
+
26
+ Scenario: Finding if a select list contains a particular value
27
+ * the physics expertise select list should include "Alcubierre Warp Metrics"
28
+
29
+ Scenario: Getting the selected value and option
30
+ When the physics expertise topic "Loop Quantum Gravity" is selected
31
+ Then the selected physics expertise value is "Loop Quantum Gravity"
32
+ And the selected physics expertise option is "lqg"
33
+
34
+ Scenario: Getting a value from the selected option
35
+ When the physics expertise option "lqg" is selected
36
+ Then the selected physics expertise option is "lqg"
37
+
38
+ Scenario: Selecting multiple values from a list
39
+ When the physics expertise values "Tachyonic Antitravel" and "Krasnikov Tubes" are selected
40
+ Then the selected physics expertise values are "Tachyonic Antitravel" and "Krasnikov Tubes"
41
+ When the physics expertise select list is cleared
42
+ Then the physics expertise select list should have no selected values
43
+
44
+ Scenario: Getting all values from a select list
45
+ * the physics expertise select list contains the following
46
+ | Quantum Entanglement |
47
+ | Tachyonic Antitravel |
48
+ | Bose-Einstein Condensates |
49
+ | Alcubierre Warp Metrics |
50
+ | Krasnikov Tubes |
51
+ | Supersymmetric Particle Theory |
52
+ | Loop Quantum Gravity |
53
+ | Noncommutative Geometric Spaces |
@@ -0,0 +1,17 @@
1
+ Given(/^the alert message is "(.*?)"$/) do |text|
2
+ on_view(WebObjects).generate_alert(text)
3
+ end
4
+
5
+ Given(/^the confirm message is "(.*?)"$/) do |text|
6
+ on_view(WebObjects).generate_confirm(text)
7
+ end
8
+
9
+ Given(/^the prompt message is "(.*?)" and the default value is "(.*?)"$/) do |text, value|
10
+ on_view(WebObjects).generate_prompt(text, value)
11
+ end
12
+
13
+ Given(/^the year for stardate "(.*?)" is "(.*?)"$/) do |value, year|
14
+ on_view(Stardate).calculator
15
+ result = on(Stardate).calculate_tng("51887.2")
16
+ result.include? year
17
+ end
@@ -0,0 +1,44 @@
1
+ Given(/^the text "(.*?)" appears on the web objects page$/) do |text|
2
+ on_view(WebObjects).check_for_text(text)
3
+ end
4
+
5
+ Given(/^the markup "(.*?)" appears in the web objects page$/) do |text|
6
+ on_view(WebObjects).check_for_markup(text)
7
+ end
8
+
9
+ Given(/^the title "(.*?)" appears for the web objects page$/) do |text|
10
+ on_view(WebObjects).check_for_title(text)
11
+ end
12
+
13
+ Given(/^the url "(.*?)" matches the web objects page$/) do |text|
14
+ on_view(WebObjects).check_for_url(text)
15
+ end
16
+
17
+ Given(/^the "(.*?)" text field should have focus on initial loading of the web objects page$/) do |element|
18
+ on_view(WebObjects).check_for_focus(element)
19
+ end
20
+
21
+ When(/^setting the focus on the chameleoflage armor field$/) do
22
+ on_view(WebObjects).set_focus_for(:id => "camoArmor")
23
+ end
24
+
25
+ Then(/^the "(.*?)" checkbox should have focus$/) do |element|
26
+ on(WebObjects).check_for_focus(element)
27
+ end
28
+
29
+ Given(/^going back from the web objects to the home page$/) do
30
+ on_view(Home).check_for_title("Home | Symbiote")
31
+ on_view(WebObjects).check_for_title("Web Objects | Symbiote")
32
+ on(WebObjects).back
33
+ on(Home).check_for_title("Home | Symbiote")
34
+ end
35
+
36
+ Given(/^going forward from the home page to the web objects page$/) do
37
+ on(Home).forward
38
+ on(WebObjects).check_for_title("Web Objects | Symbiote")
39
+ end
40
+
41
+ Given(/^refreshing the web objects page$/) do
42
+ on(WebObjects).refresh
43
+ on(WebObjects).check_for_title("Web Objects | Symbiote")
44
+ end
@@ -0,0 +1,14 @@
1
+ #When(/^on the (.*) page$/) do |name|
2
+ #case name
3
+ # when "web objects"
4
+ # @page = WebObjects.new(@browser, true)
5
+ #end
6
+ #end
7
+
8
+ Given(/^the web objects page$/) do
9
+ on_view(WebObjects)
10
+ end
11
+
12
+ Given(/^the comic characters page$/) do
13
+ on_view(Characters)
14
+ end