mirror of
https://github.com/penpot/penpot.git
synced 2026-09-18 18:06:14 +00:00
Move SPA routing out of the URL fragment into the normal query string. The screen travels in a reserved `screen` key holding the route name (`?screen=workspace&team-id=…`); every other param keeps its name. `rt/nav` and `rt/resolve` keep their signatures. This deletes the fragment-mirroring URL surgery, simplifies link-preview (the server sees everything) and nginx (single path, no SPA fallback rules needed), and migrates OIDC redirects, email links, e2e helpers and plugin test utils to the new format. Legacy `#/…` URLs translate client-side for one Penpot version (`legacy-routes`, marked TODO(next-version)); non-SPA paths are untouched. AI-assisted-by: muse-spark-1.3-contributor
95 lines
3.0 KiB
JavaScript
95 lines
3.0 KiB
JavaScript
import { BasePage } from "./BasePage";
|
|
|
|
export class RegisterPage extends BasePage {
|
|
constructor(page) {
|
|
super(page);
|
|
this.registerButton = page.getByRole("button", {
|
|
name: "Create an account",
|
|
});
|
|
this.password = page.getByLabel("Password");
|
|
this.email = page.getByLabel("Work email");
|
|
this.fullName = page.getByLabel("Full name");
|
|
}
|
|
|
|
async fillRegisterFormInputs(name, email, password) {
|
|
await this.fullName.fill(name);
|
|
await this.email.fill(email);
|
|
await this.password.fill(password);
|
|
}
|
|
|
|
async clickRegisterButton() {
|
|
await this.registerButton.click();
|
|
}
|
|
|
|
async setupEmailAlreadyExistsError() {
|
|
await this.mockRPC(
|
|
"prepare-register-profile",
|
|
"register/prepare-register-profile-email-already-exists.json",
|
|
{ status: 400 },
|
|
);
|
|
}
|
|
|
|
async setupMismatchedEmailError() {
|
|
await this.mockRPC(
|
|
"prepare-register-profile",
|
|
"register/prepare-register-profile-email-mismatch.json",
|
|
{ status: 400 },
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Mocks a successful email-verification token exchange (the link the
|
|
* user clicks from the verification email) and every RPC the dashboard
|
|
* needs to render right after landing on it, so the flow can be
|
|
* exercised end-to-end without a real backend.
|
|
*/
|
|
async setupEmailVerificationSuccess() {
|
|
await this.mockConfigFlags(["disable-onboarding"]);
|
|
await this.mockRPC(
|
|
"verify-token",
|
|
"register/verify-token-email-verified.json",
|
|
);
|
|
// The settings step reloads the app via page.goto, which refetches
|
|
// get-profile on boot. Without this override the initial anonymous
|
|
// mock wins again and the app falls back to the login form instead
|
|
// of rendering settings.
|
|
await this.mockRPC(
|
|
"get-profile",
|
|
"register/get-profile-email-verified.json",
|
|
);
|
|
await this.mockRPCs({
|
|
"get-teams": "logged-in-user/get-teams-default.json",
|
|
"get-font-variants?team-id=*":
|
|
"logged-in-user/get-font-variants-empty.json",
|
|
"get-projects?team-id=*": "logged-in-user/get-projects-default.json",
|
|
"get-team-members?team-id=*":
|
|
"logged-in-user/get-team-members-your-penpot.json",
|
|
"get-team-users?team-id=*":
|
|
"logged-in-user/get-team-users-single-user.json",
|
|
"get-unread-comment-threads?team-id=*":
|
|
"logged-in-user/get-team-users-single-user.json",
|
|
"get-team-recent-files?team-id=*":
|
|
"logged-in-user/get-team-recent-files-empty.json",
|
|
"get-profiles-for-file-comments":
|
|
"logged-in-user/get-profiles-for-file-comments-empty.json",
|
|
"get-builtin-templates":
|
|
"logged-in-user/get-built-in-templates-empty.json",
|
|
});
|
|
}
|
|
|
|
async goToVerifyToken(token = "verify-email-token") {
|
|
await this.page.goto(`/?screen=auth-verify-token&token=${token}`);
|
|
}
|
|
|
|
static async init(page) {
|
|
await BasePage.init(page);
|
|
}
|
|
|
|
static async initWithLoggedOutUser(page) {
|
|
await BasePage.init(page);
|
|
await BasePage.mockRPC(page, "get-profile", "get-profile-anonymous.json");
|
|
}
|
|
}
|
|
|
|
export default RegisterPage;
|