don't load the janky test framework that we aren't even using

This commit is contained in:
ansuz 2021-11-22 16:35:35 +05:30
parent cb737d46c4
commit 15cf523144
10 changed files with 57 additions and 41 deletions

View File

@ -554,7 +554,7 @@ define([
return; return;
} }
if (testing) { return void proceed(result); } //if (testing) { return void proceed(result); }
if (!(proxy.curvePrivate && proxy.curvePublic && if (!(proxy.curvePrivate && proxy.curvePublic &&
proxy.edPrivate && proxy.edPublic)) { proxy.edPrivate && proxy.edPublic)) {

View File

@ -3,7 +3,7 @@ define([
'/bower_components/hyperjson/hyperjson.js', '/bower_components/hyperjson/hyperjson.js',
'json.sortify', 'json.sortify',
'/drive/tests.js', '/drive/tests.js',
'/common/test.js', //'/common/test.js',
'/common/common-hash.js', '/common/common-hash.js',
'/common/common-util.js', '/common/common-util.js',
'/common/common-thumbnail.js', '/common/common-thumbnail.js',
@ -18,7 +18,7 @@ define([
'/bower_components/tweetnacl/nacl-fast.min.js', '/bower_components/tweetnacl/nacl-fast.min.js',
'less!/customize/src/less2/pages/page-assert.less', 'less!/customize/src/less2/pages/page-assert.less',
], function ($, Hyperjson, Sortify, Drive, Test, Hash, Util, Thumb, Wire, Flat, MediaTag, Block, ApiConfig, Assertions, h, Messages) { ], function ($, Hyperjson, Sortify, Drive, /*Test,*/ Hash, Util, Thumb, Wire, Flat, MediaTag, Block, ApiConfig, Assertions, h, Messages) {
window.Hyperjson = Hyperjson; window.Hyperjson = Hyperjson;
window.Sortify = Sortify; window.Sortify = Sortify;
var Nacl = window.nacl; var Nacl = window.nacl;
@ -526,11 +526,12 @@ define([
})), })),
])); ]));
/*
if (failed) { if (failed) {
Test.failed(); Test.failed();
} else { } else {
Test.passed(); Test.passed();
} }*/
}); });
}); });

View File

@ -18,14 +18,14 @@ define([
'/lib/tippy/tippy.min.js', '/lib/tippy/tippy.min.js',
'/common/hyperscript.js', '/common/hyperscript.js',
'/customize/loading.js', '/customize/loading.js',
'/common/test.js', //'/common/test.js',
'/lib/jquery-ui/jquery-ui.min.js', // autocomplete widget '/lib/jquery-ui/jquery-ui.min.js', // autocomplete widget
'/bower_components/bootstrap-tokenfield/dist/bootstrap-tokenfield.js', '/bower_components/bootstrap-tokenfield/dist/bootstrap-tokenfield.js',
'css!/lib/tippy/tippy.css', 'css!/lib/tippy/tippy.css',
'css!/lib/jquery-ui/jquery-ui.min.css' 'css!/lib/jquery-ui/jquery-ui.min.css'
], function ($, Messages, Util, Hash, Notifier, AppConfig, ], function ($, Messages, Util, Hash, Notifier, AppConfig,
Alertify, Tippy, h, Loading, Test) { Alertify, Tippy, h, Loading/*, Test */) {
var UI = {}; var UI = {};
/* /*
@ -994,7 +994,7 @@ define([
// Release the test blocker, hopefully every test has been registered. // Release the test blocker, hopefully every test has been registered.
// This test is created in sframe-boot2.js // This test is created in sframe-boot2.js
cb = cb || function () {}; cb = cb || function () {};
if (Test.__ASYNC_BLOCKER__) { Test.__ASYNC_BLOCKER__.pass(); } //if (Test.__ASYNC_BLOCKER__) { Test.__ASYNC_BLOCKER__.pass(); }
var $loading = $('#' + LOADING); var $loading = $('#' + LOADING);
$loading.addClass("cp-loading-hidden"); // Hide the loading screen $loading.addClass("cp-loading-hidden"); // Hide the loading screen

View File

@ -38,8 +38,8 @@ define([
Feedback, Feedback,
Snapshots, Snapshots,
AppConfig, AppConfig,
ChainPad, ChainPad /*,
Test) /* Test */)
{ {
var SaveAs = window.saveAs; var SaveAs = window.saveAs;
@ -87,6 +87,7 @@ define([
var contentContainer = options.contentContainer || var contentContainer = options.contentContainer ||
(function () { throw new Error("contentContainer must be specified"); }()); (function () { throw new Error("contentContainer must be specified"); }());
/*
Test(function (t) { Test(function (t) {
console.log("Here is the test"); console.log("Here is the test");
evOnReady.reg(function () { evOnReady.reg(function () {
@ -96,6 +97,7 @@ define([
}); });
}); });
}); });
*/
var onLocal; var onLocal;
var textContentGetter; var textContentGetter;
@ -779,7 +781,7 @@ define([
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
common.getSframeChannel().onReady(waitFor()); common.getSframeChannel().onReady(waitFor());
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
Test.registerInner(common.getSframeChannel()); //Test.registerInner(common.getSframeChannel());
common.handleNewFile(waitFor); common.handleNewFile(waitFor);
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
cpNfInner = common.startRealtime({ cpNfInner = common.startRealtime({

View File

@ -2,8 +2,8 @@
// Note: This must only be loaded from inside of a sandbox-iframe. // Note: This must only be loaded from inside of a sandbox-iframe.
define([ define([
'/common/requireconfig.js', '/common/requireconfig.js',
'/common/test.js' //'/common/test.js'
], function (RequireConfig, Test) { ], function (RequireConfig /*, Test */) {
require.config(RequireConfig()); require.config(RequireConfig());
// most of CryptPad breaks if you don't support isArray // most of CryptPad breaks if you don't support isArray
@ -29,7 +29,7 @@ define([
// This test is for keeping the testing infrastructure operating // This test is for keeping the testing infrastructure operating
// until all tests have been registered. // until all tests have been registered.
// This test is completed in common-interface.js // This test is completed in common-interface.js
Test(function (t) { Test.__ASYNC_BLOCKER__ = t; }); //Test(function (t) { Test.__ASYNC_BLOCKER__ = t; });
window.onerror = function (e) { window.onerror = function (e) {
if (/requirejs\.org/.test(e)) { if (/requirejs\.org/.test(e)) {

View File

@ -80,7 +80,7 @@ define([
nThen: nThen nThen: nThen
}; };
var AppConfig; var AppConfig;
var Test; //var Test;
var password, newPadPassword, newPadPasswordForce; var password, newPadPassword, newPadPasswordForce;
var initialPathInDrive; var initialPathInDrive;
var burnAfterReading; var burnAfterReading;
@ -113,11 +113,11 @@ define([
'/common/outer/local-store.js', '/common/outer/local-store.js',
'/common/outer/cache-store.js', '/common/outer/cache-store.js',
'/customize/application_config.js', '/customize/application_config.js',
'/common/test.js', //'/common/test.js',
'/common/userObject.js', '/common/userObject.js',
], waitFor(function (_CpNfOuter, _Cryptpad, _Crypto, _Cryptget, _SFrameChannel, ], waitFor(function (_CpNfOuter, _Cryptpad, _Crypto, _Cryptget, _SFrameChannel,
_SecureIframe, _UnsafeIframe, _OOIframe, _Messaging, _Notifier, _Hash, _Util, _Realtime, _Notify, _SecureIframe, _UnsafeIframe, _OOIframe, _Messaging, _Notifier, _Hash, _Util, _Realtime, _Notify,
_Constants, _Feedback, _LocalStore, _Cache, _AppConfig, _Test, _UserObject) { _Constants, _Feedback, _LocalStore, _Cache, _AppConfig, /* _Test,*/ _UserObject) {
CpNfOuter = _CpNfOuter; CpNfOuter = _CpNfOuter;
Cryptpad = _Cryptpad; Cryptpad = _Cryptpad;
Crypto = Utils.Crypto = _Crypto; Crypto = Utils.Crypto = _Crypto;
@ -139,7 +139,7 @@ define([
Utils.Notify = _Notify; Utils.Notify = _Notify;
Utils.currentPad = currentPad; Utils.currentPad = currentPad;
AppConfig = _AppConfig; AppConfig = _AppConfig;
Test = _Test; //Test = _Test;
if (localStorage.CRYPTPAD_URLARGS !== ApiConfig.requireConf.urlArgs) { if (localStorage.CRYPTPAD_URLARGS !== ApiConfig.requireConf.urlArgs) {
console.log("New version, flushing cache"); console.log("New version, flushing cache");
@ -715,7 +715,7 @@ define([
sframeChan.event('EV_LOGOUT'); sframeChan.event('EV_LOGOUT');
}); });
Test.registerOuter(sframeChan); //Test.registerOuter(sframeChan);
Cryptpad.onNewVersionReconnect.reg(function () { Cryptpad.onNewVersionReconnect.reg(function () {
sframeChan.event("EV_NEW_VERSION"); sframeChan.event("EV_NEW_VERSION");
@ -2138,8 +2138,8 @@ define([
Utils.Feedback.reportAppUsage(); Utils.Feedback.reportAppUsage();
if (!realtime && !Test.testing) { return; } if (!realtime /*&& !Test.testing*/) { return; }
if (isNewFile && cfg.useCreationScreen && !Test.testing) { return; } if (isNewFile && cfg.useCreationScreen /* && !Test.testing */) { return; }
if (burnAfterReading) { return; } if (burnAfterReading) { return; }
//if (isNewFile && Utils.LocalStore.isLoggedIn() //if (isNewFile && Utils.LocalStore.isLoggedIn()
// && AppConfig.displayCreationScreen && cfg.useCreationScreen) { return; } // && AppConfig.displayCreationScreen && cfg.useCreationScreen) { return; }

View File

@ -6,10 +6,10 @@ define([
'/common/common-realtime.js', '/common/common-realtime.js',
'/common/common-feedback.js', '/common/common-feedback.js',
'/common/outer/local-store.js', '/common/outer/local-store.js',
'/common/test.js', //'/common/test.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore, Test) { ], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore /*, Test */) {
$(function () { $(function () {
var $checkImport = $('#import-recent'); var $checkImport = $('#import-recent');
if (LocalStore.isLoggedIn()) { if (LocalStore.isLoggedIn()) {
@ -43,17 +43,19 @@ define([
$('button.login').click(); $('button.login').click();
}); });
var test; //var test;
$('button.login').click(function () { $('button.login').click(function () {
var shouldImport = $checkImport[0].checked; var shouldImport = $checkImport[0].checked;
var uname = $uname.val(); var uname = $uname.val();
var passwd = $passwd.val(); var passwd = $passwd.val();
Login.loginOrRegisterUI(uname, passwd, false, shouldImport, Test.testing, function () { Login.loginOrRegisterUI(uname, passwd, false, shouldImport, /*Test.testing */ false, function () {
/*
if (test) { if (test) {
localStorage.clear(); localStorage.clear();
test.pass(); //test.pass();
return true; return true;
} }
*/
}); });
}); });
$('#register').on('click', function () { $('#register').on('click', function () {
@ -64,11 +66,13 @@ define([
window.location.href = '/register/' + hash; window.location.href = '/register/' + hash;
}); });
/*
Test(function (t) { Test(function (t) {
$uname.val('testuser'); $uname.val('testuser');
$passwd.val('testtest'); $passwd.val('testtest');
test = t; test = t;
$('button.login').click(); $('button.login').click();
}); });
*/
}); });
}); });

View File

@ -27,7 +27,7 @@ define([
'/bower_components/hyperjson/hyperjson.js', '/bower_components/hyperjson/hyperjson.js',
'/common/sframe-app-framework.js', '/common/sframe-app-framework.js',
'/common/cursor.js', '/common/cursor.js',
'/common/TypingTests.js', //'/common/TypingTests.js',
'/customize/messages.js', '/customize/messages.js',
'/pad/links.js', '/pad/links.js',
'/pad/comments.js', '/pad/comments.js',
@ -42,8 +42,8 @@ define([
'/common/common-ui-elements.js', '/common/common-ui-elements.js',
'/common/hyperscript.js', '/common/hyperscript.js',
'/bower_components/chainpad/chainpad.dist.js', '/bower_components/chainpad/chainpad.dist.js',
'/customize/application_config.js', //'/customize/application_config.js',
'/common/test.js', //'/common/test.js',
'/lib/diff-dom/diffDOM.js', '/lib/diff-dom/diffDOM.js',
'/bower_components/file-saver/FileSaver.min.js', '/bower_components/file-saver/FileSaver.min.js',
@ -57,7 +57,7 @@ define([
Hyperjson, Hyperjson,
Framework, Framework,
Cursor, Cursor,
TypingTest, //TypingTest,
Messages, Messages,
Links, Links,
Comments, Comments,
@ -71,9 +71,9 @@ define([
UI, UI,
UIElements, UIElements,
h, h,
ChainPad, ChainPad/*,
AppConfig, AppConfig,
Test Test */
) { ) {
var DiffDom = window.diffDOM; var DiffDom = window.diffDOM;
@ -1249,6 +1249,7 @@ define([
// export the typing tests to the window. // export the typing tests to the window.
// call like `test = easyTest()` // call like `test = easyTest()`
// terminate the test like `test.cancel()` // terminate the test like `test.cancel()`
/*
window.easyTest = function() { window.easyTest = function() {
cursor.update(); cursor.update();
//var start = cursor.Range.start; //var start = cursor.Range.start;
@ -1257,6 +1258,7 @@ define([
framework.localChange(); framework.localChange();
return test; return test;
}; };
*/
// Fix the scrollbar if it's reset when clicking on a button (firefox only?) // Fix the scrollbar if it's reset when clicking on a button (firefox only?)
@ -1509,6 +1511,7 @@ define([
Links.init(Ckeditor, editor, openLinkSetting); Links.init(Ckeditor, editor, openLinkSetting);
require(['/pad/csp.js'], waitFor()); require(['/pad/csp.js'], waitFor());
}).nThen(function( /*waitFor*/ ) { }).nThen(function( /*waitFor*/ ) {
/*
function launchAnchorTest(test) { function launchAnchorTest(test) {
// -------- anchor test: make sure the exported anchor contains <a name="..."> ------- // -------- anchor test: make sure the exported anchor contains <a name="..."> -------
@ -1572,16 +1575,17 @@ define([
if (editor.status === "ready") { if (editor.status === "ready") {
window.clearInterval(intervalHandle); window.clearInterval(intervalHandle);
console.log("Editor is ready."); console.log("Editor is ready.");
tryAndTestExport(); tryAndTestExport(); // XXX
} else { } else {
console.log("Waiting for editor to be ready."); console.log("Waiting for editor to be ready.");
} }
}, 100); }, 100);
} }
/*
Test(function(test) { Test(function(test) {
launchAnchorTest(test); launchAnchorTest(test);
}); });*/
andThen2(editor, Ckeditor, framework); andThen2(editor, Ckeditor, framework);
}); });
}; };

View File

@ -50,8 +50,8 @@ define([
h, h,
Messages, Messages,
SFCodeMirror, SFCodeMirror,
CMeditor, CMeditor/*,
Test) Test*/)
{ {
var saveAs = window.saveAs; var saveAs = window.saveAs;
@ -1010,6 +1010,7 @@ define([
publish(true); publish(true);
} }
/*
var passIfOk = function (t) { var passIfOk = function (t) {
t.assert($('#cp-app-poll-description-published').text().indexOf( t.assert($('#cp-app-poll-description-published').text().indexOf(
"Content for the description") === 0); "Content for the description") === 0);
@ -1023,7 +1024,9 @@ define([
t.assert($('input[value="Meeee"]').length === 1); t.assert($('input[value="Meeee"]').length === 1);
t.pass(); t.pass();
}; };
*/
/*
if (!APP.readOnly) { if (!APP.readOnly) {
console.log("Here is the test"); console.log("Here is the test");
Test(function (t) { Test(function (t) {
@ -1075,13 +1078,14 @@ define([
setTimeout(waitFor()); setTimeout(waitFor());
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
APP.rt.realtime.onSettle(waitFor()); APP.rt.realtime.onSettle(waitFor());
}).nThen(function (/*waitFor*/) { }).nThen(function (/*waitFor*/ /*) {
passIfOk(t); passIfOk(t);
}); });
}); });
} else { } else {
Test(passIfOk); Test(passIfOk);
} }
*/
// No need for onLocal in openPadChat because in poll, we listen for metadata changes // No need for onLocal in openPadChat because in poll, we listen for metadata changes
// and save them everytime. // and save them everytime.
@ -1315,7 +1319,7 @@ define([
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
common.handleNewFile(waitFor); common.handleNewFile(waitFor);
}).nThen(function (/* waitFor */) { }).nThen(function (/* waitFor */) {
Test.registerInner(common.getSframeChannel()); //Test.registerInner(common.getSframeChannel());
var metadataMgr = common.getMetadataMgr(); var metadataMgr = common.getMetadataMgr();
metadataMgr.setDegraded(false); // FIXME degarded mode unsupported (no cursor channel) metadataMgr.setDegraded(false); // FIXME degarded mode unsupported (no cursor channel)

View File

@ -2,7 +2,7 @@ define([
'jquery', 'jquery',
'/customize/login.js', '/customize/login.js',
'/common/cryptpad-common.js', '/common/cryptpad-common.js',
'/common/test.js', //'/common/test.js',
'/common/common-credential.js', '/common/common-credential.js',
'/common/common-interface.js', '/common/common-interface.js',
'/common/common-util.js', '/common/common-util.js',
@ -13,7 +13,7 @@ define([
'/common/hyperscript.js', '/common/hyperscript.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
], function ($, Login, Cryptpad, Test, Cred, UI, Util, Realtime, Constants, Feedback, LocalStore, h) { ], function ($, Login, Cryptpad, /*Test,*/ Cred, UI, Util, Realtime, Constants, Feedback, LocalStore, h) {
var Messages = Cryptpad.Messages; var Messages = Cryptpad.Messages;
$(function () { $(function () {
if (LocalStore.isLoggedIn()) { if (LocalStore.isLoggedIn()) {
@ -111,7 +111,7 @@ define([
function (yes) { function (yes) {
if (!yes) { return; } if (!yes) { return; }
Login.loginOrRegisterUI(uname, passwd, true, shouldImport, Test.testing, function () { Login.loginOrRegisterUI(uname, passwd, true, shouldImport, false /*Test.testing*/, function () {
if (test) { if (test) {
localStorage.clear(); localStorage.clear();
test.pass(); test.pass();
@ -149,6 +149,7 @@ define([
} }
}); });
/*
Test(function (t) { Test(function (t) {
test = t; test = t;
$uname.val('testuser'); $uname.val('testuser');
@ -161,6 +162,6 @@ define([
window.setTimeout(function () { window.setTimeout(function () {
UI.findOKButton().click(); UI.findOKButton().click();
}, 1000); }, 1000);
}); }); */
}); });
}); });