page_params: Move page_load_time to zulip_test.

This isn’t sent by the server; it’s a client-side global variable.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-12-28 17:23:51 -08:00
committed by Anders Kaseorg
parent baf6c68ab8
commit 2cf8f1c063
4 changed files with 6 additions and 6 deletions

View File

@@ -64,9 +64,7 @@ async function navigate_to_private_messages(page: Page): Promise<void> {
} }
async function test_reload_hash(page: Page): Promise<void> { async function test_reload_hash(page: Page): Promise<void> {
const initial_page_load_time = await page.evaluate( const initial_page_load_time = await page.evaluate((): number => zulip_test.page_load_time);
(): number => zulip_test.page_params.page_load_time,
);
console.log(`initial load time: ${initial_page_load_time}`); console.log(`initial load time: ${initial_page_load_time}`);
const initial_hash = await page.evaluate(() => window.location.hash); const initial_hash = await page.evaluate(() => window.location.hash);
@@ -75,7 +73,7 @@ async function test_reload_hash(page: Page): Promise<void> {
await page.waitForNavigation(); await page.waitForNavigation();
await page.waitForSelector("#zfilt", {visible: true}); await page.waitForSelector("#zfilt", {visible: true});
const page_load_time = await page.evaluate(() => zulip_test.page_params.page_load_time); const page_load_time = await page.evaluate(() => zulip_test.page_load_time);
assert.ok(page_load_time > initial_page_load_time, "Page not reloaded."); assert.ok(page_load_time > initial_page_load_time, "Page not reloaded.");
const hash = await page.evaluate(() => window.location.hash); const hash = await page.evaluate(() => window.location.hash);

View File

@@ -47,7 +47,6 @@ export const page_params: {
narrow_stream?: string; narrow_stream?: string;
narrow: Term[]; narrow: Term[];
needs_tutorial: boolean; needs_tutorial: boolean;
page_load_time: number;
promote_sponsoring_zulip: boolean; promote_sponsoring_zulip: boolean;
realm_add_custom_emoji_policy: number; realm_add_custom_emoji_policy: number;
realm_available_video_chat_providers: { realm_available_video_chat_providers: {

View File

@@ -5,6 +5,8 @@ import * as loading from "./loading";
import {page_params} from "./page_params"; import {page_params} from "./page_params";
import * as util from "./util"; import * as util from "./util";
export let page_load_time: number | undefined;
// Miscellaneous early setup. // Miscellaneous early setup.
$(() => { $(() => {
if (util.is_mobile()) { if (util.is_mobile()) {
@@ -12,7 +14,7 @@ $(() => {
page_params.needs_tutorial = false; page_params.needs_tutorial = false;
} }
page_params.page_load_time = Date.now(); page_load_time = Date.now();
// Display loading indicator. This disappears after the first // Display loading indicator. This disappears after the first
// get_events completes. // get_events completes.

View File

@@ -11,4 +11,5 @@ export {last_visible as last_visible_row, id as row_id} from "./rows";
export {cancel as cancel_compose} from "./compose_actions"; export {cancel as cancel_compose} from "./compose_actions";
export {page_params, page_params_parse_time} from "./page_params"; export {page_params, page_params_parse_time} from "./page_params";
export {initiate as initiate_reload} from "./reload"; export {initiate as initiate_reload} from "./reload";
export {page_load_time} from "./setup";
export {add_user_id_to_new_stream} from "./stream_create_subscribers"; export {add_user_id_to_new_stream} from "./stream_create_subscribers";