forked from nwjs/nw.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Cong Liu
committed
Jan 19, 2016
1 parent
6e616ed
commit 8d8de5d
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "issue4187-close-hidden", | ||
"main": "index.html", | ||
"window": { | ||
"show": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |