spec/druid/elements/element_spec.rb in druid-ts-1.2.2 vs spec/druid/elements/element_spec.rb in druid-ts-1.2.3

- old
+ new

@@ -9,20 +9,10 @@ expect(we).to receive(:do_this) element.do_this end end - context "when building the identifiers" do - it "should build xpath when finding elements by name were not supported" do - ['table', 'span', 'div', 'td', 'li', 'ol', 'ul'].each do |tag| - how = {:tag_name => tag, :name => 'blah'} - result = Druid::Elements::Element.identifier_for how - expect(result[:xpath]).to eql ".//#{tag}[@name='blah']" - end - end - end - context "on a druid" do it "should know when it is visible" do expect(we).to receive(:visible?).and_return(true) expect(element.visible?).to be true end @@ -91,26 +81,29 @@ expect(we).to receive(:wait_until).with(timeout: 20, message: "Element not present in 20 seconds") element.when_present end it "should be able to block until it is visible" do + allow(we).to receive(:wait_until).with(timeout: 10, message: "Element not present in 10 seconds") expect(we).to receive(:wait_until).with(timeout: 10, message: "Element not visible in 10 seconds") element.when_visible(10) end it "should return the element when it is visible" do + allow(we).to receive(:wait_until).with(timeout: 10, message: "Element not present in 10 seconds") expect(we).to receive(:wait_until).with(timeout: 10, message: "Element not visible in 10 seconds") expect(element.when_visible(10)).to eq element end it "should be able to block until it is not visible" do + allow(we).to receive(:wait_until).with(timeout: 10, message: "Element not present in 10 seconds") expect(we).to receive(:wait_while).with(timeout: 10, message: "Element still visible after 10 seconds") element.when_not_visible(10) end it "should be able to block until a user define event fires true" do - expect(Watir::Wait).to receive(:until).with(timeout: 10, message: "Element blah") + expect(we).to receive(:wait_until).with(timeout: 10, message: "Element blah") element.wait_until(10, "Element blah") {true} end it "should send keys to the element" do expect(we).to receive(:send_keys).with([:control, 'a']) @@ -135,22 +128,17 @@ it "should get element's style" do expect(we).to receive(:style).with('class').and_return('tim') expect(element.style('class')).to eql "tim" end - it "should inspect element" do - expect(we).to receive(:inspect) - element.inspect - end - it "should know if an element is focused" do expect(we).to receive(:focused?).and_return(true) - expect(element).to be_focused + expect(element.focused?).to be true end it "should know if an element is not focuesd" do expect(we).to receive(:focused?).and_return(false) - expect(element).to_not be_focused + expect(element.focused?).to_not be true end it "should be able to fire event" do expect(we).to receive(:fire_event).with('onclick') element.fire_event('onclick')