Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Add test for issue #5943 #6398

Merged
merged 1 commit into from
Jan 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Program: 5DBat - by BlatSoft
// 04/2017 version: 0.1.0
// dbcontrol.js
// This file used to control all database functions
// - Called from end of start.html/running.html

"use strict";

var dblite = require('dblite');

var dbPath = 'dogs.db';

// ********************** Define SQLite bin path **************************
//dblite.bin = "node_modules/sqlite3/sqlite3"; // if not specified then default install will be used if exists (/usr/local/bin/sqlite3)


//######################################################################################################
//# DB Connect (dblite)
//######################################################################################################
/**
* Connect Database
* @param dbPath
*
*/
//var db = function connectDb(dbPath) {
var db = dblite(dbPath); // creates if no exist

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"app_name": "5943",
"name": "issue5943-mac-dblite-module-with-node8-crash",
"description": "Crash with nwjs 0.23.0 with node 8.0.0pre",
"single-instance": true,
"version": "0.1.0",
"chromium-args": "--enable-logging",
"main": "start.html",
"window": {
"resizable": true,
"visible": true,
"exe_icon": "",
"icon": "",
"width": 1400,
"show_in_taskbar": true,
"always_on_top": false,
"mac_icon": "",
"title": "dblitekrash0230",
"height": 850,
"show": true,
"fullscreen": false
},
"webkit": {
"plugin": true
},
"webview": {
"partitions": [
{
"name": "trusted",
"accessible_resources": [
"<all_urls>"
]
}
]
},
"additional_trust_anchors": [
""
],
"dependencies": {
"dblite": "^0.7.9"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
// Program: game - by BlatSoft
// 05/2017 version: 0.7.0
// start.html
// This page is first screen on game start - used to set up game/teams/etc ready for play
// - Called from package.json
-->
<head>
<title>issue5943-mac-dblite-module-with-node8-crash</title>
<script type="text/javascript" src="dbcontrol.js" charset="utf-8"></script>

</head>

<body>

<div id="head">
<h1>dblitekrash0230node8</h1>
<div id="versions">
NWjs version -
<script>
document.write(process.versions['nw']);
</script><br /> IO.js/node.js version -
<script>
document.write(process.versions['node']);
</script><br /> Chromium version -
<script>
document.write(process.versions['chromium']);
</script><br />
</div>

</div>
<div id="shell"></div>

<!-- End of HTML ********************************** -->

<script type="text/javascript">

var show = ''; // = new Array();
db.query('SELECT rowid, Cap, Dog FROM ' + 'Australia',['id', 'cap', 'dog'],
// once retrieved
function(rows) {
for (var i = 0, len = rows.length; i < len; i++) {
var str = rows[i].dog; // used for populating optionlist
console.log(str);
show = show + str + '<br />';
}
document.getElementById('shell').innerHTML = show;
}
);
</script>

</body>
</html>

35 changes: 35 additions & 0 deletions test/sanity/issue5943-mac-dblite-module-with-node8-crash/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import time
import os
import shutil
import platform
import sys
import subprocess

if platform.system() != 'Darwin':
print 'Skipped for non Mac platform'
sys.exit(0)

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

chrome_options = Options()
testdir = os.path.dirname(os.path.abspath(__file__))
chrome_options.add_argument("nwapp=" + testdir)
node_module = os.path.join(testdir, "node_modules")
os.chdir(testdir)

install_native_modules()

driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options)
driver.implicitly_wait(2)
try:
print driver.current_url
print "select data from table Australia"
result = driver.find_element_by_id("shell").get_attribute("innerHTML")
assert("Sausage" in result)
print 'There is no crash'
finally:
driver.quit()