Skip to content

Commit fc3fd91

Browse files
wanghongjuanrogerwang
authored andcommitted
[test] Add test for issue6339
- Add test for issue nwjs#6339 - This test is failed on v0.27.2, passed on v0.28.1
1 parent 5c7e7f9 commit fc3fd91

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html>
2+
<head>
3+
<title>issue6339-child-process-execSync</title>
4+
</head>
5+
<body>
6+
<h1 id='result'></h1>
7+
<script>
8+
var child = require('child_process');
9+
const stdout = child.execSync('node -v');
10+
document.getElementById('result').innerHTML=stdout
11+
</script>
12+
<button id='btn' onclick="nw.Window.get().showDevTools();"> Click Me </button>
13+
</body>
14+
</html>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "issue6339-child-process-execSync-crash",
3+
"main": "index.html"
4+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import time
2+
import os
3+
import sys
4+
5+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
6+
from nw_util import *
7+
8+
from selenium import webdriver
9+
from selenium.webdriver.chrome.options import Options
10+
11+
chrome_options = Options()
12+
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__)))
13+
14+
driver = webdriver.Chrome(executable_path=os.environ["CHROMEDRIVER"], chrome_options=chrome_options)
15+
try:
16+
print driver.current_url
17+
res = wait_for_element_id(driver, "result")
18+
print res
19+
assert("v" in res)
20+
driver.find_element_by_id("btn").click()
21+
print "waiting for crash"
22+
time.sleep(3)
23+
result = wait_for_element_id(driver, "result")
24+
assert("v" in result)
25+
print "There is no crash"
26+
finally:
27+
driver.quit()
28+

0 commit comments

Comments
 (0)