Skip to content

Commit 5972edb

Browse files
wanghongjuanrogerwang
authored andcommitted
[test] add test for issue#6143
- This case is failed on failed version 0.25.0, pass on fixed version 0.27.4
1 parent 6fe9282 commit 5972edb

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<title>issue6143-mac-setProgressBar-crash</title>
7+
</head>
8+
<body>
9+
<h3 id="result">success</h3>
10+
<script>
11+
chrome.downloads.download({ url: "https://github.com/nwjs/nw.js/archive/nw-v0.27.4.tar.gz" });
12+
setInterval(
13+
() => nw.Window.get().setProgressBar(Math.random()) // It crashes here
14+
, 1000);
15+
</script>
16+
</body>
17+
</html>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "issue6143-mac-setProgressBar-crash",
3+
"main": "index.html"
4+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import time
2+
import os
3+
import platform
4+
import sys
5+
6+
if platform.system() != 'Darwin':
7+
print 'Skipped for non Mac platform'
8+
sys.exit(0)
9+
10+
from selenium import webdriver
11+
from selenium.webdriver.chrome.options import Options
12+
chrome_options = Options()
13+
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__)))
14+
15+
driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options)
16+
driver.implicitly_wait(2)
17+
try:
18+
print driver.current_url
19+
print 'waiting for crash'
20+
time.sleep(5)
21+
result = driver.find_element_by_id('result').get_attribute('innerHTML')
22+
print result
23+
assert('success' in result)
24+
print 'There is no crash'
25+
finally:
26+
driver.quit()

0 commit comments

Comments
 (0)