From 26b8c63206ffc4372a3486d037628b63c67fd8f9 Mon Sep 17 00:00:00 2001 From: Ayushman Chhabra <14110965+ayushmanchhabra@users.noreply.github.com> Date: Sun, 1 Sep 2024 22:03:16 +0530 Subject: [PATCH] test for win.isDevToolsOpen --- test/sanity/window-isdevtoolsopen/index.html | 22 +++++++++++++++++++ .../sanity/window-isdevtoolsopen/package.json | 4 ++++ test/sanity/window-isdevtoolsopen/test.py | 15 +++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 test/sanity/window-isdevtoolsopen/index.html create mode 100644 test/sanity/window-isdevtoolsopen/package.json create mode 100644 test/sanity/window-isdevtoolsopen/test.py diff --git a/test/sanity/window-isdevtoolsopen/index.html b/test/sanity/window-isdevtoolsopen/index.html new file mode 100644 index 0000000000..79b05d877b --- /dev/null +++ b/test/sanity/window-isdevtoolsopen/index.html @@ -0,0 +1,22 @@ + + + + + + nw.Window.isDevToolsOpen fixture + + + +
+ win.isDevToolsOpen: + +
+ + diff --git a/test/sanity/window-isdevtoolsopen/package.json b/test/sanity/window-isdevtoolsopen/package.json new file mode 100644 index 0000000000..f2e85db4d4 --- /dev/null +++ b/test/sanity/window-isdevtoolsopen/package.json @@ -0,0 +1,4 @@ +{ + "name": "window-isdevtoolsopen", + "main": "index.html" +} diff --git a/test/sanity/window-isdevtoolsopen/test.py b/test/sanity/window-isdevtoolsopen/test.py new file mode 100644 index 0000000000..85639ea2bd --- /dev/null +++ b/test/sanity/window-isdevtoolsopen/test.py @@ -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()