Skip to content

Commit

Permalink
test case for issue nwjs#4121
Browse files Browse the repository at this point in the history
  • Loading branch information
Cong Liu committed Jan 14, 2016
1 parent c1aa5cb commit 409c22a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/remoting/issue4121-inpect-node-crash/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Inspect Crash</title>
</head>
<body>
<button id="require" onclick="require('./test.js')">require</button>
<script>
chrome.developerPrivate.openDevTools({renderViewId: -1, renderProcessId: -1, extensionId: chrome.runtime.id})
</script>
</body>
</html>
4 changes: 4 additions & 0 deletions test/remoting/issue4121-inpect-node-crash/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "issue3835-inspect-crash",
"main": "index.html"
}
1 change: 1 addition & 0 deletions test/remoting/issue4121-inpect-node-crash/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('hello')
28 changes: 28 additions & 0 deletions test/remoting/issue4121-inpect-node-crash/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import time
import os

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)
driver.implicitly_wait(2)
time.sleep(1)
try:
print driver.current_url
driver.find_element_by_id('require').click()
time.sleep(2) # wait for background devtools open
driver.switch_to_window(driver.window_handles[-1])
# necessary compatible for older alphaN
# where devtools is loaded in an iframe
inspector_frames = driver.find_elements_by_id('inspector-app-iframe')
if inspector_frames:
driver.switch_to_frame(inspector_frames[0])
driver.execute_script('return document.querySelector(".inspector-view-tabbed-pane").shadowRoot.getElementById("tab-console")').click()
driver.find_element_by_class_name('console-message-url').click()
sources_panel = driver.find_element_by_css_selector('.panel.sources')
assert(sources_panel is not None)
finally:
driver.quit()

0 comments on commit 409c22a

Please sign in to comment.