diff --git a/src/tests/frontend/helper/multipleUsers.js b/src/tests/frontend/helper/multipleUsers.js
index 08ed50217..d34676a66 100644
--- a/src/tests/frontend/helper/multipleUsers.js
+++ b/src/tests/frontend/helper/multipleUsers.js
@@ -1,47 +1,39 @@
'use strict';
helper.multipleUsers = {
- thisUser: null,
- otherUser: null,
+ _user0: null,
+ _user1: null,
// open the same pad on different frames (allows concurrent editions to pad)
async init() {
- // do some cleanup, in case any of the tests failed on the previous run
- const currentToken = _createTokenForCurrentUser();
- const otherToken = _createTokenForAnotherUser();
- _removeExistingTokensFromCookie();
-
- this.thisUser = {
+ this._user0 = {
$frame: $('#iframe-container iframe'),
- token: currentToken,
+ token: getToken(),
// we'll switch between pads, need to store current values of helper.pad*
// to be able to restore those values later
padChrome$: helper.padChrome$,
padOuter$: helper.padOuter$,
padInner$: helper.padInner$,
};
-
- this.otherUser = {
- token: otherToken,
- };
-
+ this._user1 = {};
+ // Force generation of a new token.
+ clearToken();
// need to perform as the other user, otherwise we'll get the userdup error message
- await this.performAsOtherUser(this._createFrameForOtherUser.bind(this));
+ await this.performAsOtherUser(this._createUser1Frame.bind(this));
},
async performAsOtherUser(action) {
- _startActingLike(this.otherUser);
+ startActingLike(this._user1);
await action();
- // go back to initial state when we're done
- _startActingLike(this.thisUser);
+ startActingLike(this._user0);
},
close() {
- this.thisUser.$frame.attr('style', ''); // make the default ocopy the full height
- this.otherUser.$frame.remove();
+ this._user0.$frame.attr('style', ''); // make the default ocopy the full height
+ this._user1.$frame.remove();
},
- async _loadJQueryCodeForOtherFrame() {
+ async _loadJQueryForUser1Frame() {
const code = await $.get('/static/js/jquery.js');
// make sure we don't override existing jquery
@@ -49,49 +41,53 @@ helper.multipleUsers = {
const sendkeysCode = await $.get('/tests/frontend/lib/sendkeys.js');
const codesToLoad = [jQueryCode, sendkeysCode];
- this.otherUser.padChrome$ = _getFrameJQuery(codesToLoad, this.otherUser.$frame);
- this.otherUser.padOuter$ =
- _getFrameJQuery(codesToLoad, this.otherUser.padChrome$('iframe[name="ace_outer"]'));
- this.otherUser.padInner$ =
- _getFrameJQuery(codesToLoad, this.otherUser.padOuter$('iframe[name="ace_inner"]'));
+ this._user1.padChrome$ = getFrameJQuery(codesToLoad, this._user1.$frame);
+ this._user1.padOuter$ =
+ getFrameJQuery(codesToLoad, this._user1.padChrome$('iframe[name="ace_outer"]'));
+ this._user1.padInner$ =
+ getFrameJQuery(codesToLoad, this._user1.padOuter$('iframe[name="ace_inner"]'));
// update helper vars now that they are available
- helper.padChrome$ = this.otherUser.padChrome$;
- helper.padOuter$ = this.otherUser.padOuter$;
- helper.padInner$ = this.otherUser.padInner$;
+ helper.padChrome$ = this._user1.padChrome$;
+ helper.padOuter$ = this._user1.padOuter$;
+ helper.padInner$ = this._user1.padInner$;
},
- async _createFrameForOtherUser() {
+ async _createUser1Frame() {
// create the iframe
- const padUrl = this.thisUser.$frame.attr('src');
- this.otherUser.$frame = $(``);
+ const padUrl = this._user0.$frame.attr('src');
+ this._user1.$frame = $('