0

1. 总结问题


使用 testingbot,测试完成后,dashboard 无法获取视频。

在zalenium容器的以下路径中,视频不存在。

/home/seluser/videos

另一方面,我使用本地的 elgalu/selenium,我可以毫无问题地在仪表板上获取视频。

我可以使用 zalenium + testingbot 获取视频吗?

2.我已经试过了


zalenium 似乎在测试结束时从以下代码显示的 URL 获取视频。

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>

在 zalenium 容器中,我确认我可以使用我的密钥和秘密访问此 API。

3.部分代码和组件版本


  • 码头工人:18.06.1-ce
  • 码头工人撰写:1.17.1
  • dozel/zalenium id:150b95a0aa6b 创建时间:2019-06-17T06:23:59.635702925Z
  • elgalu/selenium id:4afe4ce965ee 创建时间:2019-06-05T06:01:05.71727027Z
  • 操作系统:ubuntu 18.04.2
  • 码头工人-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 脚本 (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
  • 通用/功能.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
4

1 回答 1

0

谢谢您的帮助。

我明白原因。

创建 selenium 驱动程序时指定的 URL 直接指定了测试机器人,而不指定 zalenium hub。

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

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

问题很简单。

于 2019-06-20T15:22:20.673 回答