mirror of https://github.com/zulip/zulip.git
puppeteer_tests: Don’t read from most deprecated global variables.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
5182505302
commit
34e37cea1c
|
@ -105,7 +105,15 @@
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"files": ["frontend_tests/**", "static/js/**"],
|
"files": ["frontend_tests/puppeteer_lib/**", "frontend_tests/puppeteer_tests/**"],
|
||||||
|
"globals": {
|
||||||
|
"$": false,
|
||||||
|
"current_msg_list": false,
|
||||||
|
"page_params": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["frontend_tests/node_tests/**", "frontend_tests/zjsunit/**", "static/js/**"],
|
||||||
"globals": {
|
"globals": {
|
||||||
"$": false,
|
"$": false,
|
||||||
"FetchStatus": false,
|
"FetchStatus": false,
|
||||||
|
|
|
@ -39,9 +39,10 @@ class CommonUtils {
|
||||||
},
|
},
|
||||||
|
|
||||||
async expect(page, expected) {
|
async expect(page, expected) {
|
||||||
const actual_recipients = await page.evaluate(() =>
|
const actual_recipients = await page.evaluate(() => {
|
||||||
compose_state.private_message_recipient(),
|
const compose_state = window.require("./static/js/compose_state");
|
||||||
);
|
return compose_state.private_message_recipient();
|
||||||
|
});
|
||||||
assert.equal(actual_recipients, expected);
|
assert.equal(actual_recipients, expected);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -171,10 +172,10 @@ class CommonUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
async get_stream_id(page, stream_name) {
|
async get_stream_id(page, stream_name) {
|
||||||
return await page.evaluate(
|
return await page.evaluate((stream_name) => {
|
||||||
(stream_name) => stream_data.get_stream_id(stream_name),
|
const stream_data = window.require("./static/js/stream_data");
|
||||||
stream_name,
|
return stream_data.get_stream_id(stream_name);
|
||||||
);
|
}, stream_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
async get_user_id_from_name(page, name) {
|
async get_user_id_from_name(page, name) {
|
||||||
|
@ -279,6 +280,7 @@ class CommonUtils {
|
||||||
- does it look to have been
|
- does it look to have been
|
||||||
re-rendered based on server info?
|
re-rendered based on server info?
|
||||||
*/
|
*/
|
||||||
|
const rows = window.require("./static/js/rows");
|
||||||
const last_msg = current_msg_list.last();
|
const last_msg = current_msg_list.last();
|
||||||
if (last_msg === undefined) {
|
if (last_msg === undefined) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -359,6 +361,7 @@ class CommonUtils {
|
||||||
|
|
||||||
// Close the compose box after sending the message.
|
// Close the compose box after sending the message.
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
|
const compose_actions = window.require("./static/js/compose_actions");
|
||||||
compose_actions.cancel();
|
compose_actions.cancel();
|
||||||
});
|
});
|
||||||
// Make sure the compose box is closed.
|
// Make sure the compose box is closed.
|
||||||
|
|
|
@ -57,7 +57,10 @@ async function test_reload_hash(page) {
|
||||||
|
|
||||||
const initial_hash = await page.evaluate(() => window.location.hash);
|
const initial_hash = await page.evaluate(() => window.location.hash);
|
||||||
|
|
||||||
await page.evaluate(() => reload.initiate({immediate: true}));
|
await page.evaluate(() => {
|
||||||
|
const reload = window.require("./static/js/reload");
|
||||||
|
reload.initiate({immediate: true});
|
||||||
|
});
|
||||||
await page.waitForSelector("#zfilt", {visible: true});
|
await page.waitForSelector("#zfilt", {visible: true});
|
||||||
|
|
||||||
const page_load_time = await page.evaluate(() => page_params.page_load_time);
|
const page_load_time = await page.evaluate(() => page_params.page_load_time);
|
||||||
|
@ -72,7 +75,10 @@ async function navigation_tests(page) {
|
||||||
|
|
||||||
await navigate_to_settings(page);
|
await navigate_to_settings(page);
|
||||||
|
|
||||||
const verona_id = await page.evaluate(() => stream_data.get_stream_id("Verona"));
|
const verona_id = await page.evaluate(() => {
|
||||||
|
const stream_data = window.require("./static/js/stream_data");
|
||||||
|
return stream_data.get_stream_id("Verona");
|
||||||
|
});
|
||||||
const verona_narrow = `narrow/stream/${verona_id}-Verona`;
|
const verona_narrow = `narrow/stream/${verona_id}-Verona`;
|
||||||
|
|
||||||
await navigate_to(page, verona_narrow, "message_feed_container");
|
await navigate_to(page, verona_narrow, "message_feed_container");
|
||||||
|
|
|
@ -17,10 +17,12 @@ async function test_mention(page) {
|
||||||
await common.ensure_enter_does_not_send(page);
|
await common.ensure_enter_does_not_send(page);
|
||||||
|
|
||||||
console.log("Checking for all everyone warning");
|
console.log("Checking for all everyone warning");
|
||||||
const stream_size = await page.evaluate(() =>
|
const stream_size = await page.evaluate(() => {
|
||||||
stream_data.get_subscriber_count(stream_data.get_sub("Verona").stream_id),
|
const stream_data = window.require("./static/js/stream_data");
|
||||||
);
|
return stream_data.get_subscriber_count(stream_data.get_sub("Verona").stream_id);
|
||||||
|
});
|
||||||
const threshold = await page.evaluate(() => {
|
const threshold = await page.evaluate(() => {
|
||||||
|
const compose = window.require("./static/js/compose");
|
||||||
compose.wildcard_mention_large_stream_threshold = 5;
|
compose.wildcard_mention_large_stream_threshold = 5;
|
||||||
return compose.wildcard_mention_large_stream_threshold;
|
return compose.wildcard_mention_large_stream_threshold;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue