Created
January 26, 2010 07:33
-
-
Save pphetra/286639 to your computer and use it in GitHub Desktop.
This file contains 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
require 'rubygems' | |
gem "rspec", "=1.2.8" | |
require 'selenium/client' | |
require 'selenium/rspec/spec_helper' | |
describe "Login Window" do | |
attr_reader :selenium_driver | |
before(:all) do | |
@selenium_driver = Selenium::Client::Driver.new \ | |
:host => 'localhost', | |
:port => 4444, | |
:browser => '*firefox', | |
:url => 'http://localhost:8080/', | |
:timeout_in_second => 60 | |
end | |
before(:all) do | |
@selenium_driver.start | |
@selenium_driver.open '/erp/app' | |
sleep 1 | |
end | |
after(:all) do | |
@selenium_driver.stop | |
end | |
def reset_login_window | |
@selenium_driver.run_script("Ext.getCmp('loginWindow').reset()") | |
end | |
it "it show invalid login when submit with blank login id and password" do | |
reset_login_window | |
@selenium_driver.click "css=button:contains('Submit')" | |
sleep 1 | |
@selenium_driver.get_text('//div[@name="displayfield"]').should eql("invalid login") | |
end | |
it "it must show invalid login when submit with invalid login Id" do | |
reset_login_window | |
@selenium_driver.type '//input[@name="loginId"]', 'xxxxx' | |
@selenium_driver.type '//input[@name="password"]', 'wrong' | |
@selenium_driver.click "css=button:contains('Submit')" | |
sleep 1 | |
@selenium_driver.get_text('//div[@name="displayfield"]').should eql("invalid login") | |
end | |
it "it must show invalid login when submit with invalid password" do | |
reset_login_window | |
@selenium_driver.type '//input[@name="loginId"]', 'admin' | |
@selenium_driver.type '//input[@name="password"]', 'wrong' | |
@selenium_driver.click "css=button:contains('Submit')" | |
sleep 1 | |
@selenium_driver.get_text('//div[@name="displayfield"]').should eql("invalid login") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment