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.
- Add test for issue nwjs#4679 - This test is failed on v0.13.0, passed on v0.30.4
- Loading branch information
1 parent
78db7c4
commit 5c73cea
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
test/sanity/issue4679-process-event-uncaughtException/index.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 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>4679</title> | ||
</head> | ||
<body> | ||
<h1 id="result"></h1> | ||
</body> | ||
<script> | ||
window.addEventListener('load', function(){ | ||
|
||
process.on('uncaughtException', function(error) { | ||
// NEVER HAPPENS in 0.13 | ||
// process.stdout.write("CAUGHT\n"); | ||
// process.exit(1); | ||
document.getElementById('result').innerHTML='CAUGHT'; | ||
}); | ||
|
||
global.setImmediate(function(){ | ||
throw("from node"); | ||
}); | ||
}); | ||
</script> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
test/sanity/issue4679-process-event-uncaughtException/package.json
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,4 @@ | ||
{ | ||
"name": "4679", | ||
"main": "index.html" | ||
} |
27 changes: 27 additions & 0 deletions
27
test/sanity/issue4679-process-event-uncaughtException/test.py
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,27 @@ | ||
import os | ||
import sys | ||
import platform | ||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||
from nw_util import * | ||
|
||
from selenium import webdriver | ||
from selenium.webdriver.chrome.options import Options | ||
from selenium.webdriver.common.action_chains import ActionChains | ||
|
||
if platform.system() == 'Windows': | ||
print 'Skipped for Windows platform' | ||
sys.exit(0) | ||
|
||
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) | ||
try: | ||
print driver.current_url | ||
result = wait_for_element_id(driver, "result") | ||
assert("CAUGHT" in result) | ||
print "Got output from index page" | ||
finally: | ||
driver.quit() | ||
|