Created
October 29, 2011 23:57
-
-
Save jarmo/1325268 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/app/page/_header.rb | |
module App | |
module Page | |
module Header | |
def sections | |
ul(:id => "sch_scopes").lis | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\my_project\ui-test>watirsplash page main --url http://bing.com | |
create lib | |
create lib/app/page/main.rb | |
exist spec | |
create spec/app/page/main_spec.rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/app/page/main.rb | |
module App | |
module Page | |
class Main < WatirSplash::Page::Base | |
url "http://bing.com" | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/app/page/main.rb | |
module App | |
module Page | |
class Main < WatirSplash::Page::Base | |
url "http://bing.com" | |
def search_field | |
text_field(:name => "q") | |
end | |
def search_button | |
button(:name => "go") | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/app/page/main.rb | |
module App | |
module Page | |
class Main < WatirSplash::Page::Base | |
include Header | |
# ... | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/app/page/main_spec.rb | |
describe App::Page::Main do | |
it "has something on the main page" do | |
main_page = App::Page::Main.new | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/app/page/main_spec.rb | |
describe App::Page::Main do | |
it "has something on the main page" do | |
main_page = App::Page::Main.new | |
main_page.search_field.set "watirsplash jarmo" | |
main_page.search_button.click | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/app/page/main_spec.rb | |
describe App::Page::Main do | |
let(:main_page) {App::Page::Main.new} | |
it "has header with sections" do | |
main_page.sections.should have(5).items | |
end | |
it "allows to search" do | |
main_page.search_field.set "watirsplash jarmo" | |
results_page = main_page.search_button.click | |
results_page.results.count.should == 10 | |
results_page.results[0].text.should =~ /watirsplash/i | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\my_project\ui-test>watirsplash page results results:ul:id:wg0 --no-spec | |
exist lib | |
create lib/app/page/results.rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/app/page/results.rb | |
module App | |
module Page | |
class Results < WatirSplash::Page::Base | |
def results | |
ul(:id => "wg0") | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment