Skip to content

Commit 18fd9a0

Browse files
committed
[test] update new-win-policy: support ctrl-click; frameless
1 parent f36eaa8 commit 18fd9a0

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

test/sanity/new-win-policy/target.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
window.onload = function() {
99
result.push("onload-dom");
1010
document.getElementById('output').value = (JSON.stringify(result));
11+
var win = nw.Window.get();
12+
var status = '';
13+
if (win.height == window.innerHeight) status = "Success: ";
14+
document.getElementById('output2').innerHTML = status + "height: " + win.height + ", " + window.innerHeight;
1115
}
1216
</script>
1317
</head>
@@ -17,5 +21,6 @@
1721
result.push("body-start");
1822
</script>
1923
<textarea id="output" rows="12" cols="80" style="font-family: monospace;"></textarea>
24+
<p id="output2"></p>
2025
</body>
2126
</html>

test/sanity/new-win-policy/test.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
from selenium import webdriver
88
from selenium.webdriver.chrome.options import Options
9+
from selenium.webdriver.common.action_chains import ActionChains
10+
from selenium.webdriver.common.keys import Keys
11+
912
chrome_options = Options()
1013
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__)))
1114

@@ -21,6 +24,22 @@
2124
driver.switch_to_window(driver.window_handles[-1])
2225
output = driver.find_element_by_id('output')
2326
assert(output.get_attribute('value') == '["inject-js-start","body-start","inject-js-end","onload-dom"]')
27+
output2 = driver.find_element_by_id('output2').get_attribute('innerHTML')
28+
assert("Success" in output2)
29+
30+
driver.close()
31+
driver.switch_to_window(driver.window_handles[0])
32+
link = driver.find_element_by_link_text('new window')
33+
if platform.system() == 'Darwin':
34+
ActionChains(driver).key_down(Keys.SHIFT).click(link).key_up(Keys.SHIFT).perform()
35+
else:
36+
ActionChains(driver).key_down(Keys.CONTROL).click(link).key_up(Keys.CONTROL).perform()
37+
wait_window_handles(driver, 2)
38+
driver.switch_to_window(driver.window_handles[-1])
39+
output = driver.find_element_by_id('output')
40+
assert(output.get_attribute('value') == '["inject-js-start","body-start","inject-js-end","onload-dom"]')
41+
output2 = driver.find_element_by_id('output2').get_attribute('innerHTML')
42+
assert("Success" in output2)
43+
2444
finally:
25-
#time.sleep(50)
2645
driver.quit()

0 commit comments

Comments
 (0)