Skip to content

Commit

Permalink
[deps] Upgraded selenium
Browse files Browse the repository at this point in the history
  • Loading branch information
Aryamanz29 authored May 10, 2023
1 parent 7a065c0 commit 24da2eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ openwisp-utils[qa] @ https://github.com/openwisp/openwisp-utils/tarball/master
redis~=4.3.4
django-redis~=5.0.0
django-reversion~=4.0.1
selenium~=3.141.0
selenium~=4.9.0
8 changes: 5 additions & 3 deletions tests/testapp/tests/mixins.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from selenium.webdriver.common.by import By

from openwisp_users.tests.test_api import AuthenticationMixin
from openwisp_users.tests.utils import TestMultitenantAdminMixin, TestOrganizationMixin

Expand Down Expand Up @@ -43,6 +45,6 @@ def login(self, username=None, password=None, driver=None):
password = self.admin_password
driver.get(f'{self.live_server_url}/admin/login/')
if 'admin/login' in driver.current_url:
driver.find_element_by_name('username').send_keys(username)
driver.find_element_by_name('password').send_keys(password)
driver.find_element_by_xpath('//input[@type="submit"]').click()
driver.find_element(By.NAME, 'username').send_keys(username)
driver.find_element(By.NAME, 'password').send_keys(password)
driver.find_element(By.XPATH, '//input[@type="submit"]').click()
14 changes: 7 additions & 7 deletions tests/testapp/tests/test_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ def _test_multitenant_autocomplete_org_field(
):
self.login(username=username, password=password)
self.open(path)
self.web_driver.find_element_by_css_selector(
'#select2-id_organization-container'
self.web_driver.find_element(
By.CSS_SELECTOR, '#select2-id_organization-container'
).click()
WebDriverWait(self.web_driver, 2).until(
EC.invisibility_of_element_located(
(By.CSS_SELECTOR, '.select2-results__option.loading-results')
)
)
options = self.web_driver.find_elements_by_css_selector(
'.select2-results__option'
options = self.web_driver.find_elements(
By.CSS_SELECTOR, '.select2-results__option'
)
for option in options:
self.assertIn(option.text, visible)
Expand Down Expand Up @@ -102,7 +102,7 @@ def test_book_add_form_organization_field(self):
),
)
org_select = Select(
self.web_driver.find_element_by_css_selector('#id_organization')
self.web_driver.find_element(By.CSS_SELECTOR, '#id_organization')
)
self.assertEqual(len(org_select.all_selected_options), 1)
self.assertEqual(org_select.first_selected_option.text, org1.name)
Expand All @@ -121,7 +121,7 @@ def test_book_add_form_organization_field(self):
).values_list('name', flat=True),
)
org_select = Select(
self.web_driver.find_element_by_css_selector('#id_organization')
self.web_driver.find_element(By.CSS_SELECTOR, '#id_organization')
)
self.assertEqual(len(org_select.all_selected_options), 0)
self.open(reverse('admin:logout'))
Expand Down Expand Up @@ -163,7 +163,7 @@ def test_shelf_add_form_organization_field(self):
+ ['Shared systemwide (no organization)'],
)
org_select = Select(
self.web_driver.find_element_by_css_selector('#id_organization')
self.web_driver.find_element(By.CSS_SELECTOR, '#id_organization')
)
self.assertEqual(len(org_select.all_selected_options), 1)
self.assertEqual(org_select.first_selected_option.text, org1.name)
Expand Down

0 comments on commit 24da2eb

Please sign in to comment.