Skip to content

Commit 3f814f5

Browse files
wanghongjuanrogerwang
authored andcommitted
[test] Add test for issue4679
- Add test for issue nwjs#4679 - This test is failed on v0.13.0, passed on v0.30.4
1 parent d08ead6 commit 3f814f5

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>4679</title>
6+
</head>
7+
<body>
8+
<h1 id="result"></h1>
9+
</body>
10+
<script>
11+
window.addEventListener('load', function(){
12+
13+
process.on('uncaughtException', function(error) {
14+
// NEVER HAPPENS in 0.13
15+
// process.stdout.write("CAUGHT\n");
16+
// process.exit(1);
17+
document.getElementById('result').innerHTML='CAUGHT';
18+
});
19+
20+
global.setImmediate(function(){
21+
throw("from node");
22+
});
23+
});
24+
</script>
25+
</html>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "4679",
3+
"main": "index.html"
4+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import os
2+
import sys
3+
import platform
4+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
5+
from nw_util import *
6+
7+
from selenium import webdriver
8+
from selenium.webdriver.chrome.options import Options
9+
from selenium.webdriver.common.action_chains import ActionChains
10+
11+
if platform.system() == "Windows":
12+
print "Skipped for Windows platform"
13+
sys.exit(0)
14+
15+
chrome_options = Options()
16+
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__)))
17+
18+
driver = webdriver.Chrome(executable_path=os.environ["CHROMEDRIVER"], chrome_options=chrome_options)
19+
driver.implicitly_wait(2)
20+
try:
21+
print driver.current_url
22+
result = wait_for_element_id_content(driver, "result", "CAUGHT")
23+
assert("CAUGHT" in result)
24+
print "Got output from index page"
25+
finally:
26+
driver.quit()
27+

0 commit comments

Comments
 (0)