0
votes

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

1
This is my GEMFILE: source 'rubygems.org' gem 'rspec' gem 'mime-types', '2.6.2' gem 'capybara' gem 'selenium-webdriver' and RSpec version is 3.3.2 and Ruby version is 1.9.3p0.mihyrbkalahasti
The error is shown to occur at line 33 which would be the "visit '/'" line of code. If anyone can give me the basic reason for error and possible fixes, I would really appreciate it. I can send chocolates or a restaurant giftcard for fruitful assistance on top of voting. This is my first StackOverflow post.mihyrbkalahasti

1 Answers

0
votes

I'm on ubuntu 14.04 and I had to downgrade firefox from 47 to 28 and I put this in my gem file instead of using the newest version.

gem 'selenium-webdriver', "2.48.0"

This link helped me downgrade: ubuntu how to downgrade-firefox