Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.