Skip to content

Instantly share code, notes, and snippets.

@pablofmorales
Created March 7, 2013 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pablofmorales/5111309 to your computer and use it in GitHub Desktop.
Save pablofmorales/5111309 to your computer and use it in GitHub Desktop.
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