Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSLogic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
VIPSLogic
Commits
fc9b2c36
Commit
fc9b2c36
authored
1 year ago
by
Lene Wasskog
Browse files
Options
Downloads
Patches
Plain Diff
test: Add firefox driver, wait for visibility before checking page title
parent
9e31e9cb
Branches
Branches containing commit
No related tags found
1 merge request
!154
Merge all Wildfly 26 compatible updates into develop
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
selenium/tests/test_selenium.py
+20
-4
20 additions, 4 deletions
selenium/tests/test_selenium.py
with
20 additions
and
4 deletions
selenium/tests/test_selenium.py
+
20
−
4
View file @
fc9b2c36
...
@@ -6,15 +6,25 @@ from selenium.webdriver.support import expected_conditions as EC
...
@@ -6,15 +6,25 @@ from selenium.webdriver.support import expected_conditions as EC
# https://github.com/SeleniumHQ/seleniumhq.github.io/blob/trunk/examples/python/README.md
# https://github.com/SeleniumHQ/seleniumhq.github.io/blob/trunk/examples/python/README.md
# BROWSER = 'chrome'
BROWSER
=
"
firefox
"
@pytest.fixture
@pytest.fixture
def
browser
():
def
browser
():
chrome_options
=
webdriver
.
ChromeOptions
()
if
BROWSER
==
"
chrome
"
:
# Uncomment line below to prevent Chrome from opening
chrome_options
=
webdriver
.
ChromeOptions
()
# chrome_options.add_argument("--headless")
chrome_options
.
add_argument
(
"
--headless
"
)
driver
=
webdriver
.
Chrome
(
options
=
chrome_options
)
driver
=
webdriver
.
Chrome
(
options
=
chrome_options
)
elif
BROWSER
==
"
firefox
"
:
firefox_options
=
webdriver
.
FirefoxOptions
()
firefox_options
.
headless
=
False
driver
=
webdriver
.
Firefox
(
options
=
firefox_options
)
else
:
raise
Exception
(
"
Browser must be set to either chrome or firefox
"
)
driver
.
get
(
"
http://localhost/index.html
"
)
driver
.
get
(
"
http://localhost/index.html
"
)
assert
driver
.
title
==
"
Please log in
"
assert
driver
.
title
==
"
Please log in
"
driver
.
implicitly_wait
(
0.5
)
driver
.
implicitly_wait
(
0.5
)
driver
.
find_element
(
by
=
By
.
NAME
,
value
=
"
username
"
).
send_keys
(
"
seleniumtest
"
)
driver
.
find_element
(
by
=
By
.
NAME
,
value
=
"
username
"
).
send_keys
(
"
seleniumtest
"
)
...
@@ -82,6 +92,9 @@ def test_admin_users(browser):
...
@@ -82,6 +92,9 @@ def test_admin_users(browser):
)
)
assert
link
.
get_attribute
(
"
href
"
)
==
"
http://localhost/user
"
assert
link
.
get_attribute
(
"
href
"
)
==
"
http://localhost/user
"
link
.
click
()
link
.
click
()
WebDriverWait
(
browser
,
20
).
until
(
EC
.
visibility_of_element_located
((
By
.
XPATH
,
"
//h1[text()=
'
Users
'
]
"
))
)
assert
browser
.
title
==
"
Users
"
assert
browser
.
title
==
"
Users
"
...
@@ -92,4 +105,7 @@ def test_admin_forecasts(browser):
...
@@ -92,4 +105,7 @@ def test_admin_forecasts(browser):
)
)
assert
link
.
get_attribute
(
"
href
"
)
==
"
http://localhost/forecastConfiguration
"
assert
link
.
get_attribute
(
"
href
"
)
==
"
http://localhost/forecastConfiguration
"
link
.
click
()
link
.
click
()
WebDriverWait
(
browser
,
20
).
until
(
EC
.
visibility_of_element_located
((
By
.
XPATH
,
"
//h1[text()=
'
Forecasts
'
]
"
))
)
assert
browser
.
title
==
"
Forecasts
"
assert
browser
.
title
==
"
Forecasts
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment