mirror of https://github.com/zulip/zulip.git
puppeteer_tests: Move to web/e2e-tests.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
cea1119423
commit
377b8b22c0
|
@ -131,7 +131,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["frontend_tests/puppeteer_lib/**", "frontend_tests/puppeteer_tests/**"],
|
"files": ["web/e2e-tests/**"],
|
||||||
"globals": {
|
"globals": {
|
||||||
"zulip_test": false
|
"zulip_test": false
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["frontend_tests/**", "web/tests/**"],
|
"files": ["web/e2e-tests/**", "web/tests/**"],
|
||||||
"globals": {
|
"globals": {
|
||||||
"CSS": false,
|
"CSS": false,
|
||||||
"document": false,
|
"document": false,
|
||||||
|
|
|
@ -79,7 +79,7 @@ templating systems.
|
||||||
|
|
||||||
- `web/tests/` Node Frontend unit tests.
|
- `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.
|
- `tools/test-*` Developer-facing test runner scripts.
|
||||||
|
|
||||||
|
|
|
@ -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
|
especially running specific subsets of the tests to save time when
|
||||||
debugging.
|
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
|
of various useful helper functions defined in
|
||||||
`frontend_tests/puppeteer_lib/common.ts`.
|
`web/e2e-tests/lib/common.ts`.
|
||||||
|
|
||||||
## How Puppeteer tests work
|
## How Puppeteer tests work
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ These tools/features are often useful when debugging:
|
||||||
See also [Puppeteer upstream's debugging
|
See also [Puppeteer upstream's debugging
|
||||||
tips](https://github.com/puppeteer/puppeteer#debugging-tips); some
|
tips](https://github.com/puppeteer/puppeteer#debugging-tips); some
|
||||||
tips may require temporary patches to functions like `run_test` or
|
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
|
## Writing Puppeteer tests
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ organization in Zulip). The following files are involved in the process:
|
||||||
|
|
||||||
**Frontend testing**
|
**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.
|
admin settings pages.
|
||||||
- `web/tests/dispatch.test.js`
|
- `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
|
**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
|
tests and blackbox end-to-end tests. The blackbox tests are run in a
|
||||||
headless Chromium browser using Puppeteer and are located in
|
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
|
module are located in `web/tests/`. For more
|
||||||
information on writing and running tests, see the
|
information on writing and running tests, see the
|
||||||
[testing documentation](../testing/testing.md).
|
[testing documentation](../testing/testing.md).
|
||||||
|
|
|
@ -26,7 +26,7 @@ if (options.messageId === undefined) {
|
||||||
process.exit(1);
|
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() {
|
async function run() {
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
args: [
|
args: [
|
||||||
|
|
|
@ -11,4 +11,3 @@ puppet/zulip_ops
|
||||||
zproject/dev_settings.py
|
zproject/dev_settings.py
|
||||||
zproject/test_settings.py
|
zproject/test_settings.py
|
||||||
zerver/tests
|
zerver/tests
|
||||||
frontend_tests
|
|
||||||
|
|
|
@ -27,10 +27,10 @@ os.environ.pop("https_proxy", "")
|
||||||
|
|
||||||
usage = """test-js-with-puppeteer [options]
|
usage = """test-js-with-puppeteer [options]
|
||||||
test-js-with-puppeteer # Run all test files
|
test-js-with-puppeteer # Run all test files
|
||||||
test-js-with-puppeteer navigation.ts # Run a single test file
|
test-js-with-puppeteer navigation.test.ts # Run a single test file
|
||||||
test-js-with-puppeteer navi # Run a single test file navigation.ts
|
test-js-with-puppeteer navi # Run a single test file navigation.test.ts
|
||||||
test-js-with-puppeteer login.ts compose.ts # Run a few test files
|
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.ts and compose.ts here"""
|
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)
|
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:
|
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)
|
test_files = find_js_test_files(test_dir, files)
|
||||||
total_tests = len(test_files)
|
total_tests = len(test_files)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {ElementHandle, Page} from "puppeteer";
|
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> {
|
async function submit_notifications_stream_settings(page: Page): Promise<void> {
|
||||||
await page.waitForSelector('#org-notifications .save-button[data-status="unsaved"]', {
|
await page.waitForSelector('#org-notifications .save-button[data-status="unsaved"]', {
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
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> {
|
async function check_compose_form_empty(page: Page): Promise<void> {
|
||||||
await common.check_compose_state(page, {
|
await common.check_compose_state(page, {
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
import type {Page} from "puppeteer";
|
||||||
|
|
||||||
import * as common from "../puppeteer_lib/common";
|
import * as common from "./lib/common";
|
||||||
|
|
||||||
async function copy_messages(
|
async function copy_messages(
|
||||||
page: Page,
|
page: Page,
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
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.
|
// 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)";
|
const profile_field_row = "#admin_profile_fields_table tr:nth-last-child(1)";
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
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> {
|
async function click_delete_and_return_last_msg_id(page: Page): Promise<string> {
|
||||||
const msg = (await page.$$("#zhome .message_row")).at(-1);
|
const msg = (await page.$$("#zhome .message_row")).at(-1);
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
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> {
|
async function wait_for_drafts_to_disappear(page: Page): Promise<void> {
|
||||||
await page.waitForSelector("#draft_overlay.show", {hidden: true});
|
await page.waitForSelector("#draft_overlay.show", {hidden: true});
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
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> {
|
async function trigger_edit_last_message(page: Page): Promise<void> {
|
||||||
const msg = (await page.$$("#zhome .message_row")).at(-1);
|
const msg = (await page.$$("#zhome .message_row")).at(-1);
|
|
@ -8,9 +8,9 @@ import puppeteer from "puppeteer";
|
||||||
import StackFrame from "stackframe";
|
import StackFrame from "stackframe";
|
||||||
import StackTraceGPS from "stacktrace-gps";
|
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");
|
const puppeteer_dir = path.join(root_dir, "var/puppeteer");
|
||||||
|
|
||||||
type Message = Record<string, string | boolean> & {recipient?: string; content: string};
|
type Message = Record<string, string | boolean> & {recipient?: string; content: string};
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
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> {
|
async function test_mention(page: Page): Promise<void> {
|
||||||
await common.log_in(page);
|
await common.log_in(page);
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
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> {
|
async function get_stream_li(page: Page, stream_name: string): Promise<string> {
|
||||||
const stream_id = await common.get_stream_id(page, stream_name);
|
const stream_id = await common.get_stream_id(page, stream_name);
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
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> {
|
async function navigate_using_left_sidebar(page: Page, click_target: string): Promise<void> {
|
||||||
console.log("Visiting #" + click_target);
|
console.log("Visiting #" + click_target);
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
import type {Page} from "puppeteer";
|
||||||
|
|
||||||
import * as common from "../puppeteer_lib/common";
|
import * as common from "./lib/common";
|
||||||
|
|
||||||
const email = "alice@test.example.com";
|
const email = "alice@test.example.com";
|
||||||
const subdomain = "testsubdomain";
|
const subdomain = "testsubdomain";
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
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> {
|
async function test_add_linkifier(page: Page): Promise<void> {
|
||||||
await page.waitForSelector(".admin-linkifier-form", {visible: true});
|
await page.waitForSelector(".admin-linkifier-form", {visible: true});
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
import type {Page} from "puppeteer";
|
||||||
|
|
||||||
import * as common from "../puppeteer_lib/common";
|
import * as common from "./lib/common";
|
||||||
|
|
||||||
type Playground = {
|
type Playground = {
|
||||||
playground_name: string;
|
playground_name: string;
|
|
@ -3,7 +3,8 @@ import {strict as assert} from "assert";
|
||||||
import type {ElementHandle, Page} from "puppeteer";
|
import type {ElementHandle, Page} from "puppeteer";
|
||||||
|
|
||||||
import {test_credentials} from "../../var/puppeteer/test_credentials";
|
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 OUTGOING_WEBHOOK_BOT_TYPE = "3";
|
||||||
const GENERIC_BOT_TYPE = "1";
|
const GENERIC_BOT_TYPE = "1";
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
import type {Page} from "puppeteer";
|
||||||
|
|
||||||
import * as common from "../puppeteer_lib/common";
|
import * as common from "./lib/common";
|
||||||
|
|
||||||
const message = "test star";
|
const message = "test star";
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
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> {
|
async function user_row_selector(page: Page, name: string): Promise<string> {
|
||||||
const user_id = await common.get_user_id_from_name(page, name);
|
const user_id = await common.get_user_id_from_name(page, name);
|
|
@ -1,6 +1,6 @@
|
||||||
import type {ElementHandle, Page} from "puppeteer";
|
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> {
|
async function test_subscription_button(page: Page): Promise<void> {
|
||||||
const stream_selector = "[data-stream-name='Venice']";
|
const stream_selector = "[data-stream-name='Venice']";
|
|
@ -2,7 +2,7 @@ import {strict as assert} from "assert";
|
||||||
|
|
||||||
import type {Page} from "puppeteer";
|
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> {
|
async function navigate_to_user_list(page: Page): Promise<void> {
|
||||||
const menu_selector = "#settings-dropdown";
|
const menu_selector = "#settings-dropdown";
|
|
@ -1,6 +1,6 @@
|
||||||
import type {Page} from "puppeteer";
|
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> {
|
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";
|
const menu_icon_selector = ".user_sidebar_entry:first-child .user-list-sidebar-menu-icon";
|
Loading…
Reference in New Issue