Class: Gitlab::QA::Component::Selenoid

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/qa/component/selenoid.rb

Overview

Component for the Selenoid Grid aerokube.com/selenoid/latest/

Constant Summary collapse

DOCKER_IMAGE =
'aerokube/selenoid'
DOCKER_IMAGE_TAG =
'latest-release'

Constants inherited from Base

Base::CERTIFICATES_PATH

Instance Attribute Summary

Attributes inherited from Base

#additional_hosts, #airgapped_network, #docker, #environment, #logger, #network, #network_aliases, #ports, #runner_network, #secrets, #volumes

Instance Method Summary collapse

Methods inherited from Base

#add_network_alias, #hostname, #image, #initialize, #ip_address, #prepare, #prepare_airgapped_network, #prepare_docker_container, #prepare_docker_image, #prepare_network, #prepare_runner_network, #process_exec_commands, #pull, #restart, #start_instance, #tag, #teardown, #teardown!

Methods included from Scenario::Actable

#act, included

Constructor Details

This class inherits a constructor from Gitlab::QA::Component::Base

Instance Method Details

#instanceObject



18
19
20
21
22
23
24
25
26
# File 'lib/gitlab/qa/component/selenoid.rb', line 18

def instance
  Runtime::Env.webdriver_headless = '0'
  Runtime::Env.chrome_disable_dev_shm = 'true'
  Runtime::Env.remote_grid = "#{hostname}:4444"
  Runtime::Env.remote_grid_protocol = 'http'
  raise 'Please provide a block!' unless block_given?

  super
end

#nameObject



14
15
16
# File 'lib/gitlab/qa/component/selenoid.rb', line 14

def name
  @name ||= 'selenoid'
end

#startObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/gitlab/qa/component/selenoid.rb', line 28

def start
  pull_images
  docker.run(image: image, tag: tag, args:
              ['-video-recorder-image',
                QA::Runtime::Env.video_recorder_image,
                '-container-network',
                network,
                '-timeout',
                '10m0s']
  ) do |command|
    set_command_args(command)
    set_volumes(command)
  end
end

#wait_until_ready(max_attempts: 20, wait: 2) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/gitlab/qa/component/selenoid.rb', line 43

def wait_until_ready(max_attempts: 20, wait: 2)
  Runtime::Logger.info("Waiting for Selenoid ...")

  max_attempts.times do
    return Runtime::Logger.info("Selenoid ready!") if grid_healthy?

    sleep wait
  end

  raise "Retried #{max_attempts} times. Selenoid is not responding. Aborting."
end