page-object 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,13 @@ describe PageObject::Elements::Element do
9
9
  let(:selenium_element) { PageObject::Elements::Element.new(selenium_driver, :platform => :selenium) }
10
10
  let(:element) { PageObject::Elements::Element }
11
11
 
12
+ context "when handling unknown requests" do
13
+ it "should delegate to the driver element" do
14
+ watir_driver.should_receive(:do_this)
15
+ watir_element.do_this
16
+ end
17
+ end
18
+
12
19
  context "when building the identifiers for Watir" do
13
20
  it "should build xpath when finding elements by name where not supported" do
14
21
  ['table', 'span', 'div', 'td', 'li', 'ol', 'ul'].each do |tag|
@@ -6,11 +6,13 @@ end
6
6
 
7
7
  class CustomPlatform
8
8
  end
9
+
9
10
  describe PageObject do
10
11
  let(:watir_browser) { mock_watir_browser }
11
12
  let(:selenium_browser) { mock_selenium_browser }
12
13
  let(:watir_page_object) { PageObjectTestPageObject.new(watir_browser) }
13
14
  let(:selenium_page_object) { PageObjectTestPageObject.new(selenium_browser) }
15
+
14
16
  context "when created with a watir-webdriver browser" do
15
17
  it "should include the WatirPageObject module" do
16
18
  watir_page_object.platform.should be_kind_of PageObject::WatirPageObject
@@ -22,6 +24,7 @@ describe PageObject do
22
24
  selenium_page_object.platform.should be_kind_of Object::PageObject::Platforms::Selenium::PageObject
23
25
  end
24
26
  end
27
+
25
28
  context "when created with a non_bundled adapter" do
26
29
  let(:custom_adapter) { mock_adapter(:custom_browser, CustomPlatform) }
27
30
  it "should be an instance of whatever that objects adapter is" do
@@ -30,6 +33,7 @@ describe PageObject do
30
33
  custom_page_object.platform.should be custom_adapter.create_page_object
31
34
  end
32
35
  end
36
+
33
37
  context "when created with an object we do not understand" do
34
38
  it "should throw an error" do
35
39
  expect {
@@ -39,6 +43,28 @@ describe PageObject do
39
43
  end
40
44
 
41
45
  describe "page level functionality" do
46
+ context "for all drivers" do
47
+ it "should try a second time after sleeping when attach to window fails" do
48
+ watir_page_object.platform.should_receive(:attach_to_window).once.and_throw "error"
49
+ watir_page_object.platform.should_receive(:attach_to_window)
50
+ watir_page_object.attach_to_window("blah")
51
+ end
52
+
53
+ it "should call initialize_page if it exists" do
54
+ class CallbackPage
55
+ include PageObject
56
+ attr_reader :initialize_page
57
+
58
+ def initialize_page
59
+ @initialize_page = true
60
+ end
61
+ end
62
+
63
+ @page = CallbackPage.new(watir_browser)
64
+ @page.initialize_page.should be_true
65
+ end
66
+ end
67
+
42
68
  context "when using WatirPageObject" do
43
69
  it "should display the page text" do
44
70
  watir_browser.should_receive(:text).and_return("browser text")
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: page-object
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.2
5
+ version: 0.2.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeff Morgan
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-08-01 00:00:00 Z
13
+ date: 2011-08-02 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: watir-webdriver
@@ -31,7 +31,7 @@ dependencies:
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 2.2.0
34
+ version: 2.3.2
35
35
  type: :runtime
36
36
  version_requirements: *id002
37
37
  - !ruby/object:Gem::Dependency