snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
This commit is contained in:
90
web/e2e-tests/realm-creation.test.ts
Normal file
90
web/e2e-tests/realm-creation.test.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import type {Page} from "puppeteer";
|
||||
import * as z from "zod/mini";
|
||||
|
||||
import * as common from "./lib/common.ts";
|
||||
|
||||
const email = "alice@test.example.com";
|
||||
const organization_name = "Awesome Organization";
|
||||
const host = "zulipdev.com:9981";
|
||||
|
||||
async function realm_creation_tests(page: Page): Promise<void> {
|
||||
await page.goto("http://" + host + "/new/");
|
||||
|
||||
// submit the email for realm creation.
|
||||
await page.waitForSelector("#email");
|
||||
await page.type("#email", email);
|
||||
await page.type("#id_team_name", organization_name);
|
||||
await page.select("#realm_type", "business");
|
||||
await page.$eval("input#realm_in_root_domain", (el) => {
|
||||
el.click();
|
||||
});
|
||||
|
||||
await Promise.all([
|
||||
page.waitForNavigation(),
|
||||
page.$eval("form#create_realm", (form) => {
|
||||
form.submit();
|
||||
}),
|
||||
]);
|
||||
|
||||
// Make sure confirmation email is sent.
|
||||
assert.ok(page.url().includes("/accounts/new/send_confirm/?email=alice%40test.example.com"));
|
||||
|
||||
// Special endpoint enabled only during tests for extracting confirmation key
|
||||
await page.goto("http://" + host + "/confirmation_key/");
|
||||
|
||||
// Open the confirmation URL
|
||||
const page_content = await page.evaluate(() => document.querySelector("body")!.textContent);
|
||||
assert.ok(page_content !== null);
|
||||
const {confirmation_key} = z
|
||||
.object({confirmation_key: z.string()})
|
||||
.parse(JSON.parse(page_content));
|
||||
const confirmation_url = `http://${host}/accounts/do_confirm/${confirmation_key}`;
|
||||
await page.goto(confirmation_url);
|
||||
|
||||
// We wait until the DOMContentLoaded event because we want the code
|
||||
// that focuses the first input field to run before we run our tests to avoid
|
||||
// flakes. Without waiting for DOMContentLoaded event, in rare cases, the
|
||||
// first input is focused when we are typing something for other fields causing
|
||||
// validation errors. The code for focusing the input is wrapped in jQuery
|
||||
// $() calls which runs when DOMContentLoaded is fired.
|
||||
await page.waitForNavigation({waitUntil: "domcontentloaded"});
|
||||
|
||||
// Make sure the realm creation page is loaded correctly by
|
||||
// checking the text in <p> tag under pitch class is as expected.
|
||||
await page.waitForSelector(".pitch");
|
||||
const text_in_pitch = await page.evaluate(
|
||||
() => document.querySelector(".pitch p")!.textContent,
|
||||
);
|
||||
assert.equal(text_in_pitch, "Enter your account details to complete registration.");
|
||||
|
||||
// fill the form.
|
||||
const params = {
|
||||
full_name: "Alice",
|
||||
password: "passwordwhichisnotreallycomplex",
|
||||
terms: true,
|
||||
how_realm_creator_found_zulip: "other",
|
||||
how_realm_creator_found_zulip_other_text: "test",
|
||||
};
|
||||
// For some reason, page.click() does not work this for particular checkbox
|
||||
// so use page.$eval here to call the .click method in the browser.
|
||||
await common.fill_form(page, "#registration", params);
|
||||
await page.$eval("form#registration", (form) => {
|
||||
form.submit();
|
||||
});
|
||||
|
||||
// Check if realm is created and user is logged in by checking if
|
||||
// element of id `lightbox_overlay` exists.
|
||||
await page.waitForSelector("#lightbox_overlay"); // if element doesn't exist,timeout error raises
|
||||
|
||||
// Check if the modal having the onboarding video has been displayed.
|
||||
await common.wait_for_micromodal_to_open(page);
|
||||
await page.click("#navigation-tour-video-modal .modal__close");
|
||||
await common.wait_for_micromodal_to_close(page);
|
||||
|
||||
// Updating common.realm_url because we are redirecting to it when logging out.
|
||||
common.set_realm_url(page.url());
|
||||
}
|
||||
|
||||
await common.run_test(realm_creation_tests);
|
||||
Reference in New Issue
Block a user