简体   繁体   English

使用CircleCI进行Ruby硒测试

[英]Ruby selenium test with CircleCI

I am facing a problem running selenium tests with CircleCI service. 我在使用CircleCI服务运行硒测试时遇到问题。 If I try to test my ruby application's login functionality: 如果我尝试测试ruby应用程序的登录功能:

driver = Selenium::WebDriver.for :firefox
driver.navigate.to "http://0.0.0.0:3000"

driver.find_element(:name, 'user[email]').send_keys('eser@email.com')
driver.find_element(:name, 'user[password]').send_keys('password')
driver.find_element(:name, 'commit').click

On local machine it works perfectly, but with CircleCI test fails. 在本地计算机上,它工作正常,但使用CircleCI测试失败。 To be more specific, looks like on CircleCI my tests cannot access localhost (tried curl localhost:3000 in CircleCI test box - nothing found). 更具体地说,看起来像在CircleCI上我的测试无法访问localhost(在CircleCI测试框中尝试了curl localhost:3000-未找到任何内容)。 I also tried changing 0.0.0.0 to localhost as well as to 127.0.0.1 - still same result. 我还尝试将0.0.0.0更改为localhost以及127.0.0.1-仍然是相同的结果。 If I try very similar test for testing google's search (driver.navigate.to " http://www.google.com ", etc.) it works with no problem. 如果我尝试使用非常相似的测试来测试Google的搜索(driver.navigate.to“ http://www.google.com ”等),则可以正常工作。 Tried to contact CircleCI - no response so far. 试图与CircleCI联系-迄今无人回应。 Any ideas how to get my test pass, or at least how to get my application address when it is on CircleCI server? 关于如何获得我的测试通过的任何想法,或者至少当它在CircleCI服务器上时如何获得我的应用程序地址?

In order to run tests, you need to have a selenium grid up and running. 为了运行测试,您需要建立并运行一个硒网格。 It works locally, because your box can run selenium tests.. CircleCI cannot run tests, it's just a CI. 它可以在本地运行,因为您的设备可以运行硒测试。CircleCI无法运行测试,它只是一个CI。

What you need to do, is in your project, have your selenium tests point at a grid. 您需要做的是在您的项目中,将硒测试指向一个网格。

http://somegrid:4444/wd/register

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM