Skip to content
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 debug_toolbar/static/debug_toolbar/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const $$ = {
}
},
visible: function (element) {
element.classList.contains("djdt-hidden");
return !element.classList.contains("djdt-hidden");
},
executeScripts: function (scripts) {
scripts.forEach(function (script) {
Expand Down
29 changes: 29 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
try:
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
except ImportError:
webdriver = None
Expand Down Expand Up @@ -442,6 +444,33 @@ def test_django_cached_template_loader(self):
)
)

def test_sql_action_and_go_back(self):
self.selenium.get(self.live_server_url + "/execute_sql/")
sql_panel = self.selenium.find_element_by_id("SQLPanel")
debug_window = self.selenium.find_element_by_id("djDebugWindow")

# Click to show the SQL panel
self.selenium.find_element_by_class_name("SQLPanel").click()

# SQL panel loads
button = WebDriverWait(self.selenium, timeout=3).until(
EC.visibility_of_element_located((By.CSS_SELECTOR, ".remoteCall"))
)
button.click()

# SQL selected window loads
WebDriverWait(self.selenium, timeout=3).until(EC.visibility_of(debug_window))
self.assertIn("SQL selected", debug_window.text)

# Close the SQL selected window
debug_window.find_element_by_class_name("djDebugClose").click()
WebDriverWait(self.selenium, timeout=3).until(
EC.invisibility_of_element(debug_window)
)

# SQL panel is still visible
self.assertTrue(sql_panel.is_displayed())


@override_settings(DEBUG=True)
class DebugToolbarSystemChecksTestCase(SimpleTestCase):
Expand Down