diff --git a/src/tests/frontend/helper.js b/src/tests/frontend/helper.js index dbb5d4b2d..953145773 100644 --- a/src/tests/frontend/helper.js +++ b/src/tests/frontend/helper.js @@ -278,7 +278,7 @@ const helper = {}; helper.withFastCommit = async (fn) => { const incorp = () => helper.padChrome$.padeditor.ace.callWithAce( (ace) => ace.ace_inCallStackIfNecessary('helper.edit', () => ace.ace_fastIncorp())); - const cc = helper.padChrome$.window.pad.collabClient; + const cc = helper.padChrome$.window.require('ep_etherpad-lite/static/js/pad').pad.collabClient; const {commitDelay} = cc; cc.commitDelay = 0; try { diff --git a/src/tests/frontend/helper/methods.js b/src/tests/frontend/helper/methods.js index b828cd601..cd94ba7aa 100644 --- a/src/tests/frontend/helper/methods.js +++ b/src/tests/frontend/helper/methods.js @@ -5,7 +5,8 @@ * that are visible in tests */ helper.spyOnSocketIO = () => { - helper.contentWindow().pad.socket.on('message', (msg) => { + const {pad} = helper.contentWindow().require('ep_etherpad-lite/static/js/pad'); + pad.socket.on('message', (msg) => { if (msg.type !== 'COLLABROOM') return; if (msg.data.type === 'ACCEPT_COMMIT') { helper.commits.push(msg); diff --git a/src/tests/frontend/specs/collab_client.js b/src/tests/frontend/specs/collab_client.js index 307e37908..052f411eb 100644 --- a/src/tests/frontend/specs/collab_client.js +++ b/src/tests/frontend/specs/collab_client.js @@ -4,6 +4,8 @@ describe('Messages in the COLLABROOM', function () { const user1Text = 'text created by user 1'; const user2Text = 'text created by user 2'; + const getPadObj = () => helper.padChrome$.window.require('ep_etherpad-lite/static/js/pad').pad; + const triggerEvent = (eventName) => { const event = new helper.padInner$.Event(eventName); helper.padInner$('#innerdocbody').trigger(event); @@ -36,7 +38,7 @@ describe('Messages in the COLLABROOM', function () { // User 1 starts sending a change to the server. let sendStarted; const finishSend = (() => { - const socketJsonObj = helper.padChrome$.window.pad.socket.json; + const socketJsonObj = getPadObj().socket.json; const sendBackup = socketJsonObj.send; let startSend; sendStarted = new Promise((resolve) => { startSend = resolve; }); @@ -60,7 +62,7 @@ describe('Messages in the COLLABROOM', function () { // User 1 receives a change from user 2. (User 1 will not incorporate the change until the // composition is completed.) const user2ChangeArrivedAtUser1 = new Promise((resolve) => { - const cc = helper.padChrome$.window.pad.collabClient; + const cc = getPadObj().collabClient; const origHM = cc.handleMessageFromServer; cc.handleMessageFromServer = (evt) => { if (evt.type === 'COLLABROOM' && evt.data.type === 'NEW_CHANGES') { diff --git a/src/tests/frontend/specs/pad_modal.js b/src/tests/frontend/specs/pad_modal.js index 735abe8c0..98fe4544c 100644 --- a/src/tests/frontend/specs/pad_modal.js +++ b/src/tests/frontend/specs/pad_modal.js @@ -8,7 +8,8 @@ describe('Pad modal', function () { await helper.aNewPad(); // force a "slowcommit" error - helper.padChrome$.window.pad.handleChannelStateChange('DISCONNECTED', 'slowcommit'); + const {pad} = helper.padChrome$.window.require('ep_etherpad-lite/static/js/pad'); + pad.handleChannelStateChange('DISCONNECTED', 'slowcommit'); // wait for modal to be displayed const $modal = helper.padChrome$(MODAL_SELECTOR);