Skip to content

Commit 347b982

Browse files
committed
[test] nw2: fix issue4007-reload-lost-app-window
1 parent 0bb50e7 commit 347b982

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

test/sanity/issue4007-reload-lost-app-window/index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@
99
<body>
1010
<h1>Reload the app</h1>
1111
<button id="reloadapp" onclick="reloadApp()">Reload</button>
12+
<button id="opendevtools" onclick="openDevTools()">Reload</button>
1213
<script>
1314
function reloadApp() {
1415
chrome.runtime.reload();
1516
}
1617

18+
function openDevTools() {
19+
nw.Window.get().showDevTools();
20+
}
21+
1722
try {
1823
nw.Window.get()
1924
document.write('<h1 id="result">success</h1>');
@@ -22,4 +27,4 @@ <h1>Reload the app</h1>
2227
}
2328
</script>
2429
</body>
25-
</html>
30+
</html>

test/sanity/issue4007-reload-lost-app-window/test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
try:
2828
switch_to_devtools(driver, devtools_window=driver.window_handles[0])
2929
except:
30+
if len(driver.window_handles) < 2:
31+
driver.find_element_by_id('opendevtools').click()
32+
wait_window_handles(driver, lambda handles: len(handles) == 2)
3033
switch_to_devtools(driver, devtools_window=driver.window_handles[1])
3134
print 'click Console panel'
3235
devtools_click_tab(driver, 'console')

0 commit comments

Comments
 (0)