mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-01-17 17:30:47 +00:00
added nightwatch web tests
This commit is contained in:
parent
187bcfc2e2
commit
f3138f9b57
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,4 +5,5 @@ local
|
|||||||
release
|
release
|
||||||
gen
|
gen
|
||||||
test/output
|
test/output
|
||||||
|
tests_output/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
4
Makefile
4
Makefile
@ -23,12 +23,12 @@ lint:
|
|||||||
|
|
||||||
web:
|
web:
|
||||||
ifconfig | grep inet
|
ifconfig | grep inet
|
||||||
python3 scripts/serveit.py 2>> http.out
|
python3 scripts/serveit.py 2>> /dev/null #http.out
|
||||||
|
|
||||||
tsweb:
|
tsweb:
|
||||||
ifconfig | grep inet
|
ifconfig | grep inet
|
||||||
$(TSC) -w &
|
$(TSC) -w &
|
||||||
python3 scripts/serveit.py 2>> http.out
|
python3 scripts/serveit.py 2>> /dev/null #http.out
|
||||||
|
|
||||||
astrolibre.b64.txt: astrolibre.rom
|
astrolibre.b64.txt: astrolibre.rom
|
||||||
lzg -9 $< | base64 -w 0 > $@
|
lzg -9 $< | base64 -w 0 > $@
|
||||||
|
23
nightwatch.json
Normal file
23
nightwatch.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"src_folders" : ["test/web"],
|
||||||
|
|
||||||
|
"webdriver" : {
|
||||||
|
"start_process": true,
|
||||||
|
"server_path": "node_modules/.bin/chromedriver",
|
||||||
|
"port": 9515
|
||||||
|
},
|
||||||
|
|
||||||
|
"test_settings" : {
|
||||||
|
"default" : {
|
||||||
|
"desiredCapabilities": {
|
||||||
|
"browserName": "chrome"
|
||||||
|
},
|
||||||
|
"screenshots" : {
|
||||||
|
"enabled" : "true",
|
||||||
|
"path" : "",
|
||||||
|
"on_failure": true,
|
||||||
|
"on_error": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
937
package-lock.json
generated
937
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -15,11 +15,13 @@
|
|||||||
"@types/jquery": "^3.3.29",
|
"@types/jquery": "^3.3.29",
|
||||||
"atob": "^2.1.x",
|
"atob": "^2.1.x",
|
||||||
"btoa": "^1.2.x",
|
"btoa": "^1.2.x",
|
||||||
|
"chromedriver": "^76.0.1",
|
||||||
"clipboard": "^2.0.4",
|
"clipboard": "^2.0.4",
|
||||||
"jquery": "^3.4.1",
|
"jquery": "^3.4.1",
|
||||||
"jsdom": "^12.2.0",
|
"jsdom": "^12.2.0",
|
||||||
"lzg": "^1.0.x",
|
"lzg": "^1.0.x",
|
||||||
"mocha": "^5.2.x",
|
"mocha": "^5.2.x",
|
||||||
|
"nightwatch": "^1.2.1",
|
||||||
"octokat": "^0.10.0",
|
"octokat": "^0.10.0",
|
||||||
"pngjs": "^3.3.3",
|
"pngjs": "^3.3.3",
|
||||||
"typescript": "^3.6.2",
|
"typescript": "^3.6.2",
|
||||||
@ -36,6 +38,7 @@
|
|||||||
"test": "npm run test-node",
|
"test": "npm run test-node",
|
||||||
"test-one": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000",
|
"test-one": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000",
|
||||||
"test-node": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 test/cli",
|
"test-node": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 test/cli",
|
||||||
|
"test-web": "NODE_PATH=$(pwd) nightwatch test/web",
|
||||||
"test-worker": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 test/cli/testworker.js",
|
"test-worker": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 test/cli/testworker.js",
|
||||||
"test-platforms": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 test/cli/testplatforms.js",
|
"test-platforms": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 test/cli/testplatforms.js",
|
||||||
"test-profile": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 --prof test/cli"
|
"test-profile": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 --prof test/cli"
|
||||||
|
@ -173,6 +173,7 @@ function refreshWindowList() {
|
|||||||
var a = document.createElement("a");
|
var a = document.createElement("a");
|
||||||
a.setAttribute("class", "dropdown-item");
|
a.setAttribute("class", "dropdown-item");
|
||||||
a.setAttribute("href", "#");
|
a.setAttribute("href", "#");
|
||||||
|
a.setAttribute("data-wndid", id);
|
||||||
if (id == projectWindows.getActiveID())
|
if (id == projectWindows.getActiveID())
|
||||||
$(a).addClass("dropdown-item-checked");
|
$(a).addClass("dropdown-item-checked");
|
||||||
a.appendChild(document.createTextNode(name));
|
a.appendChild(document.createTextNode(name));
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
|
|
||||||
function assert(b, msg) {
|
|
||||||
if (!b) { throw new Error(msg); }
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('Test VCS emulator', function() {
|
|
||||||
var platform = new VCSPlatform();
|
|
||||||
it('Should start', function(done) {
|
|
||||||
platform.start();
|
|
||||||
assert(!platform.isRunning());
|
|
||||||
// TODO: more testing
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Test Space Invaders emulator', function() {
|
|
||||||
var platform = new Midway8080BWPlatform($('#emulator')[0]);
|
|
||||||
it('Should start', function(done) {
|
|
||||||
platform.start();
|
|
||||||
assert(!platform.isRunning());
|
|
||||||
platform.resume();
|
|
||||||
assert(platform.isRunning());
|
|
||||||
// TODO: more testing
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
91
test/web/testallpresets.js
Normal file
91
test/web/testallpresets.js
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
|
||||||
|
//var IDEURL = 'https://8bitworkshop.com/dev/';
|
||||||
|
var IDEURL = 'http://localhost:8000/';
|
||||||
|
|
||||||
|
function testCompile(browser, platform_id, platform_name) {
|
||||||
|
// wait for page to load
|
||||||
|
browser
|
||||||
|
.waitForElementVisible('body')
|
||||||
|
.waitForElementVisible('#booksMenuButton')
|
||||||
|
.waitForElementVisible('#preset_select')
|
||||||
|
.assert.containsText('#platformsMenuButton', platform_name)
|
||||||
|
.waitForElementNotVisible('#compile_spinner')
|
||||||
|
.waitForElementNotVisible('#error_alert')
|
||||||
|
.waitForElementNotPresent('.bootbox-alert');
|
||||||
|
|
||||||
|
if (platform_id == 'vcs') {
|
||||||
|
browser.waitForElementVisible('#javatari-screen');
|
||||||
|
} else {
|
||||||
|
browser.waitForElementVisible('#emuscreen');
|
||||||
|
browser.waitForElementVisible('.emuvideo');
|
||||||
|
browser.waitForElementVisible('a[data-wndid="#memmap"]');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function testDebugging(browser) {
|
||||||
|
// do some debugging
|
||||||
|
browser
|
||||||
|
.waitForElementVisible('#dbg_go.btn_active')
|
||||||
|
.click('#dbg_step')
|
||||||
|
.waitForElementVisible('#dbg_step.btn_stopped')
|
||||||
|
.waitForElementVisible('#mem_info')
|
||||||
|
.click('#dbg_reset')
|
||||||
|
.waitForElementVisible('#dbg_reset.btn_stopped')
|
||||||
|
.waitForElementVisible('#mem_info')
|
||||||
|
.click('#dbg_tovsync')
|
||||||
|
.waitForElementVisible('#dbg_tovsync.btn_stopped')
|
||||||
|
.waitForElementVisible('#mem_info')
|
||||||
|
.click('#dbg_go')
|
||||||
|
.waitForElementVisible('#dbg_go.btn_active')
|
||||||
|
.waitForElementNotVisible('#mem_info');
|
||||||
|
/*
|
||||||
|
.click('a[data-wndid="#disasm"]')
|
||||||
|
.click('a[data-wndid="#memory"]')
|
||||||
|
.click('a[data-wndid="#memmap"]')
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
function testTourDialog(browser) {
|
||||||
|
// tour dialog dismiss
|
||||||
|
browser
|
||||||
|
.waitForElementVisible('#step-0')
|
||||||
|
.click('button[data-role="end"]');
|
||||||
|
}
|
||||||
|
|
||||||
|
function testPlatform(exports, platform_id, platform_name, numPresets) {
|
||||||
|
exports['load_'+platform_id] = function(browser) {
|
||||||
|
browser.url(IDEURL + '?platform='+platform_id+"&file=NOEXIST");
|
||||||
|
browser.waitForElementVisible('.bootbox-alert'); // test unknown file alert (TODO: check text)
|
||||||
|
browser.waitForElementNotVisible('#error_alert'); // but it will build anyway
|
||||||
|
testTourDialog(browser);
|
||||||
|
}
|
||||||
|
for (let i=1; i<=numPresets; i++) {
|
||||||
|
exports['load_'+platform_id+'_'+i] = function(browser) {
|
||||||
|
browser.click('#preset_select option:nth-child('+(i+1)+')');
|
||||||
|
testCompile(browser, platform_id, platform_name);
|
||||||
|
browser.getTitle( (title) => { console.log(title); } );
|
||||||
|
testDebugging(browser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports['end_'+platform_id] = function(browser) {
|
||||||
|
browser.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
|
||||||
|
testPlatform(this, 'vcs', 'Atari 2600', 35);
|
||||||
|
testPlatform(this, 'nes', 'NES', 30);
|
||||||
|
testPlatform(this, 'vicdual', 'VIC Dual', 7);
|
||||||
|
testPlatform(this, 'mw8080bw', 'Midway 8080', 3);
|
||||||
|
testPlatform(this, 'galaxian-scramble', 'Galaxian/Scramble', 3);
|
||||||
|
testPlatform(this, 'vector-z80color', 'Atari Color Vector (Z80)', 3);
|
||||||
|
testPlatform(this, 'williams-z80', 'Williams (Z80)', 3);
|
||||||
|
// TODO testPlatform(this, 'sound_williams-z80', 'Williams Sound (Z80)', 1);
|
||||||
|
testPlatform(this, 'coleco', 'ColecoVision', 12);
|
||||||
|
testPlatform(this, 'sms-sg1000-libcv', 'Sega SG-1000', 3);
|
||||||
|
testPlatform(this, 'sms-sms-libcv', 'Sega Master System', 2);
|
||||||
|
testPlatform(this, 'atari7800', 'Atari 7800', 1);
|
||||||
|
testPlatform(this, 'astrocade', 'Bally Astrocade', 12);
|
||||||
|
testPlatform(this, 'apple2', 'Apple ][+', 10);
|
||||||
|
|
@ -17,6 +17,7 @@
|
|||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/**/*.ts",
|
"./src/**/*.ts",
|
||||||
|
"./test/**/*.ts",
|
||||||
"./localForage/typings/*.ts"
|
"./localForage/typings/*.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user