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>
We generally want to avoid clicking on DOM elements
that may not actually be visible due to the prior
operation. Instead, we can just find the visible
element after each step.
I also introduce a couple helper functions to
de-clutter the click/unclick/click steps, and I do
a couple extra clicks for good measure.
You can verify that the test will fail if you
add an early return to update_check_button_for_sub.
Commit f0f6138f01 deleted the
translation for "Saved. Please <a class='reload_link'>reload</a> for
the change to take effect." which caused puppeteer test 16-settings to
fail as it had hardcoded the translation for German. This commit
changes the expected text and hence fixes the failing puppeteer test.
This sets us up to use better system-wide data structures
for tracking subscribers.
Basically, instead of storing subscriber data on the
"sub" objects in stream_data.js, we instead have a
parallel data structure called stream_subscribers.
We also have stream_create, stream_edit, and friends
use helper functions rather than accessing
sub.subscribers directly.
We rename all_everyone_warn_threshold to
wildcard_mention_large_stream_threshold as we would
be adding wildcard_mention_policy and this
constant will also be used to show error
in case when wildcard_mention_policy is set
to admins only.
The failures saying incorrect password were caused due to
change in focus. Some actual code of ours calls focus on
the modal when opened but puppeteer was starting to type
before this occurs due to which the test was only able
to enter a part of string.
This was happening with change full name too but less
frequently as it's a relatively shorter string.
As a fix, we wait till the focus is on the modal and then
start typing.
Instead of prohibiting ‘return undefined’ (#8669), we require that a
function must return an explicit value always or never. This prevents
you from forgetting to return a value in some cases. It will also be
important for TypeScript, which distinguishes between undefined and
void.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
Wait for disable_stream_notifications selector to be visible
before clicking as it could cause flakes if the test tries
to click without it being visible.
Added a stronger validation of waiting for text "Verona" to
appear but that didn't really seem to have worked though it
seemed like fixing the flake by passing ~600 runs.
So, change the puppeteer click to a click through evaluate
as we had experiences where page.click() didn't work sometimes.
Though this has passed 1000 runs on CI, I'm not very certain
if this fixed it as this test passed 1000 times with my previous
PR fixing the same flake.
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.
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.
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.
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!
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"]" ...
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.
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
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.
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`.
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.
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>
Improved markup of help-text.
Showing Email as plain-text instead of disabled input.
Changed page heading to 'Create your organization' in realm creation form
and 'Create your account' in normal signup form.
Grouped org settings and user settings with fieldsets.
Reduced space between Password field and Password strength bar.
Also, updated the corresponding test cases.
Partially Fixes: #15750.