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`.
This commit is contained in:
Dinesh 2020-08-01 07:09:08 +00:00 committed by Tim Abbott
parent 90d956d2ed
commit 50a01311c0
2 changed files with 2 additions and 9 deletions

View File

@ -189,15 +189,9 @@ class CommonUtils {
password: credentials.password,
};
await this.fill_form(page, "#login_form", params);
await page.$eval("#login_form", (form) => form.submit());
// We wait until DOMContentLoaded event is fired to ensure that zulip JavaScript
// is executed since some of our tests access those through page.evaluate. We use defer
// tag for script tags that load JavaScript which means that whey will be executed after DOM
// is parsed but before DOMContentLoaded event is fired.
await Promise.all([
page.waitForNavigation({waitUntil: "domcontentloaded"}),
page.$eval("#login_form", (form) => form.submit()),
]);
await page.waitForSelector("#zhome .message_row", {visible: true});
}
async log_out(page) {

View File

@ -26,7 +26,6 @@ function get_last_element(array) {
}
async function test_send_messages(page) {
await page.waitForSelector("#zhome .message_row", {visible: true});
const initial_msgs_count = await page.evaluate(() => $("#zhome .message_row").length);
await common.send_multiple_messages(page, [