Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
puppeteer_tests: Move to web/e2e-tests.
Anders Kaseorg377b8b22c027
diff --git a/.eslintrc.json b/.eslintrc.jsonindex 0d133150ba3..bd4a8485175 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -131,7 +131,7 @@}},{- "files": ["frontend_tests/puppeteer_lib/**", "frontend_tests/puppeteer_tests/**"],+ "files": ["web/e2e-tests/**"],"globals": {"zulip_test": false}@@ -202,7 +202,7 @@}},{- "files": ["frontend_tests/**", "web/tests/**"],+ "files": ["web/e2e-tests/**", "web/tests/**"],"globals": {"CSS": false,"document": false,diff --git a/docs/overview/directory-structure.md b/docs/overview/directory-structure.mdindex e53b863c53c..7708ef3f626 100644--- a/docs/overview/directory-structure.md+++ b/docs/overview/directory-structure.md@@ -79,7 +79,7 @@ templating systems.- `web/tests/` Node Frontend unit tests.-- `frontend_tests/puppeteer_tests/` Puppeteer frontend integration tests.+- `web/e2e-tests/` Puppeteer frontend integration tests.- `tools/test-*` Developer-facing test runner scripts.diff --git a/docs/testing/testing-with-puppeteer.md b/docs/testing/testing-with-puppeteer.mdindex 6750388efe4..c18845b8339 100644--- a/docs/testing/testing-with-puppeteer.md+++ b/docs/testing/testing-with-puppeteer.md@@ -19,9 +19,9 @@ See `tools/test-js-with-puppeteer --help` for useful options,especially running specific subsets of the tests to save time whendebugging.-The test files live in `frontend_tests/puppeteer_tests` and make use+The test files live in `web/e2e-tests` and make useof various useful helper functions defined in-`frontend_tests/puppeteer_lib/common.ts`.+`web/e2e-tests/lib/common.ts`.## How Puppeteer tests work@@ -123,7 +123,7 @@ These tools/features are often useful when debugging:See also [Puppeteer upstream's debuggingtips](https://github.com/puppeteer/puppeteer#debugging-tips); sometips may require temporary patches to functions like `run_test` or-`ensure_browser` in `frontend_tests/puppeteer_lib/common.ts`.+`ensure_browser` in `web/e2e-tests/lib/common.ts`.## Writing Puppeteer testsdiff --git a/docs/tutorials/new-feature-tutorial.md b/docs/tutorials/new-feature-tutorial.mdindex 2a1e8050015..919b6362b02 100644--- a/docs/tutorials/new-feature-tutorial.md+++ b/docs/tutorials/new-feature-tutorial.md@@ -60,7 +60,7 @@ organization in Zulip). The following files are involved in the process:**Frontend testing**-- `frontend_tests/puppeteer_tests/admin.ts`: end-to-end tests for the organization+- `web/e2e-tests/admin.test.ts`: end-to-end tests for the organizationadmin settings pages.- `web/tests/dispatch.test.js`@@ -144,7 +144,7 @@ or JavaScript/TypeScript/Python code that generates user-facing strings, be sure**Testing:** There are two types of frontend tests: node-based unittests and blackbox end-to-end tests. The blackbox tests are run in aheadless Chromium browser using Puppeteer and are located in-`frontend_tests/puppeteer_tests/`. The unit tests use Node's `assert`+`web/e2e-tests/`. The unit tests use Node's `assert`module are located in `web/tests/`. For moreinformation on writing and running tests, see the[testing documentation](../testing/testing.md).diff --git a/tools/message-screenshot.js b/tools/message-screenshot.jsindex 8b24e44b548..639daf62f25 100644--- a/tools/message-screenshot.js+++ b/tools/message-screenshot.js@@ -26,7 +26,7 @@ if (options.messageId === undefined) {process.exit(1);}-// TODO: Refactor to share code with frontend_tests/puppeteer_tests/realm-creation.ts+// TODO: Refactor to share code with web/e2e-tests/realm-creation.test.tsasync function run() {const browser = await puppeteer.launch({args: [diff --git a/tools/release-tarball-exclude.txt b/tools/release-tarball-exclude.txtindex cda0ccbf546..03e6b8b879f 100644--- a/tools/release-tarball-exclude.txt+++ b/tools/release-tarball-exclude.txt@@ -11,4 +11,3 @@ puppet/zulip_opszproject/dev_settings.pyzproject/test_settings.pyzerver/tests-frontend_testsdiff --git a/tools/test-js-with-puppeteer b/tools/test-js-with-puppeteerindex 1aae323df1f..3fca983ddf8 100755--- a/tools/test-js-with-puppeteer+++ b/tools/test-js-with-puppeteer@@ -27,10 +27,10 @@ os.environ.pop("https_proxy", "")usage = """test-js-with-puppeteer [options]test-js-with-puppeteer # Run all test files- test-js-with-puppeteer navigation.ts # Run a single test file- test-js-with-puppeteer navi # Run a single test file navigation.ts- test-js-with-puppeteer login.ts compose.ts # Run a few test files- test-js-with-puppeteer login compose # Run a few test files, login.ts and compose.ts here"""+ test-js-with-puppeteer navigation.test.ts # Run a single test file+ test-js-with-puppeteer navi # Run a single test file navigation.test.ts+ test-js-with-puppeteer login.test.ts compose.test.ts # Run a few test files+ test-js-with-puppeteer login compose # Run a few test files, login.test.ts and compose.test.ts here"""sys.path.insert(0, ZULIP_PATH)@@ -92,7 +92,7 @@ def run_single_test(test_file: str, test_number: int, total_tests: int) -> int:def run_tests(files: Iterable[str], external_host: str, loop: int = 1) -> None:- test_dir = os.path.join(ZULIP_PATH, "frontend_tests/puppeteer_tests")+ test_dir = os.path.join(ZULIP_PATH, "web/e2e-tests")test_files = find_js_test_files(test_dir, files)total_tests = len(test_files)diff --git a/frontend_tests/puppeteer_tests/admin.ts b/web/e2e-tests/admin.test.tssimilarity index 99%rename from frontend_tests/puppeteer_tests/admin.tsrename to web/e2e-tests/admin.test.tsindex 85fa12e490f..9eb19de8a8a 100644--- a/frontend_tests/puppeteer_tests/admin.ts+++ b/web/e2e-tests/admin.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {ElementHandle, Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function submit_notifications_stream_settings(page: Page): Promise<void> {await page.waitForSelector('#org-notifications .save-button[data-status="unsaved"]', {diff --git a/frontend_tests/puppeteer_tests/compose.ts b/web/e2e-tests/compose.test.tssimilarity index 99%rename from frontend_tests/puppeteer_tests/compose.tsrename to web/e2e-tests/compose.test.tsindex 0e777755801..e01a5dba7a5 100644--- a/frontend_tests/puppeteer_tests/compose.ts+++ b/web/e2e-tests/compose.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function check_compose_form_empty(page: Page): Promise<void> {await common.check_compose_state(page, {diff --git a/frontend_tests/puppeteer_tests/copy-and-paste.ts b/web/e2e-tests/copy-and-paste.test.tssimilarity index 99%rename from frontend_tests/puppeteer_tests/copy-and-paste.tsrename to web/e2e-tests/copy-and-paste.test.tsindex 0d0e5e5d628..40a73c49592 100644--- a/frontend_tests/puppeteer_tests/copy-and-paste.ts+++ b/web/e2e-tests/copy-and-paste.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function copy_messages(page: Page,diff --git a/frontend_tests/puppeteer_tests/custom-profile.ts b/web/e2e-tests/custom-profile.test.tssimilarity index 98%rename from frontend_tests/puppeteer_tests/custom-profile.tsrename to web/e2e-tests/custom-profile.test.tsindex 6a7d2992c16..e2e882b68aa 100644--- a/frontend_tests/puppeteer_tests/custom-profile.ts+++ b/web/e2e-tests/custom-profile.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";// This will be the row of the the custom profile field we add.const profile_field_row = "#admin_profile_fields_table tr:nth-last-child(1)";diff --git a/frontend_tests/puppeteer_tests/delete-message.ts b/web/e2e-tests/delete-message.test.tssimilarity index 96%rename from frontend_tests/puppeteer_tests/delete-message.tsrename to web/e2e-tests/delete-message.test.tsindex 027b30b0bf1..e1fc893f23a 100644--- a/frontend_tests/puppeteer_tests/delete-message.ts+++ b/web/e2e-tests/delete-message.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function click_delete_and_return_last_msg_id(page: Page): Promise<string> {const msg = (await page.$$("#zhome .message_row")).at(-1);diff --git a/frontend_tests/puppeteer_tests/drafts.ts b/web/e2e-tests/drafts.test.tssimilarity index 99%rename from frontend_tests/puppeteer_tests/drafts.tsrename to web/e2e-tests/drafts.test.tsindex df5859e64c3..3263c3afb36 100644--- a/frontend_tests/puppeteer_tests/drafts.ts+++ b/web/e2e-tests/drafts.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function wait_for_drafts_to_disappear(page: Page): Promise<void> {await page.waitForSelector("#draft_overlay.show", {hidden: true});diff --git a/frontend_tests/puppeteer_tests/edit.ts b/web/e2e-tests/edit.test.tssimilarity index 98%rename from frontend_tests/puppeteer_tests/edit.tsrename to web/e2e-tests/edit.test.tsindex 482d1019bd7..26847c03b9e 100644--- a/frontend_tests/puppeteer_tests/edit.ts+++ b/web/e2e-tests/edit.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function trigger_edit_last_message(page: Page): Promise<void> {const msg = (await page.$$("#zhome .message_row")).at(-1);diff --git a/frontend_tests/puppeteer_lib/common.ts b/web/e2e-tests/lib/common.tssimilarity index 99%rename from frontend_tests/puppeteer_lib/common.tsrename to web/e2e-tests/lib/common.tsindex d723a6d0bc0..357fefee80f 100644--- a/frontend_tests/puppeteer_lib/common.ts+++ b/web/e2e-tests/lib/common.ts@@ -8,9 +8,9 @@ import puppeteer from "puppeteer";import StackFrame from "stackframe";import StackTraceGPS from "stacktrace-gps";-import {test_credentials} from "../../var/puppeteer/test_credentials";+import {test_credentials} from "../../../var/puppeteer/test_credentials";-const root_dir = path.resolve(__dirname, "../../");+const root_dir = path.resolve(__dirname, "../../..");const puppeteer_dir = path.join(root_dir, "var/puppeteer");type Message = Record<string, string | boolean> & {recipient?: string; content: string};diff --git a/frontend_tests/puppeteer_tests/mention.ts b/web/e2e-tests/mention.test.tssimilarity index 96%rename from frontend_tests/puppeteer_tests/mention.tsrename to web/e2e-tests/mention.test.tsindex 7a4561f1830..b4ff8aa9669 100644--- a/frontend_tests/puppeteer_tests/mention.ts+++ b/web/e2e-tests/mention.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function test_mention(page: Page): Promise<void> {await common.log_in(page);diff --git a/frontend_tests/puppeteer_tests/message-basics.ts b/web/e2e-tests/message-basics.test.tssimilarity index 99%rename from frontend_tests/puppeteer_tests/message-basics.tsrename to web/e2e-tests/message-basics.test.tsindex 423fd9d5c24..eac4a34e58e 100644--- a/frontend_tests/puppeteer_tests/message-basics.ts+++ b/web/e2e-tests/message-basics.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function get_stream_li(page: Page, stream_name: string): Promise<string> {const stream_id = await common.get_stream_id(page, stream_name);diff --git a/frontend_tests/puppeteer_tests/navigation.ts b/web/e2e-tests/navigation.test.tssimilarity index 98%rename from frontend_tests/puppeteer_tests/navigation.tsrename to web/e2e-tests/navigation.test.tsindex 527c651384e..bf7ee6ea043 100644--- a/frontend_tests/puppeteer_tests/navigation.ts+++ b/web/e2e-tests/navigation.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function navigate_using_left_sidebar(page: Page, click_target: string): Promise<void> {console.log("Visiting #" + click_target);diff --git a/frontend_tests/puppeteer_tests/realm-creation.ts b/web/e2e-tests/realm-creation.test.tssimilarity index 98%rename from frontend_tests/puppeteer_tests/realm-creation.tsrename to web/e2e-tests/realm-creation.test.tsindex 2529ac03f32..24225dfb6db 100644--- a/frontend_tests/puppeteer_tests/realm-creation.ts+++ b/web/e2e-tests/realm-creation.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";const email = "[email protected]";const subdomain = "testsubdomain";diff --git a/frontend_tests/puppeteer_tests/realm-linkifier.ts b/web/e2e-tests/realm-linkifier.test.tssimilarity index 99%rename from frontend_tests/puppeteer_tests/realm-linkifier.tsrename to web/e2e-tests/realm-linkifier.test.tsindex 713d89faed7..5c7951cf0a5 100644--- a/frontend_tests/puppeteer_tests/realm-linkifier.ts+++ b/web/e2e-tests/realm-linkifier.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function test_add_linkifier(page: Page): Promise<void> {await page.waitForSelector(".admin-linkifier-form", {visible: true});diff --git a/frontend_tests/puppeteer_tests/realm-playground.ts b/web/e2e-tests/realm-playground.test.tssimilarity index 98%rename from frontend_tests/puppeteer_tests/realm-playground.tsrename to web/e2e-tests/realm-playground.test.tsindex d5168837d04..fbec9d30a50 100644--- a/frontend_tests/puppeteer_tests/realm-playground.ts+++ b/web/e2e-tests/realm-playground.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";type Playground = {playground_name: string;diff --git a/frontend_tests/puppeteer_tests/settings.ts b/web/e2e-tests/settings.test.tssimilarity index 99%rename from frontend_tests/puppeteer_tests/settings.tsrename to web/e2e-tests/settings.test.tsindex 77258f33988..ed8792cd461 100644--- a/frontend_tests/puppeteer_tests/settings.ts+++ b/web/e2e-tests/settings.test.ts@@ -3,7 +3,8 @@ import {strict as assert} from "assert";import type {ElementHandle, Page} from "puppeteer";import {test_credentials} from "../../var/puppeteer/test_credentials";-import * as common from "../puppeteer_lib/common";++import * as common from "./lib/common";const OUTGOING_WEBHOOK_BOT_TYPE = "3";const GENERIC_BOT_TYPE = "1";diff --git a/frontend_tests/puppeteer_tests/stars.ts b/web/e2e-tests/stars.test.tssimilarity index 97%rename from frontend_tests/puppeteer_tests/stars.tsrename to web/e2e-tests/stars.test.tsindex 388180010d7..740bde70b8b 100644--- a/frontend_tests/puppeteer_tests/stars.ts+++ b/web/e2e-tests/stars.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";const message = "test star";diff --git a/frontend_tests/puppeteer_tests/stream_create.ts b/web/e2e-tests/stream_create.test.tssimilarity index 99%rename from frontend_tests/puppeteer_tests/stream_create.tsrename to web/e2e-tests/stream_create.test.tsindex 2245b803034..14e8fd1e89c 100644--- a/frontend_tests/puppeteer_tests/stream_create.ts+++ b/web/e2e-tests/stream_create.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function user_row_selector(page: Page, name: string): Promise<string> {const user_id = await common.get_user_id_from_name(page, name);diff --git a/frontend_tests/puppeteer_tests/subscribe_toggle.ts b/web/e2e-tests/subscribe_toggle.test.tssimilarity index 97%rename from frontend_tests/puppeteer_tests/subscribe_toggle.tsrename to web/e2e-tests/subscribe_toggle.test.tsindex 88bf65524c9..0075a2d6c50 100644--- a/frontend_tests/puppeteer_tests/subscribe_toggle.ts+++ b/web/e2e-tests/subscribe_toggle.test.ts@@ -1,6 +1,6 @@import type {ElementHandle, Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function test_subscription_button(page: Page): Promise<void> {const stream_selector = "[data-stream-name='Venice']";diff --git a/frontend_tests/puppeteer_tests/user-deactivation.ts b/web/e2e-tests/user-deactivation.test.tssimilarity index 99%rename from frontend_tests/puppeteer_tests/user-deactivation.tsrename to web/e2e-tests/user-deactivation.test.tsindex 4244ab25cf4..e949247a365 100644--- a/frontend_tests/puppeteer_tests/user-deactivation.ts+++ b/web/e2e-tests/user-deactivation.test.ts@@ -2,7 +2,7 @@ import {strict as assert} from "assert";import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function navigate_to_user_list(page: Page): Promise<void> {const menu_selector = "#settings-dropdown";diff --git a/frontend_tests/puppeteer_tests/user-status.ts b/web/e2e-tests/user-status.test.tssimilarity index 98%rename from frontend_tests/puppeteer_tests/user-status.tsrename to web/e2e-tests/user-status.test.tsindex 2541742423b..9d5df5f6de6 100644--- a/frontend_tests/puppeteer_tests/user-status.ts+++ b/web/e2e-tests/user-status.test.ts@@ -1,6 +1,6 @@import type {Page} from "puppeteer";-import * as common from "../puppeteer_lib/common";+import * as common from "./lib/common";async function open_set_user_status_modal(page: Page): Promise<void> {const menu_icon_selector = ".user_sidebar_entry:first-child .user-list-sidebar-menu-icon";