Skip to content

Commit

Permalink
[test] Add test for issue4679
Browse files Browse the repository at this point in the history
- Add test for issue #4679
- This test is failed on v0.13.0, passed on v0.30.4
  • Loading branch information
wanghongjuan authored and rogerwang committed Jun 5, 2018
1 parent d08ead6 commit 3f814f5
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/sanity/issue4679-process-event-uncaughtException/index.html
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>
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 test/sanity/issue4679-process-event-uncaughtException/test.py
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_content(driver, "result", "CAUGHT")
assert("CAUGHT" in result)
print "Got output from index page"
finally:
driver.quit()

0 comments on commit 3f814f5

Please sign in to comment.