Make selenium v4 syntax optional using the same pattern as
https://review.opendev.org/c/openstack/openstack-helm-infra/+/892708 Change-Id: Ifbf2e4d6a127ac1e7858c05b73321e4903d60596
This commit is contained in:
parent
a4ee07744e
commit
31edf99329
@ -14,7 +14,7 @@ apiVersion: v1
|
||||
appVersion: v1.0.0
|
||||
description: OpenStack-Helm Horizon
|
||||
name: horizon
|
||||
version: 0.3.12
|
||||
version: 0.3.13
|
||||
home: https://docs.openstack.org/horizon/latest/
|
||||
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Horizon/OpenStack_Project_Horizon_vertical.png
|
||||
sources:
|
||||
|
@ -23,6 +23,9 @@ from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
{{- if .Values.selenium_v4 }}
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
{{- end }}
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
|
||||
@ -58,7 +61,12 @@ options = Options()
|
||||
options.add_argument('--headless')
|
||||
options.add_argument('--no-sandbox')
|
||||
chrome_driver = '/etc/selenium/chromedriver'
|
||||
{{- if .Values.selenium_v4 }}
|
||||
service = Service(executable_path=chrome_driver)
|
||||
browser = webdriver.Chrome(service=service, options=options)
|
||||
{{- else }}
|
||||
browser = webdriver.Chrome(chrome_driver, chrome_options=options)
|
||||
{{- end }}
|
||||
|
||||
try:
|
||||
logger.info('Attempting to connect to Horizon')
|
||||
@ -74,10 +82,17 @@ except TimeoutException:
|
||||
|
||||
try:
|
||||
logger.info('Attempting to log into Horizon')
|
||||
{{- if .Values.selenium_v4 }}
|
||||
browser.find_element(By.NAME, 'domain').send_keys(user_domain_name)
|
||||
browser.find_element(By.NAME, 'username').send_keys(keystone_user)
|
||||
browser.find_element(By.NAME, 'password').send_keys(keystone_password)
|
||||
browser.find_element(By.ID, 'loginBtn').click()
|
||||
{{- else }}
|
||||
browser.find_element_by_name('domain').send_keys(user_domain_name)
|
||||
browser.find_element_by_name('username').send_keys(keystone_user)
|
||||
browser.find_element_by_name('password').send_keys(keystone_password)
|
||||
browser.find_element_by_id('loginBtn').click()
|
||||
{{- end }}
|
||||
WebDriverWait(browser, 15).until(
|
||||
EC.presence_of_element_located((By.ID, 'navbar-collapse'))
|
||||
)
|
||||
|
@ -32,6 +32,9 @@ images:
|
||||
- dep_check
|
||||
- image_repo_sync
|
||||
|
||||
# Use selenium v4 syntax
|
||||
selenium_v4: true
|
||||
|
||||
release_group: null
|
||||
|
||||
labels:
|
||||
|
@ -49,4 +49,5 @@ horizon:
|
||||
- 0.3.10 Add 2023.1 overrides
|
||||
- 0.3.11 Rollout when logo configmap is changed
|
||||
- 0.3.12 Add Ubuntu Jammy overrides
|
||||
- 0.3.13 Make selenium v4 syntax optional
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user