# Selenium server
# https://seleniumhq.github.io/docs/grid.html

[buildout]
extends =
   ../../component/xorg/buildout.cfg
   ../../component/lxml-python/buildout.cfg
   ../../component/firefox/buildout.cfg
   ../../component/chromium/buildout.cfg
   ../../component/chromedriver/buildout.cfg
   ../../component/coreutils/buildout.cfg
   ../../component/java/buildout.cfg
   ../../component/openssh/buildout.cfg
   ../../component/fonts/buildout.cfg
   ../../component/fontconfig/buildout.cfg
   ../../stack/slapos.cfg
   ../../stack/haproxy/default-backend.cfg
   ./buildout.hash.cfg
   ../../stack/monitor/buildout.cfg

parts =
  slapos-cookbook
  collective.recipe.shelloutput
  template

[collective.recipe.shelloutput]
recipe = zc.recipe.egg

[selenium-server]
recipe = slapos.recipe.build:download
version = 3.14.0
md5sum = 376450bd517510442b60018646deadfe
filename = selenium-server-standalone-${:version}.jar
url = https://selenium-release.storage.googleapis.com/3.14/${:filename}

[macro-template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}

[template]
<= macro-template
output = ${buildout:directory}/template.cfg

[template-selenium]
<= macro-template
output = ${buildout:directory}/template-selenium.cfg


# XXX firefox 62 and firefox 68 does not seem to honor <dir> from
# fonts.conf and only loads from system locations and from the fonts
# folder located in firefox part, so we copy (actually, symlink) some
# fonts there, otherwise firefox cannot find its standard fonts.
[symlink-extra-fonts-to-firefox-fonts-dir]
extra-fonts =
  ${android-fonts:location}
  ${dejavu-fonts:location}
  ${ipa-fonts:location}
  ${ipaex-fonts:location}
  ${liberation-fonts:location}
  ${ocrb-fonts:location}
install =
  import os
  for extra_font_dir in '''${:extra-fonts}'''.splitlines():
    dst = os.path.join(location, 'fonts', os.path.basename(extra_font_dir))
    os.symlink(extra_font_dir, dst)

[firefox-102]
post-install =
  ${symlink-extra-fonts-to-firefox-fonts-dir:install}

[firefox-115]
post-install =
  ${symlink-extra-fonts-to-firefox-fonts-dir:install}
