Skip to content

Commit

Permalink
test for win.isDevToolsOpen
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushmanchhabra committed Sep 1, 2024
1 parent c45f2f8 commit 5a86986
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/sanity/window-isdevtoolsopen/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>nw.Window.isDevToolsOpen fixture</title>
<script>
document.addEventListener('DOMContentLoaded', function() {
const win = nw.Window.get();
win.showDevTools(undefined, () => {
win.isDevToolsOpen((status) => {
document.getElementById('isdevtoolsopen').textContent = String(status);
})
});
});
</script>
</head>
<body>
<div>
<span>win.isDevToolsOpen: </span>
<span id="isdevtoolsopen"></span>
</div>
</body>
</html>
4 changes: 4 additions & 0 deletions test/sanity/window-isdevtoolsopen/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "window-isdevtoolsopen",
"main": "index.html"
}
15 changes: 15 additions & 0 deletions test/sanity/window-isdevtoolsopen/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os
import platform
import time

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__)))

driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options, service_log_path="log", service_args=["--verbose"])
try:
result = driver.find_element_by_id('isdevtoolsopen').get_attribute('textContent')
assert(result == 'true')
finally:
driver.quit()

0 comments on commit 5a86986

Please sign in to comment.