Three of the four tests fail if `settings.allowAnyoneToImport` is
false. The fourth ("tries to import Plain Text to a pad that does not
exist") isn't particularly useful when `settings.allowAnyoneToImport`
is false: That test tests an import failure mode, and when
`settings.allowAnyoneToImport` is false the failure could be caused by
that instead of the expected cause.
This makes it possible for reverse proxies to transform 403 errors
into something like "upgrade to a premium account to access this
pad".
Also add some webaccess tests.
* `src/node/server.js` can now be run as a script (for normal
operation) or imported as a module (for tests).
* Move shutdown actions to `src/node/server.js` to be close to the
startup actions.
* Put startup and shutdown in functions so that tests can call them.
* Use `await` instead of callbacks.
* Block until the HTTP server is listening to avoid races during
test startup.
* Add a new `shutdown` hook.
* Use the `shutdown` hook to:
* close the HTTP server
* call `end()` on the stats collection to cancel its timers
* call `terminate()` on the Threads.Pool to stop the workers
* Exit with exit code 0 (instead of 1) on SIGTERM.
* Export the HTTP server so that tests can get the HTTP server's
port via `server.address().port` when `settings.port` is 0.
Before this change, `promises.timesLimit()` created `concurrency - 1`
too many promises. The only users of this function use a concurrency
of 500, so this meant that 499 extra promises were created each time
it was used. The bug didn't affect correctness, but it did result in a
large number of unnecessary database operations whenever a pad was
deleted. This change fixes that bug.
Also:
* Convert the function to async and have it resolve after all of the
created promises are resolved.
* Reject concurrency of 0 (unless total is 0).
* Document the function.
* Add tests.
New feature to copy a pad without copying entire history. This is useful to perform a low CPU intensive operation while still copying current pad state.
Before, a malicious user could bypass authorization restrictions
imposed by the authorize hook:
* Step 1: Fetch any resource that the malicious user is authorized to
access (e.g., static content).
* Step 2: Use the signed express_sid cookie generated in step 1 to
create a socket.io connection.
* Step 3: Perform the CLIENT_READY handshake for the desired pad.
* Step 4: Profit!
Now the authorization decision made by the authorize hook is
propagated to SecurityManager so that it can approve or reject
socket.io messages as appropriate.
This also sets up future support for per-user read-only and
modify-only (no create) authorization levels.
* remote_runner.js: fix drain call (cf.
https://github.com/caolan/async/blob/master/CHANGELOG.md#breaking-changes)
* dont wait 30 seconds after remote_runner.js returned
* timeout frontend tests after 9.5 minutes to prevent travis from silently stop them
* log when not all tests finished
* prevent killTimeout to happen after last test
* log server messages to console
* remote_runner will take some time to setup sl, so this second is not necessary
* dont write to global mocha variable
* mochas `test end` event is not called when a before/beforeEach-hooks
failed, so we should only use pass/fail/pending-hooks for logging.
also some cruft removed
* pass test in `pending`-event handler
* remove some more cruft in tests/frontend/runner.js
* frontend tests: clarify why stats.tests and total differ
* move killTimeout to pass/fail/pending instead of `test end` to guarantee that it is run
* delete killTimeout on test end to prevent misleading log message
* unused variable
* fix regex
* unlikely edge case
* ensure `allowed test duration exceeded` message is printed for the last runner
* get rid of jquery.iframe.js, currently no support for IE<9
* retry up to 3 times when pad could not be loaded
* Call the logging code in stopSauce in a callback for `browser.quit()`.
This should fix cases like
https://app.saucelabs.com/tests/cb8225375d274cbcbb091309f5466cfd
Travis received all the logs and remote_runner.js exits, but there never
is a DELETE command for webdriver.
* comment out broken ones for now with notes to fix
* changes to scroll tests to make them pass but afaik everything is broken due to browser restrictions RE sending keypresses so you cant trust these tests
Includes settings
Includes i18n
Includes a nice notification
Disconnects on rate limit
Includes feeding into metrics/stats
Include console warn to server console.
Just final bits of test coverage for import/export of LibreOffice. It turns out Travis by default installs an old LO that doesn't support PDF import. To remedy that I use the LO PPA and also strict install the PDF import support.
Still to do in a future date is check LO exported contents includes expected strings, for now it just checks output length looks sane.
* update sauce connect proxy to 4.6.2
* include tunnelIdentifier in webdriver capabilities
* add platform in console output
* include extendedDebugging in webdriver capabilities to get browser console logs
* informative: add comment for timeouts during tests
* When the killTimeout in runner.js stops the tests, it's an failure.
* do not wait a hardcoded amount of 10 seconds for files to be minified.
this setup time is not included in the total time of the first test.
* run 4 browsers at a time during frontend testing
* try to include test.speed in output
* time is in test.duration, not test.speed
* frontend tests: 6 sessions in parallel, add OSX 10.14-safari and Windows7-firefox, pin all browsers instead of use latest
* typo
1. Introduce contentcollector.js backend tests
1. Fix issue with OL LI items not being properly numbered after import
1. Fix issue with nested OL LI items being improperly numbered on export
1. Fix issue with new lines not being introduced after lists in on import #3961
1. Sanitize HTML on the way in (import)
1. Fix ExportHTML CSS because it needs to support OL > LI > OL not OL > OL [The latter being the correct format]
1. Fix backend tests.
* Remove npm cache from Travis, this was causing a world of pain.
* Remove the broken line attribute tests.
* Do a HTTP get against Etherpad to begin minification.
* Wait 10 seconds after minification before running tests.
Old check is jquery is(':visible') no longer works because we use css property visibility hidden (for animation to work properly), and not display none
In the following commits Sebastian is going to edit three files. This change is
necessary make evident what he is going to modify, because some of them are old
vendorized libraries whose history we might want to reconstruct.
No functional changes.
Command:
sed --in-place 's/[[:space:]]*$//' src/static/js/farbtastic.js
sed --in-place 's/[[:space:]]*$//' src/static/js/gritter.js
sed --in-place 's/[[:space:]]*$//' tests/frontend/specs/change_user_color.js
With commit 44186ed (tests: remove loadSettings.js for backend tests.)
the loading of the settings in backendtests changed. One test spec
was not updated.
The old loadSettings.js was a way of customizing settings upon load, because
the Settings module did not offer this functionality. But it did not work well,
since all the default settings were not loaded.
Let's get rid of loadSettings.js for the bulk of the tests (the "backend"
specs). For the "container" specs, we'll keep it in place until/if we rewrite
Settings.js making it less brittle.
Clearing the authorship colors of a document with at least two authors, and then
undoing that action caused a disconnect from the pad.
This change disallows undoing clearing authorship colors in order to prevent
the problem from affecting users, and adds the relative test coverage.
This is a change of behaviour, and is documented in the changelog.
Fixes#2802 (sidestepping it).
This is allowed starting from fc661ee13a ("core: allow URL parameters and POST
bodies to co-exist"), which landed in Etherpad 1.8.0. For the discussion, see
issue #3568.
This change only slightly modifies the bahaviour of travis/runner.sh, but:
1. speeds up the tests, because it does not install dependencies before running
them. Dependencies are already installed by .travis.yml in its "install"
section;
2. if for some reason Etherpad does not start, there is a sudden failure,
instead of launching the front end tests anyway, and then having to wait 10
minutes for them to time out;
3. it is compatible with a different way of installing etherpad dependencies
("npm ci" instead of "npm install"), whereas the previous one broke. This
will probably be introduced in a while, so this change future-proofs for it
(see #3778).
4. it is more robust, because it detects more reliably the paths, and changes
between them correctly;
Please note that the script now requires bash instead of a generic posix shell.
This may break on platforms which default to a different shell (FreeBSD, MacOS?)
This is a followup on 312c72c364, which did the same on the main code base,
and is preliminary work for tidying up John's changes in the following commits.
No functional changes.
Command:
find tests/frontend -name '*.js' -type f -print0 | xargs -0 sed --in-place 's/[[:space:]]*$//'
For all the supported operating systems, the latest version of each browser is
supported, with the Exception of Win 8 / IE 10, which has an explicit version
pinned.
This was a preparatory commit for 3292429ab3 (which introduced a bug, see
issue #3728) and modified the tests for issue #3620.
Commit 155a895604 per se did not introduce any bugs, but was difficult to
inspect because of its size. For this, the corresponding PR (#3622) should not
have been accepted.
--HG--
branch : revert-3622
Note by muxator:
This commit introduced a copied & modified version of the testing files
loadSettings.js and pad.js.
It's Christmas night, and we want to shipt this feature, so I merged it anyway,
adding a note in both the original and copied files so that hopefully someone
in the distant future is going to merge them back again.
The dependency on java was introduced in 2012 (c021cf52d8) to start
Sauce-Connect from sauce labs.
Probably at the time it was a runtime dependency, but it is no longer the case
today. It is possible that java was already not needed when db003a1460 changed
from downloading Sauce-Connect-latest.zip to sc-latest-linux.tar.gz.
Moreover, I am quite sure tests/frontend/travis/sauce_tunnel.sh no longer works
today, because tests/frontend/travis/sauce_tunnel.sh downloads from an url that
gives HTTP/404 now: sc-latest-linux.tar.gz if no longer a valid file name, we
would need to explicitly download a specific version.
In the following commits Pierre is going to copy & modify some files.
This commit prepares the source files in order to minimize those differences,
so we can re-unify them as soon as possible.
No functional changes.
Do not touch vendorized files (e.g. libraries that were imported from external
projects).
No functional changes.
Command:
find . -name '*.<EXTENSION>' -type f -print0 | xargs -0 sed -i 's/[[:space:]]*$//'
This is documented to be more performant.
The substitution was made on frontend code, too (i.e., the one in /static),
because Date.now() is supported since IE 9, and we are life supporting only
IE 11.
Commands:
find . -name *.js | xargs sed --in-place "s/new Date().getTime()/Date.now()/g"
find . -name *.js | xargs sed --in-place "s/(new Date()).getTime()/Date.now()/g"
Not done on jQuery.
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
This commit replaces an old test with a new, different one.
Reasons for removing the old test:
- the old list test was introduced in cadb83a with an explicit attempt to import
an invalid HTML and see if it could recover from it
- in 5967e08 the code base finally managed to export a meaningful HTML (but we
do not know if other bugs were introduced in pursuing this)
- the old test seemed to aim at attaining resiliency, but correctness should be
addressed before that
Modified by muxator. See discussion in:
https://github.com/ether/etherpad-lite/pull/3268#issuecomment-411185713
The fix was done on another branch to show that it completely solves tests
failures introduced by 2be873e3c7.
All remaining failures in this branch are due to other changes made after
**1.6.6**, namely from fe08d2a1db included onwards.
These changes make the frontend tests send keydown instead of keypress in
firefox, in accordance with #3413 (Use keydown instead of keypress on Firefox).
The percentage of passing frontend in Firefox 61 on this revision is 100%.