Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test to cover win.isDevToolsOpen behaviour #8214

Open
wants to merge 1 commit into
base: nw91
Choose a base branch
from
Open
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
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()