0

1. Summarize the problem


Using testingbot, when testing is completed, video can not be acquired at dashboard.

In the following path of zalenium container, video did not exist.

/home/seluser/videos

On the other hand, I use the local elgalu/selenium, I can get the video at dashboard without any problems.

Can I get video with zalenium + testingbot?

2. I've already tried


The zalenium seems to get video from the URL shown by the following code at the end of the test.

https://github.com/zalando/zalenium/blob/4d27dde9cf04e95fa49f4bc7e5d0b781af7761de/src/main/java/de/zalando/ep/zalenium/proxy/TestingBotRemoteProxy.java#L103

https://api.testingbot.com/v1/tests/<session_id>

In zalenium container, I confirmed that I can access this API with my key and secret.

3. some codes and component version


  • docker: 18.06.1-ce
  • docker-compose: 1.17.1
  • dozel/zalenium id: 150b95a0aa6b created: 2019-06-17T06:23:59.635702925Z
  • elgalu/selenium id: 4afe4ce965ee created: 2019-06-05T06:01:05.71727027Z
  • OS: ubuntu 18.04.2
  • docker-compose.yml
version: '2'
services:
  selenium-hub:
    container_name: selenium-hub
    env_file:
      - ./env/env.secret
    environment:
      TESTINGBOT_KEY: <my_key>
      TESTINGBOT_SECRET: <my_secret>
      TESTINGBOT_URL: http://hub.testingbot.com:80
    image: dosel/zalenium:latest
    ports:
      - 4444:4444
    volumes:
      - /dev/shm:/dev/shm
      - /var/run/docker.sock:/var/run/docker.sock
      - /tmp/videos:/home/seluser/videos
    privileged: true
    stdin_open: true
    tty: true
    command: >
      start
        --timeZone "Asia/Tokyo"
        --testingBotEnabled true
  • mytest script about driver (base.rb)
require 'selenium-webdriver'
require 'test/unit'
require 'common/capabilities'
module TestSets
  class Base < Test::Unit::TestCase
    attr_accessor(:driver, :target_host)
    self.test_order = :defined

    def setup
      set_driver
      @target_host = <target url>
      @accept_next_alert = true
      @verification_errors = []
      set_window_size

      # set timezone
      ENV['TZ'] = "Asia/Tokyo"
    end

    def teardown
      @driver.quit
      assert_equal [], @verification_errors
    end

    def set_window_size
      @driver.manage.window.resize_to(1600, 1024)
    end

    def set_driver
      set_driver_remote(Capabilities.win10_ie11)
    end

    private

    def set_driver_remote(caps)
      @driver = Selenium::WebDriver.for(
        :remote,
        url: remote_url,
        desired_capabilities: caps,
        http_client: http_client,
      )
    end

    def http_client
      client = Selenium::WebDriver::Remote::Http::Default.new
      client.read_timeout = 90
      client
    end

    def remote_url
      testingbot_url
    end

    def testingbot_url
      %(https://#{Settings.testingbot.key}:#{Settings.testingbot.secret}@hub.testingbot.com/wd/hub)
    end
  end
end
  • common/capabilities.rb
module Capabilities
  def self.win10_ie11
    caps = Selenium::WebDriver::Remote::Capabilities.new
    caps["name"] = "win10_ie11"
    caps["browserName"] = "Internet Explorer"
    caps["version"] = "11"
    caps["platform"] = "Windows 10"
    caps["record_video"] = "true"
    caps["timeZone"] = "Tokyo"  # for TestingBot
    caps
  end
end

1 Answers1

0

Thank you for your help.

I understand the cause.

The URL specified when creating the selenium driver directly specified the test bot without specifying the zalenium hub.

Right: http://selenium-hub:4444/wd/hub

Wrong: https://#{Settings.testingbot.key}:#{Settings.testingbot.secret}@hub.testingbot.com/wd/hub

The problem was simple.