Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos
Commits
f1c06315
Commit
f1c06315
authored
Dec 02, 2024
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Plain Diff
Seleniumserver: set slot quantity as an instance parameter
See merge request
!1336
parents
553d2429
28f115bc
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
96 additions
and
18 deletions
+96
-18
component/chromium/buildout.cfg
component/chromium/buildout.cfg
+2
-0
software/seleniumserver/buildout.hash.cfg
software/seleniumserver/buildout.hash.cfg
+2
-2
software/seleniumserver/instance-input-schema.json
software/seleniumserver/instance-input-schema.json
+20
-0
software/seleniumserver/instance-output-schema.json
software/seleniumserver/instance-output-schema.json
+31
-0
software/seleniumserver/instance-selenium.cfg.in
software/seleniumserver/instance-selenium.cfg.in
+8
-7
software/seleniumserver/instance.cfg.in
software/seleniumserver/instance.cfg.in
+6
-0
software/seleniumserver/software.cfg.json
software/seleniumserver/software.cfg.json
+15
-0
software/seleniumserver/test/test.py
software/seleniumserver/test/test.py
+12
-9
No files found.
component/chromium/buildout.cfg
View file @
f1c06315
...
@@ -56,6 +56,8 @@ install =
...
@@ -56,6 +56,8 @@ install =
# FATAL:platform_font_linux.cc(83)] Check failed: InitDefaultFont(). Could not find the default font
# FATAL:platform_font_linux.cc(83)] Check failed: InitDefaultFont(). Could not find the default font
export LD_LIBRARY_PATH=$d:%s
export LD_LIBRARY_PATH=$d:%s
export PATH=%s:$PATH
export PATH=%s:$PATH
# --disable-setuid-sandbox --no-sandbox --disable-gpu arguments are only required for chromium-wrapper-91
# they should be removed once we drop supporting this version
exec $d/chrome --disable-setuid-sandbox --no-sandbox --disable-gpu "$@"
exec $d/chrome --disable-setuid-sandbox --no-sandbox --disable-gpu "$@"
""" % (
""" % (
part['location'],
part['location'],
...
...
software/seleniumserver/buildout.hash.cfg
View file @
f1c06315
...
@@ -15,8 +15,8 @@
...
@@ -15,8 +15,8 @@
[template]
[template]
filename = instance.cfg.in
filename = instance.cfg.in
md5sum =
b443da6792bdde1218076a3a1ce50b11
md5sum =
58f6d112c90a23ae39f07a96fa5c8f1c
[template-selenium]
[template-selenium]
filename = instance-selenium.cfg.in
filename = instance-selenium.cfg.in
md5sum = 9bef75759623a660cfaf4b6f5a48a923
md5sum = 7d8bdc03f8feadc83d70f71df2ebb42d
\ No newline at end of file
software/seleniumserver/instance-input-schema.json
0 → 100644
View file @
f1c06315
{
"$schema"
:
"https://json-schema.org/draft/2020-12/schema"
,
"type"
:
"object"
,
"description"
:
"Parameters to request selenium instance"
,
"additionalProperties"
:
false
,
"properties"
:
{
"ssh-authorized-key"
:
{
"title"
:
"SSH Key"
,
"description"
:
"ssh public key"
,
"type"
:
"string"
,
"default"
:
""
},
"slotQuantity"
:
{
"title"
:
"Slot quantity"
,
"description"
:
"Number of slot per selenium node"
,
"type"
:
"integer"
,
"default"
:
3
}
}
}
software/seleniumserver/instance-output-schema.json
0 → 100644
View file @
f1c06315
{
"$schema"
:
"https://json-schema.org/draft/2020-12/schema"
,
"type"
:
"object"
,
"description"
:
"Values returned by Selenium instanciation"
,
"properties"
:
{
"backend-url"
:
{
"description"
:
"Selenium hub URL"
,
"type"
:
"string"
},
"url"
:
{
"description"
:
"Selenium instance URL"
,
"type"
:
"string"
},
"admin-url"
:
{
"description"
:
"Selenium admin URL"
,
"type"
:
"string"
},
"ssh-url"
:
{
"description"
:
"Selenium ssh URL"
,
"type"
:
"string"
},
"ssh-fingerprint"
:
{
"description"
:
"Selenium ssh key fingerprint"
,
"type"
:
"string"
},
"run-node-command"
:
{
"description"
:
"Command to run a local Selenium node"
,
"type"
:
"string"
}
}
}
software/seleniumserver/instance-selenium.cfg.in
View file @
f1c06315
{% set parameter_dict = dict(default_parameter_dict, **parameter_dict) -%}
[buildout]
[buildout]
parts =
parts =
monitor-base
monitor-base
...
@@ -54,7 +55,6 @@ command-line =
...
@@ -54,7 +55,6 @@ command-line =
-host $${:hostname}
-host $${:hostname}
-port $${:port}
-port $${:port}
-role hub
-role hub
-maxSession 20
-newSessionWaitTimeout 600000
-newSessionWaitTimeout 600000
--debug
--debug
...
@@ -82,6 +82,7 @@ command-line =
...
@@ -82,6 +82,7 @@ command-line =
-host $${:hostname}
-host $${:hostname}
-port $${:port}
-port $${:port}
-role node
-role node
-maxSession {{ parameter_dict['slotQuantity'] }}
-timeout 300
-timeout 300
-hub $${selenium-server-hub-instance:register-url}
-hub $${selenium-server-hub-instance:register-url}
-capabilities $${:capabilities}
-capabilities $${:capabilities}
...
@@ -99,25 +100,25 @@ hostname = $${slap-configuration:ipv4-random}
...
@@ -99,25 +100,25 @@ hostname = $${slap-configuration:ipv4-random}
[selenium-server-node-instance-firefox-102]
[selenium-server-node-instance-firefox-102]
<= selenium-server-node-instance
<= selenium-server-node-instance
capabilities = browserName=firefox,maxInstances=
3
,marionette=true,platform=LINUX,version=${firefox-102:version},firefox_binary=${firefox-wrapper-102:location}
capabilities = browserName=firefox,maxInstances=
{{ parameter_dict['slotQuantity'] }}
,marionette=true,platform=LINUX,version=${firefox-102:version},firefox_binary=${firefox-wrapper-102:location}
java-args = -Dwebdriver.gecko.driver=${geckodriver-0.33.0:location}
java-args = -Dwebdriver.gecko.driver=${geckodriver-0.33.0:location}
port = 7779
port = 7779
[selenium-server-node-instance-firefox-115]
[selenium-server-node-instance-firefox-115]
<= selenium-server-node-instance
<= selenium-server-node-instance
capabilities = browserName=firefox,maxInstances=
3
,marionette=true,platform=LINUX,version=${firefox-115:version},firefox_binary=${firefox-wrapper-115:location}
capabilities = browserName=firefox,maxInstances=
{{ parameter_dict['slotQuantity'] }}
,marionette=true,platform=LINUX,version=${firefox-115:version},firefox_binary=${firefox-wrapper-115:location}
java-args = -Dwebdriver.gecko.driver=${geckodriver-0.33.0:location}
java-args = -Dwebdriver.gecko.driver=${geckodriver-0.33.0:location}
port = 7780
port = 7780
[selenium-server-node-instance-chromium-91]
[selenium-server-node-instance-chromium-91]
<= selenium-server-node-instance
<= selenium-server-node-instance
capabilities = browserName=chrome,maxInstances=
3
,platform=LINUX,version=${chromium-91:version},chrome_binary=${chromium-wrapper-91:location}
capabilities = browserName=chrome,maxInstances=
{{ parameter_dict['slotQuantity'] }}
,platform=LINUX,version=${chromium-91:version},chrome_binary=${chromium-wrapper-91:location}
java-args = -Dwebdriver.chrome.driver=${chromedriver-wrapper-91:location}
java-args = -Dwebdriver.chrome.driver=${chromedriver-wrapper-91:location}
port = 7781
port = 7781
[selenium-server-node-instance-chromium-120]
[selenium-server-node-instance-chromium-120]
<= selenium-server-node-instance
<= selenium-server-node-instance
capabilities = browserName=chrome,maxInstances=
3
,platform=LINUX,version=${chromium-120:version},chrome_binary=${chromium-wrapper-120:location}
capabilities = browserName=chrome,maxInstances=
{{ parameter_dict['slotQuantity'] }}
,platform=LINUX,version=${chromium-120:version},chrome_binary=${chromium-wrapper-120:location}
java-args = -Dwebdriver.chrome.driver=${chromedriver-wrapper-120:location}
java-args = -Dwebdriver.chrome.driver=${chromedriver-wrapper-120:location}
port = 7782
port = 7782
...
@@ -321,8 +322,8 @@ promise = check_command_execute
...
@@ -321,8 +322,8 @@ promise = check_command_execute
name = $${:_buildout_section_name_}.py
name = $${:_buildout_section_name_}.py
config-command =
config-command =
$${selenium-server-check-nodes-registered:output} $${selenium-server-hub-instance:api-url} $${:expected-node-count}
$${selenium-server-check-nodes-registered:output} $${selenium-server-hub-instance:api-url} $${:expected-node-count}
# We have 4 nodes with
3
slots each
# We have 4 nodes with
slotQuantity
slots each
expected-node-count =
12
expected-node-count =
{{ 4 * int(parameter_dict['slotQuantity']) }}
[selenium-server-check-nodes-registered]
[selenium-server-check-nodes-registered]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
...
...
software/seleniumserver/instance.cfg.in
View file @
f1c06315
...
@@ -12,7 +12,13 @@ url = ${template-selenium:output}
...
@@ -12,7 +12,13 @@ url = ${template-selenium:output}
output = $${buildout:parts-directory}/$${:_buildout_section_name_}/$${:filename}
output = $${buildout:parts-directory}/$${:_buildout_section_name_}/$${:filename}
filename = instance-selenium.cfg
filename = instance-selenium.cfg
context =
context =
jsonkey default_parameter_dict :default-parameters
key parameter_dict slap-configuration:configuration
key partition_ipv6 slap-configuration:ipv6-random
key partition_ipv6 slap-configuration:ipv6-random
default-parameters =
{
"slotQuantity": 3
}
[switch-softwaretype]
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
recipe = slapos.cookbook:switch-softwaretype
...
...
software/seleniumserver/software.cfg.json
0 → 100644
View file @
f1c06315
{
"name"
:
"Selenium Server"
,
"description"
:
"Selenium server running chromium and firefox nodes"
,
"serialisation"
:
"xml"
,
"software-type"
:
{
"default"
:
{
"title"
:
"Default"
,
"software-type"
:
"default"
,
"description"
:
"Request a selenium server"
,
"request"
:
"instance-input-schema.json"
,
"response"
:
"instance-output-schema.json"
,
"index"
:
0
}
}
}
software/seleniumserver/test/test.py
View file @
f1c06315
...
@@ -45,7 +45,6 @@ import requests
...
@@ -45,7 +45,6 @@ import requests
from
PIL
import
Image
from
PIL
import
Image
from
selenium
import
webdriver
from
selenium
import
webdriver
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.common.desired_capabilities
import
DesiredCapabilities
from
selenium.webdriver.remote.remote_connection
import
RemoteConnection
from
selenium.webdriver.remote.remote_connection
import
RemoteConnection
from
selenium.webdriver.support
import
expected_conditions
as
EC
from
selenium.webdriver.support
import
expected_conditions
as
EC
from
selenium.webdriver.support.ui
import
WebDriverWait
from
selenium.webdriver.support.ui
import
WebDriverWait
...
@@ -252,7 +251,7 @@ class TestBrowserSelection(WebServerMixin, SeleniumServerTestCase):
...
@@ -252,7 +251,7 @@ class TestBrowserSelection(WebServerMixin, SeleniumServerTestCase):
driver
=
webdriver
.
Remote
(
driver
=
webdriver
.
Remote
(
command_executor
=
webdriver_url
,
command_executor
=
webdriver_url
,
desired_capabilities
=
DesiredCapabilities
.
CHROME
)
desired_capabilities
=
webdriver
.
ChromeOptions
().
to_capabilities
()
)
driver
.
get
(
self
.
server_url
)
driver
.
get
(
self
.
server_url
)
self
.
assertEqual
(
'Test page'
,
driver
.
title
)
self
.
assertEqual
(
'Test page'
,
driver
.
title
)
...
@@ -268,7 +267,7 @@ class TestBrowserSelection(WebServerMixin, SeleniumServerTestCase):
...
@@ -268,7 +267,7 @@ class TestBrowserSelection(WebServerMixin, SeleniumServerTestCase):
driver
=
webdriver
.
Remote
(
driver
=
webdriver
.
Remote
(
command_executor
=
webdriver_url
,
command_executor
=
webdriver_url
,
desired_capabilities
=
DesiredCapabilities
.
FIREFOX
)
desired_capabilities
=
webdriver
.
FirefoxOptions
().
to_capabilities
()
)
driver
.
get
(
self
.
server_url
)
driver
.
get
(
self
.
server_url
)
self
.
assertEqual
(
'Test page'
,
driver
.
title
)
self
.
assertEqual
(
'Test page'
,
driver
.
title
)
...
@@ -281,7 +280,7 @@ class TestBrowserSelection(WebServerMixin, SeleniumServerTestCase):
...
@@ -281,7 +280,7 @@ class TestBrowserSelection(WebServerMixin, SeleniumServerTestCase):
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
webdriver_url
=
parameter_dict
[
'backend-url'
]
webdriver_url
=
parameter_dict
[
'backend-url'
]
desired_capabilities
=
DesiredCapabilities
.
FIREFOX
.
copy
()
desired_capabilities
=
webdriver
.
FirefoxOptions
().
to_capabilities
()
desired_capabilities
[
'version'
]
=
'102.15.1esr'
desired_capabilities
[
'version'
]
=
'102.15.1esr'
driver
=
webdriver
.
Remote
(
driver
=
webdriver
.
Remote
(
command_executor
=
webdriver_url
,
command_executor
=
webdriver_url
,
...
@@ -339,7 +338,7 @@ class TestFrontend(WebServerMixin, SeleniumServerTestCase):
...
@@ -339,7 +338,7 @@ class TestFrontend(WebServerMixin, SeleniumServerTestCase):
driver
=
webdriver
.
Remote
(
driver
=
webdriver
.
Remote
(
command_executor
=
executor
,
command_executor
=
executor
,
desired_capabilities
=
DesiredCapabilities
.
CHROME
)
desired_capabilities
=
webdriver
.
ChromeOptions
().
to_capabilities
()
)
driver
.
get
(
self
.
server_url
)
driver
.
get
(
self
.
server_url
)
self
.
assertEqual
(
'Test page'
,
driver
.
title
)
self
.
assertEqual
(
'Test page'
,
driver
.
title
)
...
@@ -414,7 +413,8 @@ class TestFirefox102(
...
@@ -414,7 +413,8 @@ class TestFirefox102(
SeleniumServerTestCase
,
SeleniumServerTestCase
,
ImageComparisonTestCase
,
ImageComparisonTestCase
,
):
):
desired_capabilities
=
dict
(
DesiredCapabilities
.
FIREFOX
,
version
=
'102.15.1esr'
)
desired_capabilities
=
dict
(
webdriver
.
FirefoxOptions
().
to_capabilities
(),
version
=
'102.15.1esr'
)
user_agent
=
'Gecko/20100101 Firefox/102.0'
user_agent
=
'Gecko/20100101 Firefox/102.0'
def
test_resize_window
(
self
):
def
test_resize_window
(
self
):
...
@@ -426,7 +426,8 @@ class TestFirefox115(
...
@@ -426,7 +426,8 @@ class TestFirefox115(
SeleniumServerTestCase
,
SeleniumServerTestCase
,
ImageComparisonTestCase
,
ImageComparisonTestCase
,
):
):
desired_capabilities
=
dict
(
DesiredCapabilities
.
FIREFOX
,
version
=
'115.3.1esr'
)
desired_capabilities
=
dict
(
webdriver
.
FirefoxOptions
().
to_capabilities
(),
version
=
'115.3.1esr'
)
user_agent
=
'Gecko/20100101 Firefox/115.0'
user_agent
=
'Gecko/20100101 Firefox/115.0'
def
test_resize_window
(
self
):
def
test_resize_window
(
self
):
...
@@ -438,7 +439,8 @@ class TestChrome91(
...
@@ -438,7 +439,8 @@ class TestChrome91(
SeleniumServerTestCase
,
SeleniumServerTestCase
,
ImageComparisonTestCase
,
ImageComparisonTestCase
,
):
):
desired_capabilities
=
dict
(
DesiredCapabilities
.
CHROME
,
version
=
'91.0.4472.114'
)
desired_capabilities
=
dict
(
webdriver
.
ChromeOptions
().
to_capabilities
(),
version
=
'91.0.4472.114'
)
user_agent
=
'Chrome/91.0.4472.0'
user_agent
=
'Chrome/91.0.4472.0'
...
@@ -447,5 +449,6 @@ class TestChrome120(
...
@@ -447,5 +449,6 @@ class TestChrome120(
SeleniumServerTestCase
,
SeleniumServerTestCase
,
ImageComparisonTestCase
,
ImageComparisonTestCase
,
):
):
desired_capabilities
=
dict
(
DesiredCapabilities
.
CHROME
,
version
=
'120.0.6099.109'
)
desired_capabilities
=
dict
(
webdriver
.
ChromeOptions
().
to_capabilities
(),
version
=
'120.0.6099.109'
)
user_agent
=
'Chrome/120.0.0.0'
user_agent
=
'Chrome/120.0.0.0'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment