Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Selenium dependency #703

Merged
merged 1 commit into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ django-user-sessions

# Example app (WebAuthn)

webauthn~=1.6.0
webauthn~=1.11.0

# Testing

Expand Down
3 changes: 1 addition & 2 deletions requirements_e2e.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# test with selenium
selenium~=4.4.3
webdriver-manager~=3.8.3,!=3.8.5
selenium~=4.16.0
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ deps =
dj42: Django<5.0
djmain: https://github.com/django/django/archive/main.tar.gz
yubikey: django-otp-yubikey
webauthn: webauthn>=1.2.1,<1.99
webauthn: webauthn>=1.11.0,<1.99
webauthn: -rrequirements_e2e.txt
coverage
freezegun
Expand All @@ -62,7 +62,7 @@ commands =

[testenv:flake8]
basepython = python3
deps = flake8<=3.99
deps = flake8<=6.99
commands = flake8 example tests two_factor

[testenv:isort]
Expand Down
18 changes: 3 additions & 15 deletions two_factor/plugins/webauthn/tests/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,8 @@
except ImportError:
webauthn = None

try:
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.utils import ChromeType
except ImportError:
ChromeDriverManager = None


@skipUnless(webdriver, 'package selenium is not present')
@skipUnless(ChromeDriverManager, 'package webdriver-manager is not present')
@skipUnless(webauthn, 'package webauthn is not present')
class E2ETests(UserMixin, StaticLiveServerTestCase):
port = 8000
Expand All @@ -40,12 +33,7 @@ def setUp(self):

options = webdriver.ChromeOptions()
options.add_argument('headless')
try:
driver = ChromeDriverManager()
except ValueError:
driver = ChromeDriverManager(chrome_type=ChromeType.CHROMIUM)
self.webdriver = webdriver.Chrome(driver.install(), options=options)

self.webdriver = webdriver.Chrome(options=options)
super().setUp()

def tearDown(self):
Expand All @@ -70,7 +58,7 @@ def wait_for_url(self, url):
WebDriverWait(self.webdriver, self.timeout).until(EC.url_to_be(url))

def do_login(self):
self.wait_for_url(self.login_url)
self.webdriver.get(self.login_url)

username = self.webdriver.find_element(By.ID, 'id_auth-username')
username.clear()
Expand All @@ -84,7 +72,7 @@ def do_login(self):
button_next.click()

def register_authenticator(self):
self.wait_for_url(urljoin(self.base_url, reverse("two_factor:setup")))
self.webdriver.get(urljoin(self.base_url, reverse("two_factor:setup")))
self.webdriver.find_element(By.XPATH, "//button[@type='submit']").click()

self.wait_for_element(By.XPATH, "//input[@value='webauthn']").click()
Expand Down
Loading