openstack-helm-infra/roles/deploy-selenium/tasks/main.yaml
astebenkova 92d16f3a29 [osh-selenium] Upgrade image to latest-ubuntu_focal
+ migrate all Python tests to use Selenium v4 (bionic image had v3 installed):
https://www.selenium.dev/documentation/webdriver/getting_started/upgrade_to_selenium_4/
+ amend selenium role in order to install ChromeDriver compatible with Google Chrome:
https://chromedriver.chromium.org/downloads/version-selection
+ run selenium tests AFTER the charts are deployed

Change-Id: I46200b7dc173bd0e1e6bf3545d9a26c252a21927
2023-05-23 18:09:16 +03:00

69 lines
2.2 KiB
YAML

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
- name: Create selenium configuration directory
file:
path: /etc/selenium
state: directory
- name: Install selenium dependencies
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
apt:
name: "{{ packages }}"
vars:
packages:
- unzip
- wget
- xvfb
- name: Install selenium
pip:
name: selenium
state: latest
executable: pip3
- name: Add google chrome signing key
get_url:
url: https://dl-ssl.google.com/linux/linux_signing_key.pub
dest: /etc/apt/trusted.gpg.d/google-chrome.asc
- name: Add google chrome repository
apt_repository:
repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/google-chrome.asc] http://dl.google.com/linux/chrome/deb/ stable main"
filename: google-chrome
state: present
- name: Install google chrome
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
apt:
name: google-chrome-stable
update_cache: yes
install_recommends: false
# We need to install ChromeDriver compatible with Google Chrome version
- name: Get selenium chromedriver archive
shell: |-
set -ex
CHROME_VERSION=$(dpkg -s google-chrome-stable | grep -Po '(?<=^Version: ).*' | awk -F'.' '{print $1"."$2"."$3}')
DRIVER_PATH=$(wget -qO- https://chromedriver.storage.googleapis.com | grep -Po "(?<=<Key>)${CHROME_VERSION}[^<]*?chromedriver_linux64\.zip(?=</Key>)" | tail -1)
wget -O /tmp/chromedriver.zip "https://chromedriver.storage.googleapis.com/${DRIVER_PATH}"
args:
executable: /bin/bash
- name: Unarchive selenium chromedriver
unarchive:
src: /tmp/chromedriver.zip
dest: /etc/selenium
remote_src: yes
...