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 tests which convert from issues #6356

Closed
wants to merge 1 commit into from
Closed
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
24 changes: 24 additions & 0 deletions test/sanity/issue5882-debugging-tools-crash/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using node.js <script>document.write(process.version)</script>.
<script type="text/javascript">
var request = require('request');
setInterval(function() {
request({
url: 'http://www.bing.com',
method: 'get'
}, function(err, response, body) {
debugger;
if (err) return console.error(err.stack); // line 16
console.log(response, body);
});
}, 3 * 1000);
nw.Window.get().showDevTools()
</script>
</body>
</html>
7 changes: 7 additions & 0 deletions test/sanity/issue5882-debugging-tools-crash/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "issue5882-nw-crash-with-debugging-tools",
"main": "index.html",
"dependencies": {
"request": "^2.83.0"
}
}
72 changes: 72 additions & 0 deletions test/sanity/issue5882-debugging-tools-crash/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import time
import os
import shutil
import subprocess
import platform
import sys

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

from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.select import Select

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)

try:
shutil.rmtree(node_module)
except:
pass

assert(False == os.path.isdir(node_module))

if platform.system() == "Windows":
subprocess.call(["npm", "install", "request"], shell=True)
else:
subprocess.call(["npm", "install", "request"])

assert(os.path.isdir(node_module))

def clickResume():
if platform.system() != "Darwin":
ActionChains(driver).key_down(Keys.CONTROL).send_keys("\\").key_up(Keys.CONTROL).perform()
else:
ActionChains(driver).key_down(Keys.COMMAND).send_keys("\\").key_up(Keys.COMMAND).perform()

driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options, service_log_path="log", service_args=["--verbose"])
driver.implicitly_wait(2)
try:
switch_to_app(driver)
print driver.current_url
print 'wait for devtools open'
wait_window_handles(driver, 2)
print 'switch to devtools'
switch_to_devtools(driver)
print "click Sources panel"
time.sleep(1)
devtools_click_tab(driver, 'sources')
print 'start to debug line 16 via breakpoint'
for i in range(10):
print "click Resume script execution button: %s" % i
while i < 10:
try:
clickResume()
break
except selenium.common.exceptions.WebDriverException:
pass
time.sleep(1)
i = i + 1
if i >= 10:
raise Exception('Timeout when waiting for clicking resume button')
assert(len(driver.window_handles) is 2)
print 'There is no crash'
finally:
driver.quit()
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": "game",
"name": "dblitekrash0230",
"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>issue5980-aws-sdk-embedded-youtobe-vedio-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>

39 changes: 39 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,39 @@
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)

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)

try:
shutil.rmtree(node_module)
except:
pass

assert(False == os.path.isdir(node_module))
subprocess.call(["npm", "install", "dblite"])
assert(os.path.isdir(node_module))

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()
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>issue5980-aws-sdk-embedded-youtobe-vedio-crash</title>
</head>
<body>
<iframe src="https://www.youtube.com/embed/C0DPdy98e4c"></iframe>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const sdk = require('aws-sdk');

nw.Window.open(`index.html`);

Loading