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 case for issue #4187 #4273

Merged
merged 1 commit into from
Jan 20, 2016
Merged
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
31 changes: 31 additions & 0 deletions test/remoting/issue4187-close-hidden/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>hidden crash</title>
</head>

<body>
<h1 id="result">success</h1>
<script>
nw.Window.open('splash.html', {}, function(ssWin) {

ssWin.on('loaded', function() {
console.log('on ssWin loaded');

setTimeout(function() {
ssWin.close();
ssWin = null;

console.log('close window');
nw.Window.get().show();
}, 3000);
});

});

</script>
</body>

</html>
7 changes: 7 additions & 0 deletions test/remoting/issue4187-close-hidden/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "issue4187-close-hidden",
"main": "index.html",
"window": {
"show": false
}
}
14 changes: 14 additions & 0 deletions test/remoting/issue4187-close-hidden/splash.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>splash</title>
</head>

<body>
<h1>This is a splash</h1>
</body>

</html>
25 changes: 25 additions & 0 deletions test/remoting/issue4187-close-hidden/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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
time.sleep(1) # wait for window open
print 'Wait for splash window close'
while len(driver.window_handles) != 1:
time.sleep(1)
print driver.window_handles
driver.switch_to_window(driver.window_handles[0])
result = driver.find_element_by_id('result').get_attribute('innerHTML')
print result
assert('success' in result)
finally:
driver.quit()