Commit Graph

3245 Commits

Author SHA1 Message Date
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
Steve Howell a93a3dc90c node fixtures: Make "op" more explicit.
We follow the naming convention.

I also arbitrarily assign the "op" of
"add" to the attachment event, even
though we don't meaningfully test it.

The situation with attachment from the
dispatch test point of view is that
we just want to test that the one line
of code that calls into attachments_ui
(for all three ops) does get dispatched
correctly.  We eventually want to get
deeper coverage there, but attachments_ui
wasn't written in the most test-friendly
way.  I think it might actually be easy
to fix up attachments_ui to make it a
bit easier to test, but it's out of the
scope of my current PR.

The benefit here is check-node-fixtures
now gives a more concrete plan for
moving schemas to event_schema.py.
2020-08-05 11:35:44 -07:00
Steve Howell f4eaf077f8 node fixtures: Clean up realm_emoji data.
We extract test_realm_emojis, and we make
the name of the event more explicit (adding
the __update suffix).

We also add the "op" of "update" here, which
is sort of a quirk of the api, since we don't
actually have alternatives like add/remove,
and therefore the current frontend code doesn't
look at the "op", and thus the original tests
never had to provide a correct value for it.
2020-08-05 18:07:16 +00:00
Steve Howell 0c1f909c7a node fixtures: Fix stream__delete fixture. 2020-08-05 18:07:16 +00:00
Ryan Rehman 60eef68f59 refactor: Extract `set_up_typeahead_on_pills` to a new file.
We move this function from `user_pill.js` to `pill_typeahead.js`.
The function has also been renamed to `set_up`.

The move was made because there are plans to update the pills
typeahead (i.e. to include user-groups/streams in the results).
Thus this function should not belong in `user_pill.js`.
2020-08-04 15:58:12 -07:00
Anders Kaseorg a0a0189df1 puppeteer_tests: Fix Prettier formatting of 05-stars.js.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-04 15:51:54 -07:00
Ryan Rehman b4888c1251 subscriptions: Refactor template rendering of `stream_privacy_policy`.
This makes it similar to `stream_post_policy`.
2020-08-04 15:48:35 -07:00
Ryan Rehman 73fac8e1d7 toggler: Allow skipping over disabled tabs.
This commit allows skipping over any disabled tabs
that are in the middle when using the left or right
arrow keys.

We also add `enable_tab` to the `components` API.
2020-08-04 15:48:34 -07:00
Aman Agrawal 1b05f8e6c9 stream_topic_history: Update max msg id of stream post msg deletion.
After the latest message in a stream is deleted, we should update
the max_message_id in the stream.

Removed false comment in message_util.get_messages_in_topic
this method only takes 2ms for 10,000 messages loaded locally.
2020-08-04 15:29:03 -07:00
Aman Agrawal b32dc5e58f stream_topic_history: Update topic last msg_id after msg deletion.
Fixes #15992.
If the last message of the topic was deleted, we update the stored
message_id in the topic history so that the topic order in topic_list
is updated correctly.
2020-08-04 15:29:03 -07:00
Dinesh b05bb93425 puppeteer: Add edit test. 2020-08-04 14:41:00 -07:00
Dinesh 31b46fd0ee puppeteer: Add stars test. 2020-08-04 14:40:59 -07:00
Dinesh 50a01311c0 puppeteer: Fix messages not being echoed locally.
When messages weren't locally echoed,
`wait_for_full_processes_message` fails to assert that the message
is being sent. It was figured out by tabbott that the messages
aren't locally echoed because of content no loading completely.

So, this commit changes the `log_in` function to wait till
the selector '#zhome .message_row' is visible which indicates
that the cotent is loaded.

Removed the waitForNavigation in the `log_in` as it would
become a redundant check after this change.

Also removed this same check present in 03-compose.js which
becomes reduntant as we already do it in `log_in`.
2020-08-04 14:33:37 -07:00
Dinesh 90d956d2ed puppeteer: Rename settings test to be the last test.
This test changes user password causing all subsequent
tests to fail. Since rechanging the password would be
a redudant test/task or having manually entering the
new password in every test after this aren't good ideas,
this commit makes the settings test run in the end by
renaming it be numbered 16. It is assumed that we'll
end up having 16 tests seeing the number of tests in
casper and considering 03 and 02 from casper are being
combined as 02-message-basics.js. Though 03 of casper
has not yet been added in message-basics test it will
soon be added.
2020-08-04 14:33:37 -07:00
Anders Kaseorg 6ec808b8df js: Add "use strict" directive to CommonJS files.
ES and TypeScript modules are strict by default and don’t need this
directive.  ESLint will remind us to add it to new CommonJS files and
remove it from ES and TypeScript modules.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 22:09:46 -07:00
Anders Kaseorg 39c3a02736 casper_tests: Replace const with var.
Apparently "use strict" also makes PhantomJS more strict about syntax
it doesn’t support.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 22:09:46 -07:00
Anders Kaseorg 48102c15a3 node_tests: Add missing mock children.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 22:09:46 -07:00