Commit graph

308 commits

Author SHA1 Message Date
Richard Hansen
263105d185 tests: Remove overly aggressive timeouts 2021-11-13 03:05:38 -05:00
Richard Hansen
3c6aef11bd lint: Add 'use strict'; 2021-11-13 03:02:40 -05:00
Richard Hansen
26675c5019 chat: New chatNewMessage server-side hook 2021-11-01 01:54:29 -04:00
Richard Hansen
23a98e5946 tests: Refactor waitForSocketEvent() to improve readability 2021-11-01 01:54:29 -04:00
Richard Hansen
3132235f2c tests: Rename getSocketEvent() to waitForSocketEvent() 2021-11-01 01:54:29 -04:00
Richard Hansen
65bd597053 tests: Move socket.io connection helpers to common.js 2021-11-01 01:54:28 -04:00
Richard Hansen
bea57ff249 tests: Use logger variable for consistency 2021-11-01 01:54:28 -04:00
Richard Hansen
9fbd2e5c3d chat: New chatSendMessage client-side hook 2021-11-01 01:54:28 -04:00
Richard Hansen
0f47ca9046 chat: Plumb message object end to end
This will make it possible for future commits to add hooks that allow
plugins to augment chat messages with arbitrary metadata.
2021-11-01 01:54:28 -04:00
Richard Hansen
f1f4ed7c58 chat: Allow chatNewMessage hook to control rendering 2021-11-01 01:54:28 -04:00
Richard Hansen
2597b940f4 chat: Give chatNewMessage hook access to the raw message object 2021-11-01 01:54:28 -04:00
Richard Hansen
fc5a3f553d chat: Test processing in chatNewMessage hook 2021-11-01 01:54:28 -04:00
Richard Hansen
e471cb12e6 tests: Also spy on initially loaded chat messages 2021-11-01 01:54:28 -04:00
Richard Hansen
66a8c48fac tests: Save the CHAT_MESSAGE payload, not the wrapper 2021-11-01 01:54:28 -04:00
Richard Hansen
c8e0916e1a tests: Spy on socket.io messages as early as possible 2021-11-01 01:54:28 -04:00
Richard Hansen
e28c9ffc97 tests: Support injecting hook functions during pad load 2021-11-01 01:54:28 -04:00
Richard Hansen
c8e544ec8d tests: Fix handling of nullish module definitions 2021-11-01 01:54:28 -04:00
Richard Hansen
d36a37d666 PadMessageHandler: Delete unnecessary protocolVersion
We can assume that the client code is always in sync with what the
server expects.
2021-10-30 03:06:57 -04:00
webzwo0i
63de249236 tests: do not re-add identical text with setText 2021-10-29 02:29:45 -04:00
Richard Hansen
4f283b64cf tests: easysync: Inline some functions that are only used once 2021-10-17 00:49:34 +02:00
Richard Hansen
e535129f3c tests: easysync: Use expect.js for checks 2021-10-17 00:49:34 +02:00
Richard Hansen
ebb7dfabd7 tests: easysync: Use mocha describe() and it() 2021-10-17 00:49:34 +02:00
Richard Hansen
2c7d0604c3 tests: easysync: Remove unnecessary Random class 2021-10-17 00:49:34 +02:00
Richard Hansen
8dd61f847e tests: easysync: Fix some ESLint errors 2021-10-17 00:49:34 +02:00
Richard Hansen
59a6a9f6a0 tests: easysync: Delete commented-out and unused code 2021-10-17 00:49:34 +02:00
Richard Hansen
428736cdc3 tests: easysync: Run with the frontend tests 2021-10-17 00:49:34 +02:00
Richard Hansen
0ea6f1518c tests: Remove overly agressive timeouts 2021-10-07 20:31:54 -04:00
Richard Hansen
2155e216a6 tests: Remove overly agressive timeouts 2021-10-07 19:53:03 -04:00
Richard Hansen
e8514db365 tests: Replace manual checks with assert 2021-10-03 20:23:30 -04:00
Richard Hansen
72b12bc97b tests: Slight backend test reorganization
* Delete some useless uses of `describe()`
  * Combine some dependent tests
  * Rename some tests to avoid duplicate names
2021-10-03 20:06:33 -04:00
Richard Hansen
dd37251da4 tests: Promisify some backend tests 2021-10-03 19:25:50 -04:00
Richard Hansen
39a971e3b9 tests: Remove overly aggressive timeouts 2021-10-03 19:25:50 -04:00
John McLear
c361df52d2 bugfix: Allow selection to start/end before line marker 2021-10-02 02:41:58 -04:00
webzwo0i
0de41ee087 adminsettings test: Fix save detection race condition
Use MutationObserver to detect if a saveProgress event was received,
which will trigger an animation.

Before this, `helper.admin$('#response').is(':visible')` was true
after the page loaded and before clicking the Save button, so there
was a possibility that after clicking Save, but before sending the
socketio message to the server, the visibility is checked and returns
true, so the page gets reloaded before the changed settings have been
saved.
2021-09-29 23:49:16 -04:00
webzwo0i
bb0ca91dc2 adminupdateplugins test: swap assertions, increase timeout 2021-09-29 23:49:16 -04:00
webzwo0i
91d3974a0d adminsettings test: Be a little stricter for some assertions 2021-09-29 23:46:25 -04:00
webzwo0i
cc6fda6916 adminsettings test: Fix restart detection
We cannot guarantee that the system time on SauceLabs and Github is in
sync. In case the SauceLabs runner's clock is slow the test would have
failed.
2021-09-29 23:42:41 -04:00
Richard Hansen
653dbb3449 tests: Wait for pad init before returning from helper.aNewPad()
This should make it easier to avoid race conditions.
2021-09-28 04:18:24 -04:00
Richard Hansen
15f17b5237 tests: Avoid deprecated Builder.withCapabilities() method 2021-09-15 19:42:11 -04:00
Richard Hansen
70c16bb1b5 tests: Check import of export of read-only pad ID 2021-09-15 18:32:06 -04:00
John McLear
b683dc300d tests: Check for leak of read-write pad ID when exporting 2021-09-15 18:32:06 -04:00
Richard Hansen
0f5a4bd1f8 tests: Restructure read-only pad export tests
This also adds coverage for `.etherpad` exports.
2021-09-15 18:32:06 -04:00
Richard Hansen
bc9cdd6957 SocketIORouter: Add acknowledgement support 2021-09-06 14:45:26 -04:00
Richard Hansen
9f9adb369b SocketIORouter: Don't crash if message handler throws 2021-09-06 14:45:26 -04:00
Richard Hansen
320e5c1109 SocketIORouter: Add unit tests 2021-09-06 14:45:26 -04:00
Richard Hansen
348bc0c269 tests: Delete overly aggressive timeouts
See https://github.com/ether/etherpad-lite/issues/4988 for rationale.
2021-08-30 02:02:37 -04:00
Richard Hansen
7dbd278d1d deps: Bump js-cookie to 3.0.0 2021-08-29 23:36:48 -04:00
Richard Hansen
c816c20bc7 HTML import: Replace cheerio with jsdom to simplify contentcollector
Cheerio provides jQuery-like objects but they wrap DOM Node-like
objects that are not 100% API compatible with the DOM spec. Because of
this, contentcollector, which is used in browsers and in Node.js
during HTML import, has until now needed to support two different
APIs. This commit modifies HTML import to use jsdom instead of cheerio
and simplifies contentcollector.
2021-08-12 13:53:23 -04:00
Richard Hansen
d723270388 tests: Improve readability of multipleUsers.js
* Define utility functions above their use to silence lint warnings.
  * Use `.css()` instead of `.attr('style')` to manipulate style.
  * Pass an object to `.attr()` rather than call once per attribute.
  * Take advantage of chaining.
  * Inline unnecessary `padUrl` variable.
  * Delete some unnecessary comments.
2021-07-25 02:23:50 +02:00
Richard Hansen
ff39eeafca tests: Factor out duplicate getFrameJQuery() 2021-07-25 02:23:50 +02:00
Richard Hansen
42026ff771 tests: Add a comment explaining why Promise.all() is not used 2021-07-25 02:23:50 +02:00
Richard Hansen
01184cd1aa tests: Remove unnecessary includeJquery parameter 2021-07-25 02:23:50 +02:00
webzwo0i
62093adce5 tests: refactor inclusion of jquery and sendkeys via script tags
Readability is increased by explicitly checking if jquery/sendkeys was
already loaded before evaluating it in the context of ace_inner and the
enclosing container (pad.html). Note that sendkeys is no longer
evaluated in the context of ace_outer, as this isn't needed

Also removes some IE 8/9 legacy code
2021-07-21 01:53:05 +02:00
Richard Hansen
834e05fc9c Chat: Use a <textarea> for message input 2021-07-19 23:44:33 +02:00
Richard Hansen
ce5ef9350f tests: sendkeys: Fix {enter} keypress event 2021-07-19 23:44:33 +02:00
Richard Hansen
336d48add7 Add support for square brackets in URLs
This reverts commit 9022877cc6.
2021-07-10 22:22:31 -04:00
Richard Hansen
5dcb7a7549 tests: Don't attempt to wrap non-functions 2021-06-14 13:45:13 +02:00
Richard Hansen
081b97c41d tests: Wrap more Mocha functions 2021-06-14 13:45:13 +02:00
Richard Hansen
3e4df68510 tests: Enable fake webcam on Microsoft Edge 2021-06-10 15:36:35 -04:00
Richard Hansen
565b1c5271 tests: Fix flexbox grow/shrink factors
* Make sure the `#mocha-report` div grows to fill the available
    vertical space.
  * Prevent the "Loading frontend test specs..." div from shrinking.
2021-06-10 13:28:55 -04:00
Richard Hansen
acd11c3948 tests: Fetch frontend test specs in parallel 2021-06-09 20:28:03 -04:00
Richard Hansen
36d2af5318 tests: Display frontend spec loading progress 2021-06-09 20:18:22 -04:00
Richard Hansen
e0ae997501 tests: Don't auto-scroll Mocha results if user scrolls up 2021-06-09 18:48:31 -04:00
Richard Hansen
f5046f4b18 tests: Keep the #mocha-stats div visible 2021-06-09 18:48:31 -04:00
Richard Hansen
63a5dc6599 tests: Configure Firefox to use fake webcam
This makes it possible to test ep_webrtc in Firefox.
2021-06-06 16:53:51 -04:00
Richard Hansen
8f0d70312d tests: Also pass --use-fake-ui-for-media-stream to Chrome
For testing ep_webrtc.
2021-06-06 16:25:27 -04:00
Richard Hansen
752e2488af tests: Migrate from wd to selenium-webdriver 2021-06-06 16:23:56 -04:00
Richard Hansen
1756415495 tests: Avoid jQuery when reading Mocha output 2021-06-06 16:20:13 -04:00
Richard Hansen
6c2f31a5cb tests: Add tests for settings.json parsing 2021-06-06 14:00:52 -04:00
Richard Hansen
45ca82fd9f tests: Make the Mocha results area resizable 2021-06-05 03:51:55 -04:00
Richard Hansen
c4239b6059 tests: Show a scrollbar if the pad is too wide 2021-06-05 03:51:11 -04:00
Richard Hansen
fc3b811726 tests: Move iframe min width to iframe selector 2021-06-05 03:51:11 -04:00
Richard Hansen
960c2c0c0d tests: Tweak mocha report spacing 2021-06-05 03:51:11 -04:00
Richard Hansen
b09b895ac7 tests: Remove border around iframe 2021-06-05 03:51:11 -04:00
Richard Hansen
e9f08bdd11 tests: Fix frontend test CSS selectors 2021-06-05 03:51:11 -04:00
Richard Hansen
76634eb6ff tests: Add missing <head> and <body> tags 2021-06-05 03:51:11 -04:00
Richard Hansen
d9782ac628 tests: Send frontend test spec list as JSON 2021-06-05 03:51:06 -04:00
Richard Hansen
20df34bb67 tests: Promisify helper.init() 2021-06-05 03:50:36 -04:00
Richard Hansen
e4f011df76 tests: Use require() to load frontend test specs
This makes core and plugin tests consistent with each other, makes it
possible to `require()` relative paths in spec files, simplifies the
code somewhat, and should make it easier to move away from
require-kernel.

Also:
  * Wrap plugin tests inside a `describe()` that contains the plugin
    name to make it easier to grep for a plugin's tests and for
    consistency with core tests.
  * Add "<core>" to the core test descriptions to make it easier to
    distinguish them from plugin tests.
2021-06-05 03:50:26 -04:00
Richard Hansen
9cba96e5e9 tests: Use relative paths for scripts 2021-06-05 03:49:12 -04:00
Richard Hansen
e144434571 tests: Use relative paths in helper.init()
This avoids problems if Etherpad is served under a path like
`/etherpad`.
2021-06-05 03:49:12 -04:00
Richard Hansen
4fa9f9e9d8 tests: Use window.foo instead of var foo 2021-06-03 15:10:22 -04:00
Richard Hansen
aea2fb7448 tests: Rename specs_list to frontendTestSpecs 2021-06-03 15:10:22 -04:00
Richard Hansen
1be1b704f1 tests: Simplify iteration over frontend test specs 2021-06-03 15:10:22 -04:00
Richard Hansen
0d9476529e sanitizePathname: Move to separate module to facilitate reuse 2021-06-03 15:10:21 -04:00
Richard Hansen
926da57e34 Minify: Refine sanitizePathname to avoid pathname traversal 2021-06-03 15:10:21 -04:00
Richard Hansen
59c03bde20 lint: Re-run eslint --fix 2021-05-12 11:26:35 +02:00
Richard Hansen
8baacd514e remote_runner: Always call browser.quit() 2021-05-03 01:48:08 -04:00
Richard Hansen
081f739a8d remote_runner: Update browser list
Use latest versions of Chrome, Firefox, Safari, and Edge. Keep the old
Chrome version.
2021-05-03 01:48:08 -04:00
Richard Hansen
a7cd0a4b25 remote_runner: Avoid re-sending the same console text over and over 2021-05-03 01:48:08 -04:00
Richard Hansen
25275f2744 remote_runner: Treat no text as 0 lines, not 1 empty line 2021-05-03 01:48:08 -04:00
Richard Hansen
a17556b876 remote_runner: Avoid searching the full text for "FINISHED" 2021-05-03 01:48:08 -04:00
Richard Hansen
3409e3f5e6 remote_runner: Prevent Sauce errors from interrupting other tests 2021-05-03 01:48:08 -04:00
Richard Hansen
68b041c4fb remote_runner: Use newline instead of backslash n 2021-05-03 01:48:08 -04:00
Richard Hansen
713e57b451 remote_runner: Don't break long lines
Breaking lines makes it harder to read and search the test output.
2021-05-03 01:48:08 -04:00
Richard Hansen
7d75e0ef8f remote_runner: Simplify append() 2021-05-03 01:48:08 -04:00
Richard Hansen
bbb3046a87 remote_runner: Promisify 2021-05-03 01:48:08 -04:00
Richard Hansen
9059a55873 remote_runner: Improve readability of timeout duration 2021-05-03 01:48:08 -04:00
Richard Hansen
c803ec81f1 remote_runner: Handle webdriver errors 2021-05-03 01:48:08 -04:00
Richard Hansen
7f57b17b2e remote_runner: Use Error objects to convey pass/fail 2021-05-03 01:48:08 -04:00
Richard Hansen
4ec02a9af9 remote_runner: Simplify finished test check 2021-05-03 01:48:08 -04:00
Richard Hansen
b0e367a982 remote_runner: Simplify logging of console text 2021-05-03 01:48:08 -04:00
Richard Hansen
08856fe42e remote_runner: Move logIndex updates into printLog() 2021-05-03 01:48:08 -04:00
Richard Hansen
a12c475776 remote_runner: Use an options object to create webdriver object 2021-05-03 01:48:08 -04:00
Richard Hansen
925f789d4c remote_runner: Simplify logging 2021-05-03 01:48:08 -04:00
Richard Hansen
014e19cf7d remote_runner: await each browser test 2021-05-03 01:48:07 -04:00
Richard Hansen
1f3a831cc3 remote_runner: Avoid duplication in task list 2021-05-03 01:48:07 -04:00
Richard Hansen
59be8d5c05 remote_runner: Delete commented-out browsers
Also delete useless and incorrect browser comments.
2021-05-03 01:48:07 -04:00
Richard Hansen
a58fa4a2c5 tests: Add tests for SkipList.atOffset() 2021-05-03 01:42:03 -04:00
Richard Hansen
e2eb7327c2 skiplist: Sanity check inserted entries 2021-05-03 01:42:03 -04:00
Richard Hansen
ea8846154f favicon: Redo favicon customization 2021-04-20 13:33:55 -04:00
Richard Hansen
92e0bff80c favicon: Refactor handler and add tests 2021-04-20 13:33:55 -04:00
webzwo0i
20c512c8a9 test for await db.set in createAuthor 2021-04-20 11:27:43 -04:00
Richard Hansen
f63610bb12 tests: Test access bypass via read-only pad ID 2021-04-12 22:51:06 -04:00
pcworld
0d33793908 tests: readonly pastes must be readable+exportable with authentication
readonly paste links should be readable even if authentication is turned
on, as long as the user provides valid login data.
This test currently fails.

Also test that readonly paste IDs can be exported under the same
condition, which currently succeeds.
2021-04-12 22:51:06 -04:00
webzwo0i
9408d4395f remove custom timeouts 2021-04-07 17:47:11 -04:00
Richard Hansen
e4754eb9df tests: Fix race in timeslider_revisions.js 2021-04-02 15:46:27 +02:00
Richard Hansen
27e5373050 tests: Fix race in change_user_name.js 2021-04-02 15:46:27 +02:00
Richard Hansen
58dac4c0fc tests: Fix races in inner_height.js 2021-04-02 15:46:27 +02:00
Richard Hansen
4ad80d4072 tests: Delete overly aggressive frontend test timeouts
This should reduce test flakiness.
2021-04-02 15:46:27 +02:00
Richard Hansen
7cbb3f565d tests: Speed up helper.edit() and helper.clearPad() 2021-04-02 15:46:27 +02:00
Richard Hansen
7a154b1e1d tests: Wait for commit instead of sleep in timeslider_revisions.js 2021-04-02 15:46:27 +02:00
Richard Hansen
d15ff9ce8d tests: Add missing awaits to change_user_name.js
Also increase the timeouts.
2021-04-02 15:46:27 +02:00
Richard Hansen
bbf89dfcf9 tests: Refine frontend tests
* Switch from `helper.newPad()` to `helper.aNewPad()`.
  * Promisify.
  * Delete redundant logic.
  * Lint fixes.
2021-04-02 15:46:27 +02:00
Richard Hansen
3790c0e41c tests: Use async/await instead of returning Promises
This has a few benefits:
  * It's more readable: It's easier for a user of the function to know
    that they should use `await` when calling the function.
  * Stack traces are more useful.
  * Some code (e.g., the async npm package) uses introspection to
    determine if a function is `async` vs. takes a callback.
2021-04-02 15:46:27 +02:00
Richard Hansen
b164a34e64 lint: Fix ESLint error in helper/methods.js 2021-04-02 15:46:27 +02:00
Richard Hansen
62403159df tests: Invert conditions to improve readability 2021-04-02 15:46:27 +02:00
Richard Hansen
dd9c08d821 tests: Wait for commit rather than sleep 2021-04-01 14:31:56 +02:00
Richard Hansen
2776946627 tests: Use cookie libraries to manipulate cookies 2021-04-01 14:31:56 +02:00
Richard Hansen
aeee5c0b69 tests: Fix cookie name in helper.js tests 2021-04-01 14:31:56 +02:00
Richard Hansen
137fa89d2a tests: Always set cookie path to / (to match non-test behavior) 2021-04-01 14:31:56 +02:00
Richard Hansen
5666c34061 tests: Fix encoding of prefs cookie 2021-04-01 14:31:56 +02:00
Richard Hansen
63e6e163b7 tests: Promisify some of the helper.js tests 2021-04-01 14:31:56 +02:00
Richard Hansen
701a40ac13 tests: Promisify multiple_authors_clear_authorship_colors.js 2021-04-01 14:31:56 +02:00
Richard Hansen
8b43f9eb5f tests: Promisify authorship_of_editions.js 2021-04-01 14:31:56 +02:00
Richard Hansen
056939cd22 tests: Refine helper/multipleUsers.js
* Rename "current"/"other" to "user0"/"user1".
  * Delete unnecessary `_createTokenFor*` functions.
  * Rename helper functions to remove unnecessary leading underscore
    and for brevity.
  * Use jQuery's `.attr()` to build the second iframe.
  * Use js-cookie to manipulate the token cookie.
  * Don't attempt to set the token cookie if the pad isn't loaded.
  * Use the token generated by the pad.
  * Only clear the token cookie at path=/.
2021-04-01 14:31:56 +02:00
Guilherme Goncalves
f2034ad368 tests: Add regression tests for character composition race
See: https://github.com/ether/etherpad-lite/issues/4978
2021-03-30 16:42:53 -04:00
Richard Hansen
718da6fc1b tests: New helper.aNewPad() (promisified newPad()) 2021-03-29 18:40:05 -04:00
Richard Hansen
ec76a6548f tests: Make the helper.newPad() callback optional 2021-03-29 18:40:05 -04:00
Richard Hansen
27b35699ea tests: Fix helper.newPad() retries
* Pass retry count in options object so that each pad has its own
    retry count.
  * Delete useless `origPadName` variable.
2021-03-29 18:40:05 -04:00
John McLear
b80f5bdae8
bugfix/tests/scaling: Socket query test fix (#4974)
fix socketio test where res.req is not available.
2021-03-24 21:03:48 +00:00
John McLear
2b98b930d7
scaling: include padId in socketio query string 2021-03-24 16:07:11 +00:00
webzwo0i
b250ceaae7 add test for wrong clientHeight 2021-03-20 16:41:15 +00:00
Richard Hansen
83f39289aa import/export: On export error return 500 instead of crashing 2021-03-18 09:02:28 +00:00
Richard Hansen
fe1eceb6b5 tests: Use assert to simplify import/export tests 2021-03-18 09:02:28 +00:00
Richard Hansen
98c42d6076 tests: Promisify import/export tests 2021-03-18 09:02:28 +00:00
Richard Hansen
ff50682412 tests: Increase import/export test timeouts 2021-03-18 09:02:28 +00:00
John McLear
5ac90ab30f tests: Allow time for minification to complete
Minification happens after the initial visit and request to pages.
2021-03-05 07:11:42 +00:00
Richard Hansen
8971166c58 lint: Set up Cypress config and fix issues 2021-03-02 05:49:48 +00:00
John McLear
64e9e7fcda
tests: Frontend test Windows ZIP (#4894)
* tests:  Frontend test Windows ZIP

This PR introduces Frontend testing within Github actions!

We're depending a lot on saucelabs recently and that's fine but sometimes we just want to quickly do a frontend simple test on a weird environment (IE windows build) so this PR solves that problem.

Things to note.

    It still builds the windows .zip if the cypress tests fail.
    It does not add any heavy deps to Etherpad as cypress must be installed in CI.
    Cypress is responsible for running the Etherpad instance.

It's up to us how much we use this or not, I know it introduces a bunch of technical debt but I tried to keep that a minimum by compartmentalizing things and documenting where required.

* Update .github/workflows/windows-zip.yml

Co-authored-by: Richard Hansen <rhansen@rhansen.org>

* remove timeouts

* Move folder structure up a level

* Update windows-zip.yml

* Update test.js

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-03-01 14:31:55 +00:00