Skip to content

Commit

Permalink
Added in flicks rather then scrolls (Which aren't working)
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanLacey committed Feb 5, 2013
1 parent 681f4a4 commit 1b9623a
Showing 1 changed file with 38 additions and 12 deletions.
50 changes: 38 additions & 12 deletions sample-code/examples/ruby/u_i_catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
require 'selenium-webdriver'
require 'net/http'

include Selenium::WebDriver::DriverExtensions::HasInputDevices
include Selenium::WebDriver::DriverExtensions::HasTouchScreen


APP_PATH = '../../apps/UICatalog/build/Release-iphonesimulator/UICatalog.app'

def capabilities
Expand Down Expand Up @@ -38,6 +40,10 @@ def go_back

end

after(:all) do
@driver.quit
end

describe "An Element" do

subject { @driver.find_elements(:tag_name, "tableView")[0]}
Expand Down Expand Up @@ -104,7 +110,7 @@ def go_back

# TODO: Text checking still seems... Not good.
it "can have text checked" do
@switch.text.should eq "Tinted"
@switch.attribute("name").should eq "Image"
end

it "can have values checked" do
Expand Down Expand Up @@ -168,37 +174,36 @@ def go_back

describe "scrolling" do

after :all do
go_back
end

# Not yet implemented
it "can be done with co-ordinates" do
row = @driver.find_elements(:tag_name, "tableCell")[2]
initial_location = row.location
action = @driver.touch.scroll(0, -20)
action = @driver.touch.flick(0, 20)

action.perform
initial_location.should_not eq row.location
end
end

describe "sliders" do

before :all do
@driver.find_elements(:tag_name, "tableCell")[1].click
@slider = @driver.find_element(:tag_name, "slider")
end

after :all do
go_back
end

it "can have their values read" do
slider = @driver.find_element(:tag_name, "slider")
slider.attribute("value").should eq "50%"
@slider.attribute("value").should eq "50%"
end

it "can be changed" do
actions = @slider.touch.flick(@slider, -1.0, 0, :normal)
actions.perform
@slider.attribute("value").should eq "0%"
end

it "can be changed"
end

describe "sessions" do
Expand All @@ -212,7 +217,7 @@ def go_back
end
end

describe "test_size" do
describe "sizes" do
it "can be obtained from elements" do
table_dimensions = @driver.find_element(:tag_name, "tableView").size
row_dimensions = @driver.find_elements(:tag_name, "tableCell")[0].size
Expand All @@ -221,4 +226,25 @@ def go_back
table_dimensions["height"].should_not eq row_dimensions["height"]
end
end

describe "page source" do
before :all do
@main_source = @driver.page_source
@driver.find_elements(:tag_name, "tableCell")[2].click
@text_source = @driver.page_source
end

after :all do
go_back
end

it "can be obtained" do
@main_source.should include "UIATableView"
@main_source.should include "TextFields"
end

it "changes when the page does" do
@text_source.should_not eq @main_source
end
end
end

0 comments on commit 1b9623a

Please sign in to comment.