Created
March 7, 2013 20:04
-
-
Save pablofmorales/5111309 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 'rspec' | |
require 'watir-webdriver' | |
browser = Watir::Browser.new | |
RSpec.configure do |config| | |
config.before(:each) { @browser = browser } | |
config.after(:suite) { browser.close unless browser.nil? } | |
end | |
describe "siteadmin login functionality" do | |
it "should redirect to pendinglistings after valid login" do | |
@browser.goto("http://siteadmin.olx.com/featuredads/app.php/pendinglistings") | |
@browser.text_field(:id, "username").set("admin") | |
@browser.text_field(:id, "password").set("in42ikmn21") | |
@browser.button(:type, "submit").click() | |
@browser.url.should eq("http://siteadmin.olx.com/featuredads/app.php/pendinglistings/") | |
end | |
it "should show bad credentials error with incorrect login" do | |
@browser.goto("http://siteadmin.olx.com/featuredads/app.php/login") | |
@browser.text_field(:id, "username").set("badusername") | |
@browser.text_field(:id, "password").set("badpassword") | |
@browser.button(:type, "submit").click() | |
@browser.text.should include "Error! Bad credentials" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment