Commit Graph

17 Commits

Author SHA1 Message Date
Anders Kaseorg b0253c5a2e eslint: Enable arrow-parens.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-03 16:53:39 -07:00
Priyank Patel cb7237c3aa puppeteer: Update the structure of common.get_rendered_messages.
This structure will allows us to verify correct interleaved view.
Design of the API was by Tim.
2020-06-16 11:40:30 -07:00
Dinesh 1201ecf332 puppeteer: Add 02-message-basic tests.
We plan to combine 02-site.js, 03-narrow.js of casper test into one
03-messages-basics.js tests in puppeteer.
2020-06-14 13:19:35 -07:00
Anders Kaseorg f0a19ed8e6 puppeteer_tests: Use assert in strict mode.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-05 16:05:51 -07:00
Dinesh c8268865dc puppeteer_tests: Extract a common function to fill forms.
Co-authored-by: Priyank Patel <priyankp390@gmail.com>
2020-06-03 17:38:03 -07:00
Dinesh d9cc081b2d puppeteer_tests: Move `log_in` and `log_out` functions to `common.js`.
Since `log_in` and `log_out` functions will also be used
in other tests, these are moved to `common.js`.
2020-06-03 17:38:02 -07:00
Priyank Patel f91548ec02 puppeteer: Wait until DOMContentLoaded event for realm creation tests.
This is done to avoid flakes where our code for focusing first input
interferes with puppeteer's typing. More details in comments.

Thanks Dinesh for testing this out earlier as part finding a solution
to this flake.

Co-authored-by: Dinesh <chdinesh1089@gmail.com>
2020-06-03 17:33:04 -07:00
Priyank Patel 60fa848aea puppetter: Add a waitForNavigation call before asserting the url.
Since we are doing a assert call checking a url without no page.waitForSelector
or similar calls, we add this to avoid flakes where the assert is called
when we are in process of navigation to the page. Also, we use Promise.all
here, and call page.waitForNavigation first, to avoid race conditions where
form is submitted quickly and navigation occurs and then we are stuck waiting
for a navigation. There were no flakes in the CI related to this issue, but
I expect someone with a slow hardware would probably stumble upto this in future.
2020-05-27 12:53:17 -07:00
Priyank Patel 60c92b69c5 puppeteer: Make the subdomain input field visible before typing into it.
We were missing the step for clicking the checkbox to show the subdomain
input field. There was a flake because of this issue in CI where the
"testsubdomain" input was getting typed into the name field. This fixes
that flake.
2020-05-27 12:53:17 -07:00
Priyank Patel 9d982d3c0e puppeteer: Fix test flake in 01-login.js.
There were two reason there were flakes in login tests. One problem was
that the assert call for checking that the login page url was happening
too early in rare cases. To fix this issue we wait for email input field
element in the login page. The second issue was the sometimes the url was
/login/ instead of /accounts/login/. The time between the redirect were
super close here too (around ~10ms) so I am suprised this didn't occur flake
locally more often.

Server logs that show the redirect:
2020-05-26 18:55:27.065 INFO [zr] 127.0.0.1       GET     200  36ms (db: 5ms/2q) (+start: 14ms) /accounts/login/ (unauth@zulip via ?)
2020-05-26 18:55:27.074 INFO [zr] 127.0.0.1       GET     200  28ms (db: 3ms/2q) (+start: 23ms) /login/ (unauth@zulip via ?)
2020-05-27 12:53:14 -07:00
Priyank Patel 0b698d1173 puppeteer: Take screenshot on failure.
To take a screenshot on failure where we have our common error
handling code in common.run_test method we need to have access to
the Page instance. Currently, we create a new Page in the test method
we pass into run_test, so we pass in a new Page instance to that method
so the test and the run_test method have access to the same Page. And,
then we take a screenshot on failure. It will be saved as `failure-${num}`
in var/puppeteer directory.
2020-05-27 12:50:22 -07:00
Priyank Patel 1f367ed537 puppeteer: Rename run functions to something more descriptive. 2020-05-19 15:58:04 -07:00
Priyank Patel d0a7540534 puppeteer: Add run_test method to common.
This method does all error handling and removes ~5-6 lines of try/catch
block across each test file.
2020-05-19 15:58:04 -07:00
Priyank Patel 41447a0d5c puppeteer: Add a common module for resuable code.
In common.js, we now have a single browser instance for the whole
test. When we update the test-js-with-puppetter to spawn a single
node process, like we do for node tests, we will save time on having
to open an new browser for every test + puppetter start up cost.

We will also add some more helpers here like a method for
filling out a form easily etc.
2020-05-19 15:58:04 -07:00
Dinesh ab64d7936f puppeteer_tests: Remove explicit redirect from confirmation page.
Before fixing `test-js-with-puppeteer` to to use the right webpack
setup, redirects weren't happening properly. The line this commit
removes did a redirect to the register page. This line is removed
as the redirect will happen automatically as expected with fixing
`test-js-with-puppeteer`.
2020-05-19 15:54:00 -07:00
Dinesh 49f7355f40 tests: Create login test using puppeteer. 2020-05-19 15:52:26 -07:00
Dinesh 8062192759 tests: Add realm creation test using puppeteer. 2020-04-02 15:37:12 -07:00