Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
3ef42561
Commit
3ef42561
authored
2 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Plain Diff
Merge branch '706-selenium-forgot-about-find_element_by_xpath' into 'master'
Resolve "Selenium forgot about `find_element_by_xpath`" Closes
#706
See merge request
!1056
parents
8b4d08e6
7acf6e5f
No related branches found
Branches containing commit
No related tags found
1 merge request
!1056
Resolve "Selenium forgot about `find_element_by_xpath`"
Pipeline
#76209
passed
2 years ago
Stage: prepare
Stage: test
Stage: build
Stage: publish
Stage: docker
Stage: deploy
Pipeline: AlekSIS
#76230
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/core/tests/browser/test_selenium.py
+15
-5
15 additions, 5 deletions
aleksis/core/tests/browser/test_selenium.py
with
15 additions
and
5 deletions
aleksis/core/tests/browser/test_selenium.py
+
15
−
5
View file @
3ef42561
...
...
@@ -7,6 +7,8 @@ from django.test.selenium import SeleniumTestCase, SeleniumTestCaseBase
from
django.urls
import
reverse
import
pytest
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.support
import
expected_conditions
as
EC
from
selenium.webdriver.support.wait
import
WebDriverWait
from
aleksis.core.models
import
Person
...
...
@@ -43,17 +45,25 @@ class SeleniumTests(SeleniumTestCase):
self
.
_screenshot
(
"
login_default_superuser_blank.png
"
)
# Find login form input fields and enter defined credentials
self
.
selenium
.
find_element_by_xpath
(
'
//label[contains(text(),
"
Username
"
)]/../input
'
WebDriverWait
(
self
.
selenium
,
10
).
until
(
EC
.
element_to_be_clickable
(
(
By
.
XPATH
,
'
//label[contains(text(),
"
Username
"
)]/../input
'
),
)
).
send_keys
(
username
)
self
.
selenium
.
find_element_by_xpath
(
'
//label[contains(text(),
"
Password
"
)]/../input
'
WebDriverWait
(
self
.
selenium
,
10
).
until
(
EC
.
element_to_be_clickable
(
(
By
.
XPATH
,
'
//label[contains(text(),
"
Password
"
)]/../input
'
),
)
).
send_keys
(
password
)
if
with_screenshots
:
self
.
_screenshot
(
"
login_default_superuser_filled.png
"
)
# Submit form by clicking django-two-factor-auth's Next button
self
.
selenium
.
find_element_by_xpath
(
'
//button[contains(text(),
"
Login
"
)]
'
).
click
()
WebDriverWait
(
self
.
selenium
,
10
).
until
(
EC
.
element_to_be_clickable
(
(
By
.
XPATH
,
'
//button[contains(text(),
"
Login
"
)]
'
),
)
).
click
()
if
with_screenshots
:
self
.
_screenshot
(
"
login_default_superuser_submitted.png
"
)
...
...
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