|
20 | 20 | try:
|
21 | 21 | from selenium import webdriver
|
22 | 22 | from selenium.common.exceptions import NoSuchElementException
|
| 23 | + from selenium.webdriver.common.by import By |
23 | 24 | from selenium.webdriver.firefox.options import Options
|
| 25 | + from selenium.webdriver.support import expected_conditions as EC |
24 | 26 | from selenium.webdriver.support.wait import WebDriverWait
|
25 | 27 | except ImportError:
|
26 | 28 | webdriver = None
|
@@ -438,3 +440,30 @@ def test_django_cached_template_loader(self):
|
438 | 440 | "#djDebugWindow code"
|
439 | 441 | )
|
440 | 442 | )
|
| 443 | + |
| 444 | + def test_sql_action_and_go_back(self): |
| 445 | + self.selenium.get(self.live_server_url + "/execute_sql/") |
| 446 | + sql_panel = self.selenium.find_element_by_id("SQLPanel") |
| 447 | + debug_window = self.selenium.find_element_by_id("djDebugWindow") |
| 448 | + |
| 449 | + # Click to show the SQL panel |
| 450 | + self.selenium.find_element_by_class_name("SQLPanel").click() |
| 451 | + |
| 452 | + # SQL panel loads |
| 453 | + button = WebDriverWait(self.selenium, timeout=3).until( |
| 454 | + EC.visibility_of_element_located((By.CSS_SELECTOR, ".remoteCall")) |
| 455 | + ) |
| 456 | + button.click() |
| 457 | + |
| 458 | + # SQL selected window loads |
| 459 | + WebDriverWait(self.selenium, timeout=3).until(EC.visibility_of(debug_window)) |
| 460 | + self.assertIn("SQL selected", debug_window.text) |
| 461 | + |
| 462 | + # Close the SQL selected window |
| 463 | + debug_window.find_element_by_class_name("djDebugClose").click() |
| 464 | + WebDriverWait(self.selenium, timeout=3).until( |
| 465 | + EC.invisibility_of_element(debug_window) |
| 466 | + ) |
| 467 | + |
| 468 | + # SQL panel is still visible |
| 469 | + self.assertTrue(sql_panel.is_displayed()) |
0 commit comments