Skip to content

Commit 7aeb9f1

Browse files
committed
[fix] Fixed selenium tests
1 parent 212c450 commit 7aeb9f1

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/testapp/tests/test_selenium.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from django.db.models import Q
44
from django.test import tag
55
from django.urls import reverse
6+
from selenium.common.exceptions import TimeoutException
67
from selenium.webdriver.common.by import By
78
from selenium.webdriver.support import expected_conditions as EC
89
from selenium.webdriver.support.select import Select
@@ -25,6 +26,18 @@ def setUp(self):
2526
username=self.admin_username, password=self.admin_password
2627
)
2728

29+
def logout(self, driver=None):
30+
super().logout(driver)
31+
driver = driver or self.web_driver
32+
try:
33+
WebDriverWait(driver, 5).until(
34+
EC.url_to_be(f"{self.live_server_url}{reverse('admin:logout')}")
35+
)
36+
except TimeoutException:
37+
self.fail(
38+
"Browser failed to logout the user: URL did not change to logout page"
39+
)
40+
2841
def _test_multitenant_autocomplete_org_field(
2942
self, username, password, path, visible, hidden
3043
):

0 commit comments

Comments
 (0)