I am new to Web development and testing. I would appreciate any replies to my testing problem described below.
The task is to open a webpage using Firefox browser on Ubuntu 12.04 client OS and to test particular input/response output elements. The test script code uses Capybara gem and RSpec gem.
What I see: With bundle exec rspec page_test.rb
, I see a Gateway Timeout 504 error.
Code: This is the code written up for the purpose. Remote URL can be opened from host using Firefox browser. Host has http_proxy server settings set on bash shell env.
Error:
the signin process signs me in
Failure/Error: visit ‘/’
Selenium: WebDriver::Error::WebDriverError: unexpected response, code=504, content-type=”text/html”
Notification: GATEWAY TIMEOUT
Code:
require 'rspec'
require 'capybara'
require 'capybara/dsl'
require 'capybara/rspec'
require 'selenium-webdriver'
Capybara.run_server = false
Capybara.current_driver = :selenium
Capybara.register_driver :selenium do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
profile["network.proxy.type"] = 1
profile["network.proxy.http"] = "http://proxy.esl.corpserver.com"
profile["network.proxy.http_port"] = 8888
Capybara::Selenium::Driver.new(app, :profile => profile)
end
Capybara.app_host = 'http://192.168.205.69'
session = Capybara::Session.new(:selenium)
describe "the signin process", :type => :feature, :js => true do
it "signs me in" do
include Capybara::DSL
visit '/'
within("//form[@id='session']") do
fill_in 'User Name', :with => 'admin'
fill_in 'Password', :with => 'password'
end
click_button 'Sign in'
fill_in 'input', :with => 'show server status'
check 'json'
check 'cli_show'
click_button 'post'
expect(find('#response_output')).to have_content('cli_show')
end
end
Please point out error or suggest alternative ways of reaching remote URL server and testing out elements.
Thanks a lot! Mihyr