BIGtheme.net http://bigtheme.net/ecommerce/opencart OpenCart Templates

Web Automation Test with Docker – Part 2

Now that we’ve learned how to use Docker and its container, let’s set up our project to point tests to this container!

How?

Let’s see the code below:

Capybara::Selenium::Driver.new(app,
                     :browser => :chrome,
                     :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(
                               'chromeOptions' => {
                                    'args' => [ "--start-maximized" ]
                               }
                    )
      )

This is my code for creating the new Chrome Driver! But how will my driver know the address of the container? Let’s insert 1 line so that our driver knows this information, then the code will stay! So so so so much

Capybara::Selenium::Driver.new(app,
                         :browser => :chrome,
                         url: "http://localhost:4444/wd/hub",
                         :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(
                                  'chromeOptions' => {
                                      'args' => [ "--start-maximized" ]
                                   }
                       )
      )

Yes, simple so just inserting a url argument and putting your address! Do not forget to start with http!

So when you run your tests will run in the container!

🙂

About Luiz Lohn

Avatar
Luiz Lohn trabalha como QA Engineer em uma multinacional, além de realizar palestras e consultorias em empresas. Atua como um dos coordenadores do GUTS-SC (Grupo de usuário de teste de software), membro ativo na comunidade de qualidade e teste de software, ministra palestras e cursos. Especializando-se em segurança web e mobile.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Page Reader Press Enter to Read Page Content Out Loud Press Enter to Pause or Restart Reading Page Content Out Loud Press Enter to Stop Reading Page Content Out Loud Screen Reader Support