Commit Graph

100 Commits

Author SHA1 Message Date
Anders Kaseorg dfda6d2895 puppeteer_tests: Remove jQuery dependency.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-09-11 12:53:20 -07:00
Anders Kaseorg 96f15e3665 puppeteer_tests: Add helper to correctly test @class in an XPath query.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-09-11 12:53:20 -07:00
Anders Kaseorg 663f1a387d puppeteer_lib: Explode CommonUtils class.
This may have originally made sense as a class that managed the
browser state, but it has since turned into a dumping ground for
mostly pure functions that don’t make sense to instantiate.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-09-11 12:53:20 -07:00
Anders Kaseorg 5ea44bc4ee puppeteer_tests: Convert now-deprecated waitForXPath, $x methods.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-09-09 21:33:41 -07:00
Anders Kaseorg 7e6e98aefb puppeteer_lib: Fix get_element_text typing.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-09-06 15:02:29 -07:00
Tim Abbott 4a34b7d18e left-sidebar: Make Subscribe to more streams more informative.
The "Subscribe to more streams" widget has always had this tension
between "Subscribe" vs. "Create" in a way that felt like whatever we
wrote could be confusing. To address this, we enhance the component to
advertise whether additional existing streams that the user can
subscribe to actually exist or not.

- When the user has N>0 streams they can subscribe to, we display
"Browse N more streams".

- When the user has no streams they can subscribe to (i.e. they're
already susbcribed to all the ones they could join) but the user has
permission to create streams, we show a "Create a stream" link.

- If the user doesn't have permission to subscribe to or create any
streams, we don't show a link at all.

Fixes #21865.

Co-authored-by: Jai soni <jai_s@me.iitr.ac.in>
2022-08-15 12:32:43 -07:00
Anders Kaseorg 27eed09a84 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-08-04 13:52:06 -07:00
Anders Kaseorg 4ebcc9ba95 puppeteer_tests: Fix type errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-07-06 17:23:16 -07:00
evykassirer 72166f1b03 puppeteer: Fix get_element_text including hidden text.
Previously, this function used the `textContent` property, which
includes hidden elements. Fix this by using innerText instead.
2022-06-02 16:44:24 -07:00
Steve Howell 29e4342738 puppeteer tests: Split stream tests to two files.
This is just moving code around.
2022-03-18 12:20:48 -04:00
Anders Kaseorg f84a2c08d5 js: Prefix jQuery object variable names with $.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-16 12:52:07 -07:00
N-Shar-ma 728fee31b2 typeahead: Ignore mouse position for selection until it's moved.
Added a property `mouse_moved_since_typeahead` to the typeahead class
which tracks whether the mouse has been moved since the typeahead
menu appeared.

The hovered over menu item is highlighted on `mouseenter` only if
`mouseMoved` is true. Otherwise, the cursor is hidden temporarily.

Code substantially reorganized by tabbott.

Fixes: #21018.
2022-02-15 17:26:22 -08:00
Anders Kaseorg b0ce4f1bce docs: Fix many spelling mistakes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-07 18:51:06 -08:00
Aman Agrawal db09639f6c compose: Change UI which toggles `enter_sends` setting.
Use a popover which displays both the options instead of long text.
We only use a small text indicating the current state which user
can click on to trigger the popover.
2022-01-05 16:03:53 -08:00
Aman Agrawal 25ee6a795e compose: Never hide send button.
`Press Enter to send` used to hide `Send` button, we remove that
behaviour.

We show the current state of `Enter` hotkey action via text below
`Send` button which can toggle behaviour on click.
2021-12-02 15:11:15 -08:00
Ganesh Pawar 1e8bfa710e dialog_widget: Migrate modal to Micromodal.
Also removed the `danger_submit_button` config option
from the dialog_widget since it isn't needed in the new modals.
2021-10-26 18:20:17 -07:00
Anders Kaseorg abee9258c6 js: Fix @typescript-eslint/restrict-template-expressions.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-09-22 18:06:06 -07:00
Anders Kaseorg ba610440ab js: Fix @typescript-eslint/no-floating-promises.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-09-22 18:06:06 -07:00
Anders Kaseorg dadacc38a8 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-09-13 10:12:43 -07:00
Riken Shah 49193231aa puppeteer_test: Improve how we select the typeahead element.
Our typeahead system is very sensitive, a simple internal
focus can hide it. This leads to occasional failure on the
puppeteer test.

This commit tries to solve it by clicking via javascript
instead of manual puppeteer click.
2021-08-01 23:20:13 -07:00
Riken Shah f95c539122 custom_check: Avoid use of assert to avoid confusion with assert.equal.
This commit bans the use of `assert` and replaces it
with `assert.ok` to avoid confusion with `assert.equal`.

Fixes #18687.
2021-06-10 09:15:57 -07:00
Anders Kaseorg c446435f54 puppeteer_tests: Use assert.match.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-08 10:16:53 -07:00
Riken Shah 7ae5e7287b puppeteer_test: Add `wait_for_modal_to_close` method to `CommonUtils`.
This commit adds the `wait_for_modal_to_close` method
and replaces all the instances where we are using jQuery
to check if the modal is closed.
2021-06-03 09:23:54 -07:00
Riken Shah 13562222fa dependency: Upgrade puppeteer to 9.1.1. 2021-06-02 15:47:34 -07:00
Anders Kaseorg 42abc1b635 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-10 18:07:13 -07:00
Arun Sankar 146b32d63a test users: Add an escape char to a test username.
Changed the name of the test-user cordelia from `Cordelia Lear` to
`Cordelia, Lear's daughter`.

This change will enable us to test users with escape characters in
their names.

I also updated the Node, Puppeteer, Backend tests and Fixtures to
support this change.
2021-04-13 11:42:06 -07:00
Riken Shah a527d196d7 puppeteer_tests: Use more stable selectors.
This commit changes some fragile selectors (like
`a[href=#link]`) to more stable selectors because they
are more prone to break from doing something normal
like adding another link in the app.

It also solves an inconsistency in `07-navigation.ts`,
where the subscription overlay was opened by clicking
on the header stream instead of the menu list.

It also fixes a rare flake (in `07-navigation.ts`), where
the close button of subscription overlay was not clicked
due to a delay in the opening. The delay was caused by
clicking the header stream to open subscription overlay
which caused unnecessary loading of the stream
setting(Verona).
2021-03-31 09:00:51 -04:00
Riken Shah e61f73c239 refactor: Lift out log-out call from individual tests to `common.ts`.
We recently added the commit to add the log-out call
after each test (52706908b).

This commit cleans that approach by using
just one log-out call after the test is executed at
`common.ts`
2021-03-31 08:57:18 -04:00
Anders Kaseorg d43ac7357a js: Move current_msg_list, home_msg_list to ES6 module message_lists.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-29 18:23:47 -07:00
Anders Kaseorg e62b0d6b5f puppeteer_tests: Translate logged traces and errors with source maps.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-25 02:05:19 -07:00
Anders Kaseorg da9783fd10 puppeteer_tests: Log page errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-25 02:05:19 -07:00
Anders Kaseorg ed8c4fec98 puppeteer_tests: Log browser console output.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-25 02:05:19 -07:00
Anders Kaseorg 0d218a4b76 eslint: Enable @typescript-eslint/consistent-type-imports.
TypeScript type-only imports will probably become important eventually
for reducing our circular import problem.

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-18 17:26:19 -07:00
Anders Kaseorg e0f0b7f4a7 puppeteer_lib: Remove jQuery dependency from select_item_via_typeahead.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-13 07:02:00 -05:00
Anders Kaseorg 812adba5a3 puppeteer_lib: Remove jQuery dependency from get_rendered_messages.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-13 07:02:00 -05:00
Anders Kaseorg 73ca1afc53 puppeteer_lib: Remove wait_for_text.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-13 07:02:00 -05:00
Anders Kaseorg 054f8f8151 puppeteer_lib: Remove jQuery dependency from get_text_from_selector.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-13 07:02:00 -05:00
Anders Kaseorg 4434e2c687 puppeteer_lib: Remove jQuery dependency from pm_recipient.set.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-13 07:02:00 -05:00
Riken Shah 5e98f80dc3 puppeteer_test: Transform jQuery to puppeteer functions for Firefox.
This commit converts some jQuery code
to builtins puppeteer functions because
it was not working with Firefox.
2021-03-12 12:14:37 -08:00
Riken Shah d12257e2c1 puppeteer_test: Add missing `await` checking compose content.
assert_compose_box_content should always be called with await.
2021-03-04 09:41:49 -08:00
Riken Shah de96aeb822 puppeteer_test: Fix `page.url()` for Firefox.
This commit works around an issue with Puppeteer tests on Firefox
where `page.url()` does not show the URL fragment, by adding a
temporary function that solves the issue.
2021-03-04 09:40:14 -08:00
Riken Shah a6c1f02df0 puppeteer_test: Add `is_firefox` option to enable/disable some tests.
This commit introduces the `is_firefox`
option in CommonUtils to identify if a browser
is Firefox or not.

This helps us to avoid calling some tests
that is yet not compatible with Firefox.
2021-03-03 22:04:16 -08:00
Riken Shah 6676aa2f90 puppeteer_test: Change browser default viewport to allow Firefox.
When we run puppeteer with Firefox,
the `--window-size` option does not work,
which makes the bottom part of
the page cut off.

This commit fixes this issue
by setting the screen default viewport
to the maximum size of the window.
2021-03-03 22:01:36 -08:00
Anders Kaseorg 79ac5c25b5 zulip_test: Re-export internal functions used by Puppeteer tests.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Aman Agrawal 39d123e355 recent_topics: Make it the default view.
Go to Recent Topics on "#", no hash and "#recent_topics".
Go to Recent Topics as the last destination for escape key.
Map `a` key to All messages and change its hash to
`#all_messages`.
2021-02-25 17:31:32 -08:00
Anders Kaseorg 279c4b0e24 puppeteer_tests: Port to TypeScript.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00
Anders Kaseorg 8dec7b9270 puppeteer_lib: Use class fields.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00
Anders Kaseorg 912c5a28f2 puppeteer_tests: Replace deprecated jQuery event trigger shorthand.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00
Anders Kaseorg ad540dac3a puppeteer_lib: Supply missing $eval arugment.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00
Anders Kaseorg 72142273c0 puppeteer_tests: Remove buggy assert_selector_doesnt_exist helper.
It was checking whether the selector string is itself null, not
whether it selects anything!

Use page.waitForSelector(…, {hidden: true}) instead.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00