Skip to content

Commit eec260d

Browse files
wanghongjuanrogerwang
authored andcommitted
[test] Add test for issue nwjs#5943
- This case is failed on failed version 0.23.0, pass on fixed version 0.27.4
1 parent 1180a4f commit eec260d

File tree

5 files changed

+160
-0
lines changed

5 files changed

+160
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Program: 5DBat - by BlatSoft
2+
// 04/2017 version: 0.1.0
3+
// dbcontrol.js
4+
// This file used to control all database functions
5+
// - Called from end of start.html/running.html
6+
7+
"use strict";
8+
9+
var dblite = require('dblite');
10+
11+
var dbPath = 'dogs.db';
12+
13+
// ********************** Define SQLite bin path **************************
14+
//dblite.bin = "node_modules/sqlite3/sqlite3"; // if not specified then default install will be used if exists (/usr/local/bin/sqlite3)
15+
16+
17+
//######################################################################################################
18+
//# DB Connect (dblite)
19+
//######################################################################################################
20+
/**
21+
* Connect Database
22+
* @param dbPath
23+
*
24+
*/
25+
//var db = function connectDb(dbPath) {
26+
var db = dblite(dbPath); // creates if no exist
27+
Binary file not shown.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"app_name": "5943",
3+
"name": "issue5943-mac-dblite-module-with-node8-crash",
4+
"description": "Crash with nwjs 0.23.0 with node 8.0.0pre",
5+
"single-instance": true,
6+
"version": "0.1.0",
7+
"chromium-args": "--enable-logging",
8+
"main": "start.html",
9+
"window": {
10+
"resizable": true,
11+
"visible": true,
12+
"exe_icon": "",
13+
"icon": "",
14+
"width": 1400,
15+
"show_in_taskbar": true,
16+
"always_on_top": false,
17+
"mac_icon": "",
18+
"title": "dblitekrash0230",
19+
"height": 850,
20+
"show": true,
21+
"fullscreen": false
22+
},
23+
"webkit": {
24+
"plugin": true
25+
},
26+
"webview": {
27+
"partitions": [
28+
{
29+
"name": "trusted",
30+
"accessible_resources": [
31+
"<all_urls>"
32+
]
33+
}
34+
]
35+
},
36+
"additional_trust_anchors": [
37+
""
38+
],
39+
"dependencies": {
40+
"dblite": "^0.7.9"
41+
}
42+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3+
<!--
4+
// Program: game - by BlatSoft
5+
// 05/2017 version: 0.7.0
6+
// start.html
7+
// This page is first screen on game start - used to set up game/teams/etc ready for play
8+
// - Called from package.json
9+
-->
10+
<head>
11+
<title>issue5943-mac-dblite-module-with-node8-crash</title>
12+
<script type="text/javascript" src="dbcontrol.js" charset="utf-8"></script>
13+
14+
</head>
15+
16+
<body>
17+
18+
<div id="head">
19+
<h1>dblitekrash0230node8</h1>
20+
<div id="versions">
21+
NWjs version -
22+
<script>
23+
document.write(process.versions['nw']);
24+
</script><br /> IO.js/node.js version -
25+
<script>
26+
document.write(process.versions['node']);
27+
</script><br /> Chromium version -
28+
<script>
29+
document.write(process.versions['chromium']);
30+
</script><br />
31+
</div>
32+
33+
</div>
34+
<div id="shell"></div>
35+
36+
<!-- End of HTML ********************************** -->
37+
38+
<script type="text/javascript">
39+
40+
var show = ''; // = new Array();
41+
db.query('SELECT rowid, Cap, Dog FROM ' + 'Australia',['id', 'cap', 'dog'],
42+
// once retrieved
43+
function(rows) {
44+
for (var i = 0, len = rows.length; i < len; i++) {
45+
var str = rows[i].dog; // used for populating optionlist
46+
console.log(str);
47+
show = show + str + '<br />';
48+
}
49+
document.getElementById('shell').innerHTML = show;
50+
}
51+
);
52+
</script>
53+
54+
</body>
55+
</html>
56+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import time
2+
import os
3+
import shutil
4+
import platform
5+
import sys
6+
import subprocess
7+
8+
if platform.system() != 'Darwin':
9+
print 'Skipped for non Mac platform'
10+
sys.exit(0)
11+
12+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
13+
from nw_util import *
14+
15+
from selenium import webdriver
16+
from selenium.webdriver.chrome.options import Options
17+
18+
chrome_options = Options()
19+
testdir = os.path.dirname(os.path.abspath(__file__))
20+
chrome_options.add_argument("nwapp=" + testdir)
21+
node_module = os.path.join(testdir, "node_modules")
22+
os.chdir(testdir)
23+
24+
install_native_modules()
25+
26+
driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options)
27+
driver.implicitly_wait(2)
28+
try:
29+
print driver.current_url
30+
print "select data from table Australia"
31+
result = driver.find_element_by_id("shell").get_attribute("innerHTML")
32+
assert("Sausage" in result)
33+
print 'There is no crash'
34+
finally:
35+
driver.quit()

0 commit comments

Comments
 (0)