Commit Graph

3261 Commits

Author SHA1 Message Date
Priyank Patel 78774e5f1b minor: Remove unused url argument.
This is not required anymore after we moved to run_test model
to save screenshots.
2020-08-30 23:38:30 -07:00
Priyank Patel cb1020abd4 refactor: Extract out out root_dir and puppeteer_dir.
The puppeteer_dir will use used for passing in the path to save the
recording.
2020-08-30 23:38:30 -07:00
Priyank Patel 3ab603e3a2 refactor: Extract window size into a object.
This will be passed to the function that will start the recording.
2020-08-30 23:38:30 -07:00
Dinesh 2d22d88700 casper: Remove few traces of casper.
Now that all casper tests have been migrated to
puppeteer, there's no need for having casper
related things.

Removed the casperjs package and removed/replaced
casper in few places with puppeteer.

Only removed few of them which I'm confident
about. Also didn't make any changes in docs
as it would be easier to remove them while
adding puppeteer docs.
2020-08-30 17:16:02 -07:00
Dinesh 62c69af6d5 puppeteer: Migrate narrow test from casper. 2020-08-30 15:02:52 -07:00
Dinesh 6bf231c576 puppeteer: Change table to zfilt in stars test.
check_messages_test should have table set to zfilt
instead of zhome as we are narrowed to only starred
messages.

Found it as the test failed with the previous commit.
2020-08-30 15:02:52 -07:00
Dinesh 653a577abb puppeteer: Wait till visible: true in check_messages_sent.
The next adds a few tests which heavily rely on
check_messages_sent. There were some weird errors,
this fixed those. I think the errors were due to
us navigating multiple times and this function
not waiting for the messages to become visible.
2020-08-30 15:02:52 -07:00
Dinesh 28d65b391c puppeteer: Set visible: true to fix flakes.
These `waitForSelector`s appear just after page loads.
Though they worked most of the times, a few clicks weren't
getting registered because of these selectors not appearing
and thus causing flakes as the modal takes time to appear.
Adding visible: true asserts that it's visible and not just present.
2020-08-30 14:59:05 -07:00
Dinesh dcc47dcc12 puppeteer: Wait for display settings section to appear before clicking.
In few rare cases the click on display settings section wasn't working
which was causing the test to stay in the "your account" settings section.
This lead to a waitFor fail.

The screenshot in this failed CircleCI build suggests the above.
https://app.circleci.com/pipelines/github/chdinesh1089/zulip/525/workflows/cd77e269-6a3e-4283-b765-d1c4584ccf35/jobs/1807/artifacts

This and the previous commit along with the changes to prevent
logging out of user on changing password were tested by running
this test 1200 times and all of them passed!
2020-08-30 14:59:05 -07:00
Priyank Patel 9884226ffb settings_account: Don't redirect to login page during password change.
This handles a rare race condition that occurs when the session hash
is not updated by the backend during the password change process.
This mostly occurs in puppeteer tests, but could occur to a user.
2020-08-30 14:58:49 -07:00
Anders Kaseorg 7946da4182 node_tests: list_render: Fix init_sort argument.
In list_render.js, [...list] requires list to be an array, and
widget.set_sorting_function(...opts.init_sort) requires init_sort to
be an array.

This allows the Node tests to pass in Babel strict mode.  We currently
use loose mode for performance, and so we should test in loose mode as
well; but we must never depend on loose mode for correctness, since
individual Babel transformations may stop being applied as our browser
support baseline improves.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-28 16:10:15 -07:00
Dinesh 0b01a183e2 puppeteer: Migrate realm linkifier test from casper. 2020-08-27 11:45:35 -07:00
Dinesh 5a73c2ca42 puppeteer: Migrate copy paste test from casper. 2020-08-27 11:45:35 -07:00
Dinesh a32c5e5525 puppeteer: Migrate delete message test from Casper. 2020-08-27 11:45:35 -07:00
Dinesh 72b61a4a5f puppeteer: Migrate drafts test from casper. 2020-08-27 11:45:35 -07:00
Dinesh 21dd44cd1b puppeteer: Migrate user deactivation test from casper. 2020-08-27 11:45:35 -07:00
Sumanth V Rao 42d30bc14b markdown: Add copy-to-clipboard button in codeblocks.
Clicking on the copy-to-clipboard button triggers the clipboard.js
API to dynamically set the text to be copied. This text is the
actual code content from the sibling <code> element (extracted
though jQuery text() method).

The html structure would now look like:
<div class="codehilite">
    <pre>
        <button> The copy button </button>
        <span></span>
        <code>......</code>
    </pre>
</div>

Additionally, this preserves the original code formatting of
the codeblock during copy-paste.

Tests amended.

Fixes: #15208
2020-08-26 23:18:05 -07:00
orientor 372e010dbb events: Add `op` field to `update_message_flags` events.
`update_message_flags` events used `operation` instead of `op`, the
latter being the standard field used in other events. So add `op`
field to `update_message_flags` and mark `operation` as deprecated,
so that it can be removed later.
2020-08-24 12:42:03 -07:00
Dinesh 77bea3de7a puppeteer: Fix test flake in admin tests.
This flake occurs because the Verona dropdown menu couldn't be
clicked, in rare cases, because puppeteer would click it too
quickly before it appears and then fails. To fix this we wait for it
to fully appear and then click it. Around 1000 runs
passed without a failure.

The error the flake caused was:
TimeoutError: waiting for selector
"#org-submit-notifications[data-status="unsaved"]" ...
2020-08-21 07:41:28 -04:00
Steve Howell 25c3f052cd node fixture: Fix data for realm_user__remove. 2020-08-20 08:40:59 -04:00
Steve Howell b38353f3ff node fixtures: Add author_id key. 2020-08-18 10:43:42 -04:00
Steve Howell 2d5096ea8f minor: Make local var for test_user. 2020-08-18 10:43:42 -04:00
Steve Howell 4f5b214104 minor: Revise disclaimer on node fixtures data. 2020-08-18 10:43:42 -04:00
Steve Howell 35dd6ef93b node fixtures: Use better data for reactions. 2020-08-17 13:00:47 -04:00
Steve Howell 31fd872781 node fixtures: Use better data for subscription update.
The dispatch test here really only cares that values
get passed on.

Note that the dispatch code ignores the email field, because
we only send subscription/update events to the user
whose subscription has changed.
2020-08-17 13:00:47 -04:00
Steve Howell 60b16a92e3 node tests: Add has_zoom_token to event.fixtures. 2020-08-16 11:37:06 -04:00
Mohit Gupta 4167517a6f filters: Fix has:image and avoid future issues for other has filters.
This fixes a bug with the original frontend-side implementation for
has: filters, where it would incorrectly not match content in cases
where the message's nesting structure did not have an outer tag.

Bug was introduced in 02ea52fc18.

Fixes #16118.
2020-08-14 16:51:26 -07:00
sahil839 f046c9c58a streams: Add role field to Subscription objects passed to clients.
This commit adds "role" field to the Subscription objects passed to
clients.  This is important preparation for being able to work on the
frontend for this feature.
2020-08-14 16:33:11 -07:00
Steve Howell f4181ea300 node fixtures: Improve realm_user__add.
We also improve the relevant dispatch test a bit.
2020-08-14 10:40:29 -04:00
Steve Howell 8b34a2f755 node fixtures: Use better data for presence.
The dispatch for presence is a trivial one-liner,
so the test just makes sure three important parameters
get passed along.

We will eventually want to use the fixtures data in
other presence-related tests, but for now the only
goal is to make it pass the schema checks.
2020-08-14 10:40:29 -04:00
Dinesh b954ed2938 puppeteer: Migrate custom profile test from casper. 2020-08-13 16:24:15 -07:00
sahil839 f9651a1e98 puppeteer: Fix typo in comments in subscriptions tests. 2020-08-12 17:17:57 -07:00
Dinesh 62d3107ac9 puppeteer: Migrate mention test from casper.
Also add helper functions needed.
`select_item_via_typeahead` has been ported from casper
and is exactly same in puppeteer to as I couldn't find
any better way for that purpose.
2020-08-11 10:43:29 -07:00
Dinesh feb2556253 puppeteer: Migrate admin test from casper.
Also adds a required helper function to common.js.
2020-08-11 10:41:44 -07:00
Dinesh a1934797ea puppeteer: Migrate navigation test from casper.
Also adds a helper function that is used in later
tests too.
2020-08-11 10:41:44 -07:00
Dinesh 184b2b055d tests: Remove casper tests that were added in puppeteer. 2020-08-11 10:41:43 -07:00
Dinesh 3b3ed0c2d5 puppeteer: Replace `hidden: false` with `visible: true`.
I had a misconception with hidden and visible options
and thought `hidden: false` was same as `visible: true`
and other way too.

But `hidden: false` or `visible: false` does nothing
more than checking if the selector exists.

Also, to mention, `visible: false`'s were fixed in
33e19fa7d1
2020-08-11 10:41:36 -07:00
Anders Kaseorg fb2e56e3c9 docs: Fix capitalization of keyboard keys.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-11 10:25:53 -07:00
Anders Kaseorg c155403884 docs: Fix various capitalization errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-11 10:25:52 -07:00
Anders Kaseorg 768f9f93cd docs: Capitalize Markdown consistently.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-11 10:23:06 -07:00
Anders Kaseorg 60a25b2721 docs: Fix spelling errors caught by codespell.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-11 10:23:06 -07:00
Sahil Batra 33e19fa7d1
puppeteer: Replace 'visible: false' with 'hidden: true'.
We need to replace 'visible: false' with 'hidden: true' to wait
for elements to get hidden. Using 'visible: false' just checks
whether the selector exists or not and does not check whether
the element is hidden or not.
2020-08-10 16:48:53 -07:00
Steve Howell 8ba55b090a node fixtures: Add id field to realm_filters tuple. 2020-08-08 11:30:46 -04:00
Anders Kaseorg f63d132276 js: Use unminified KaTeX (and minifiy it with everything else).
Since our Webpack config passes pre-minified JS files to
script-loader, they can’t be used as modules.  Use the normal
unminified version, letting Webpack minify it and give us source maps.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-07 11:27:44 -07:00
Steve Howell 0825df76d9 node fixtures: Add timestamps for muted topics. 2020-08-06 12:29:43 -07:00
Steve Howell f8a0a3a87e node fixtures: Use more realistic timestamps. 2020-08-06 12:29:43 -07:00
Steve Howell e165629665 dispatch tests: Use better data for realm_export.
We also just make the test express what's actually
happening in the code; we just pass the entire
"exports" section of the event to the settings code
and let it do its thing.
2020-08-06 12:29:43 -07:00
Steve Howell e00e22553e node fixtures: Make attachment data realistic. 2020-08-06 12:29:43 -07:00
Tim Abbott beae13b4d6 recent_topics: Renaming confusingly named deletion handlers.
This functions were oddly named in a way that didn't make clear their
role in handling deleted messages.
2020-08-06 12:00:30 -07:00
Steve Howell d512594382 node fixtures: Use more realistic data for hotspots.
The only thing the dispatch tests really test here is
that we copy the data verbatim from the event into
page_params.
2020-08-05 11:35:47 -07:00