From 8b7f7d49c000891c5f9f18cd287e3d961f9c246f Mon Sep 17 00:00:00 2001 From: Luiza Pagliari Date: Sat, 1 Sep 2018 17:53:46 -0300 Subject: [PATCH] tests: make sure author is switched on authorship test Original implementation of authorship test assumed a simple pad reload would switch the author -- and it actually did on Chrome. But other browsers might keep the author id on cookie. To force the author switch, expire the cookie before reloading the pad. Fixes: #3435 --- tests/frontend/specs/authorship_of_editions.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/frontend/specs/authorship_of_editions.js b/tests/frontend/specs/authorship_of_editions.js index 3bea2c46e..0c173e962 100644 --- a/tests/frontend/specs/authorship_of_editions.js +++ b/tests/frontend/specs/authorship_of_editions.js @@ -41,6 +41,10 @@ describe('author of pad edition', function() { // Reload pad, to make changes as a second user. Need a timeout here to make sure // all changes were saved before reloading setTimeout(function() { + // Expire cookie, so author is changed after reloading the pad. + // See https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie#Example_4_Reset_the_previous_cookie + helper.padChrome$.document.cookie = 'token=foo;expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'; + helper.newPad(done, padId); }, 1000); });