Dopiero zaczynam z selenium jak i testowaniem, więc może to jakiś banalny błąd.
Selenium używam w ostatnim kroku w danym scenariuszu cucumbera, reszta chodzi ok, save_and_open_page w przedostatnim kroku ładnie pokazuje się w przegladarce.
natomiast ten kod
Given /^test selenium$/ do
selenium.open "/"
selenium.click "link=Zarejestruj się"
selenium.wait_for_page_to_load "30000"
("Zarejestruj się").should == selenium.get_text("css=h2")
end
wyrzuca w logu
[code]Feature: Sign up
In order to get access to protected sections of the site
A user
Should be able to sign up
Scenario: User signs up with invalid email # features/users/sign_up.feature:17
Given I am not logged in # features/step_definitions/user_steps.rb:89
When I go to the sign up page # features/step_definitions/web_steps.rb:48
And I fill in “E-mail” with “invalidemail” # features/step_definitions/web_steps.rb:60
And I fill in “Powtórz e-mail” with “invalidemail” # features/step_definitions/web_steps.rb:60
And I press “Wyślij” # features/step_definitions/web_steps.rb:52
Then I should see “Podany adres email jest nieprawidłowy” # features/step_definitions/web_steps.rb:105
And show me the page # features/step_definitions/web_steps.rb:209
==> Waiting for Selenium RC server on port 4444… Ready!
==> Waiting for rack application server on port 3001… Ready!
21:32:51.076 ERROR - Failed to start new browser session, shutdown browser and clear all session data
org.openqa.selenium.server.RemoteCommandException: timed out waiting for window ‘null’ to appear
at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(FrameGroupCommandQueueSet.java:569)
at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(FrameGroupCommandQueueSet.java:526)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:373)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:124)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:86)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:733)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:399)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:370)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:129)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:245)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Tue Jun 14 21:32:41 +0200 2011 selenium-client received failure from selenium server:
requested:
cmd=getNewBrowserSession
1=*firefox
2=http://localhost:3001
3=
4=
received:
“Failed to start new browser session: Error while launching browser”
called from /home/artur/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/timeout.rb:67:in timeout' And test selenium # features/step_definitions/shared_steps.rb:7 Failed to start new browser session: Error while launching browser (Selenium::CommandError) /home/artur/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/timeout.rb:67:in
timeout’
/home/artur/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/timeout.rb:101:in timeout' ./features/step_definitions/shared_steps.rb:8:in
/^test selenium$/’
features/users/sign_up.feature:25:in `And test selenium’
Failing Scenarios:
cucumber features/users/sign_up.feature:17 # Scenario: User signs up with invalid email
1 scenario (1 failed)
8 steps (1 failed, 7 passed)
0m39.714s[/code]
Może też przy okazji robię coś nie tak, chodzi mi o przetestowanie czy otwiera się fancybox z logowaniem po kliknięciu w link, fancybox działa w ten sposób że do linku jest zbindowana funkcja js która popup