Skip to content

armgit / zulip

Public Imported from GitHub
0

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.json
index 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.md
index 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.md
index 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 when
debugging.
-The test files live in `frontend_tests/puppeteer_tests` and make use
+The test files live in `web/e2e-tests` and make use
of 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 debugging
tips](https://github.com/puppeteer/puppeteer#debugging-tips); some
tips 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 tests
diff --git a/docs/tutorials/new-feature-tutorial.md b/docs/tutorials/new-feature-tutorial.md
index 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 organization
admin 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 unit
tests and blackbox end-to-end tests. The blackbox tests are run in a
headless 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 more
information on writing and running tests, see the
[testing documentation](../testing/testing.md).
diff --git a/tools/message-screenshot.js b/tools/message-screenshot.js
index 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.ts
async function run() {
const browser = await puppeteer.launch({
args: [
diff --git a/tools/release-tarball-exclude.txt b/tools/release-tarball-exclude.txt
index cda0ccbf546..03e6b8b879f 100644
--- a/tools/release-tarball-exclude.txt
+++ b/tools/release-tarball-exclude.txt
@@ -11,4 +11,3 @@ puppet/zulip_ops
zproject/dev_settings.py
zproject/test_settings.py
zerver/tests
-frontend_tests
diff --git a/tools/test-js-with-puppeteer b/tools/test-js-with-puppeteer
index 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.ts
similarity index 99%
rename from frontend_tests/puppeteer_tests/admin.ts
rename to web/e2e-tests/admin.test.ts
index 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.ts
similarity index 99%
rename from frontend_tests/puppeteer_tests/compose.ts
rename to web/e2e-tests/compose.test.ts
index 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.ts
similarity index 99%
rename from frontend_tests/puppeteer_tests/copy-and-paste.ts
rename to web/e2e-tests/copy-and-paste.test.ts
index 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.ts
similarity index 98%
rename from frontend_tests/puppeteer_tests/custom-profile.ts
rename to web/e2e-tests/custom-profile.test.ts
index 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.ts
similarity index 96%
rename from frontend_tests/puppeteer_tests/delete-message.ts
rename to web/e2e-tests/delete-message.test.ts
index 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.ts
similarity index 99%
rename from frontend_tests/puppeteer_tests/drafts.ts
rename to web/e2e-tests/drafts.test.ts
index 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.ts
similarity index 98%
rename from frontend_tests/puppeteer_tests/edit.ts
rename to web/e2e-tests/edit.test.ts
index 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.ts
similarity index 99%
rename from frontend_tests/puppeteer_lib/common.ts
rename to web/e2e-tests/lib/common.ts
index 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.ts
similarity index 96%
rename from frontend_tests/puppeteer_tests/mention.ts
rename to web/e2e-tests/mention.test.ts
index 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.ts
similarity index 99%
rename from frontend_tests/puppeteer_tests/message-basics.ts
rename to web/e2e-tests/message-basics.test.ts
index 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.ts
similarity index 98%
rename from frontend_tests/puppeteer_tests/navigation.ts
rename to web/e2e-tests/navigation.test.ts
index 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.ts
similarity index 98%
rename from frontend_tests/puppeteer_tests/realm-creation.ts
rename to web/e2e-tests/realm-creation.test.ts
index 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.ts
similarity index 99%
rename from frontend_tests/puppeteer_tests/realm-linkifier.ts
rename to web/e2e-tests/realm-linkifier.test.ts
index 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.ts
similarity index 98%
rename from frontend_tests/puppeteer_tests/realm-playground.ts
rename to web/e2e-tests/realm-playground.test.ts
index 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.ts
similarity index 99%
rename from frontend_tests/puppeteer_tests/settings.ts
rename to web/e2e-tests/settings.test.ts
index 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.ts
similarity index 97%
rename from frontend_tests/puppeteer_tests/stars.ts
rename to web/e2e-tests/stars.test.ts
index 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.ts
similarity index 99%
rename from frontend_tests/puppeteer_tests/stream_create.ts
rename to web/e2e-tests/stream_create.test.ts
index 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.ts
similarity index 97%
rename from frontend_tests/puppeteer_tests/subscribe_toggle.ts
rename to web/e2e-tests/subscribe_toggle.test.ts
index 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.ts
similarity index 99%
rename from frontend_tests/puppeteer_tests/user-deactivation.ts
rename to web/e2e-tests/user-deactivation.test.ts
index 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.ts
similarity index 98%
rename from frontend_tests/puppeteer_tests/user-status.ts
rename to web/e2e-tests/user-status.test.ts
index 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";