docs: standardize AgendaMax demo access
This commit is contained in:
@@ -67,16 +67,16 @@ errores de consola y confirma que el calendario, el modal de cita y el cambio de
|
|||||||
|
|
||||||
Todas usan la contraseña **`demo1234`**.
|
Todas usan la contraseña **`demo1234`**.
|
||||||
|
|
||||||
| Rol | Email | Nombre |
|
| Rol | Email | Contraseña | Nombre |
|
||||||
|----------|----------------------------------|------------------|
|
|----------|----------------------------------|------------|------------------|
|
||||||
| **Admin**| `admin@agendapro.demo` | Administrador |
|
| **Admin**| `admin@agendamax.demo` | `demo1234` | Administrador |
|
||||||
| Dueño | `owner@agendapro.demo` | Daniela Reyes |
|
| Dueño | `owner@agendamax.demo` | `demo1234` | Daniela Reyes |
|
||||||
| Empleado | `[email protected]` | Valentina Cruz |
|
| Empleado | `[email protected]` | `demo1234` | Valentina Cruz |
|
||||||
| Empleado | `[email protected]` | Mateo Herrera |
|
| Empleado | `[email protected]` | `demo1234` | Mateo Herrera |
|
||||||
| Empleado | `[email protected]` | Sofía Ramírez |
|
| Empleado | `[email protected]` | `demo1234` | Sofía Ramírez |
|
||||||
| Empleado | `[email protected]` | Diego Castillo |
|
| Empleado | `[email protected]` | `demo1234` | Diego Castillo |
|
||||||
| Empleado | `[email protected]` | Isabela Torres |
|
| Empleado | `[email protected]` | `demo1234` | Isabela Torres |
|
||||||
| Empleado | `[email protected]` | Carolina Méndez |
|
| Empleado | `[email protected]` | `demo1234` | Carolina Méndez |
|
||||||
|
|
||||||
> En la pantalla de login aparecen botones de acceso rápido a las cuentas demo,
|
> En la pantalla de login aparecen botones de acceso rápido a las cuentas demo,
|
||||||
> y desde la barra lateral puedes cambiar de cuenta con **“Ver como…”**.
|
> y desde la barra lateral puedes cambiar de cuenta con **“Ver como…”**.
|
||||||
|
|||||||
+2
-2
@@ -14,7 +14,7 @@ function check(name, cond, extra = "") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Admin login
|
// Admin login
|
||||||
const { json: aLogin } = await req("POST", "/auth/login", { email: "admin@agendapro.demo", password: "demo1234" });
|
const { json: aLogin } = await req("POST", "/auth/login", { email: "admin@agendamax.demo", password: "demo1234" });
|
||||||
check("admin login", aLogin.user?.role === "admin" && aLogin.token, JSON.stringify(aLogin).slice(0, 100));
|
check("admin login", aLogin.user?.role === "admin" && aLogin.token, JSON.stringify(aLogin).slice(0, 100));
|
||||||
const A = aLogin.token;
|
const A = aLogin.token;
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ const { json: oBiz } = await req("GET", "/business", null, OT);
|
|||||||
check("new owner business name", oBiz.business?.name === "Barbería Test");
|
check("new owner business name", oBiz.business?.name === "Barbería Test");
|
||||||
|
|
||||||
// Owner1 still sees only Lumière (isolation the other way)
|
// Owner1 still sees only Lumière (isolation the other way)
|
||||||
const { json: owner1 } = await req("POST", "/auth/login", { email: "owner@agendapro.demo", password: "demo1234" });
|
const { json: owner1 } = await req("POST", "/auth/login", { email: "owner@agendamax.demo", password: "demo1234" });
|
||||||
const { json: o1Emps } = await req("GET", "/employees", null, owner1.token);
|
const { json: o1Emps } = await req("GET", "/employees", null, owner1.token);
|
||||||
check("owner1 isolation: still 6 employees", o1Emps.employees?.length === 6, `got ${o1Emps.employees?.length}`);
|
check("owner1 isolation: still 6 employees", o1Emps.employees?.length === 6, `got ${o1Emps.employees?.length}`);
|
||||||
|
|
||||||
|
|||||||
@@ -1113,7 +1113,7 @@ function check(name, cond, extra = "") {
|
|||||||
else { fail++; console.log(` \u2717 ${name} ${extra}`); }
|
else { fail++; console.log(` \u2717 ${name} ${extra}`); }
|
||||||
}
|
}
|
||||||
|
|
||||||
const { json: login } = await req("POST", "/auth/login", { email: "owner@agendapro.demo", password: "demo1234" });
|
const { json: login } = await req("POST", "/auth/login", { email: "owner@agendamax.demo", password: "demo1234" });
|
||||||
const t = login.token;
|
const t = login.token;
|
||||||
check("login owner", !!t);
|
check("login owner", !!t);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -24,13 +24,13 @@ console.log("\n=== HEALTH & AUTH ===");
|
|||||||
const h = await req("/api/health"); check("health", h.json?.ok === true);
|
const h = await req("/api/health"); check("health", h.json?.ok === true);
|
||||||
const me = await req("/api/auth/demo-users"); check("demo-users >= 8", me.json.users.length >= 8);
|
const me = await req("/api/auth/demo-users"); check("demo-users >= 8", me.json.users.length >= 8);
|
||||||
|
|
||||||
const owner = await login("owner@agendapro.demo"); check("owner login", !!owner.token && owner.user.role === "owner");
|
const owner = await login("owner@agendamax.demo"); check("owner login", !!owner.token && owner.user.role === "owner");
|
||||||
const empLogin = await login("[email protected]"); check("employee login", empLogin.user.role === "employee" && empLogin.user.employee_id);
|
const empLogin = await login("[email protected]"); check("employee login", empLogin.user.role === "employee" && empLogin.user.employee_id);
|
||||||
const adminLogin = await login("admin@agendapro.demo"); check("admin login", adminLogin.user.role === "admin");
|
const adminLogin = await login("admin@agendamax.demo"); check("admin login", adminLogin.user.role === "admin");
|
||||||
const t = owner.token, eT = empLogin.token, aT = adminLogin.token;
|
const t = owner.token, eT = empLogin.token, aT = adminLogin.token;
|
||||||
|
|
||||||
// /me fix
|
// /me fix
|
||||||
const meR = await req("/api/auth/me", { headers: H(t) }); check("/me returns owner", meR.json.user.email === "owner@agendapro.demo");
|
const meR = await req("/api/auth/me", { headers: H(t) }); check("/me returns owner", meR.json.user.email === "owner@agendamax.demo");
|
||||||
|
|
||||||
console.log("\n=== EXISTING: business / employees / services / clients / appointments / dashboard ===");
|
console.log("\n=== EXISTING: business / employees / services / clients / appointments / dashboard ===");
|
||||||
const biz = await req("/api/business", { headers: H(t) }); check("business loaded", biz.json.business?.name === "Lumière Estética & Spa");
|
const biz = await req("/api/business", { headers: H(t) }); check("business loaded", biz.json.business?.name === "Lumière Estética & Spa");
|
||||||
|
|||||||
+2
-2
@@ -27,11 +27,11 @@ async function findSlot(slug, serviceId, maxDays = 30) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// /me now works (the bug we fixed) — login first to get a real token
|
// /me now works (the bug we fixed) — login first to get a real token
|
||||||
const { json: login } = await req("POST", "/auth/login", { email: "owner@agendapro.demo", password: "demo1234" });
|
const { json: login } = await req("POST", "/auth/login", { email: "owner@agendamax.demo", password: "demo1234" });
|
||||||
check("login owner", !!login.token && login.user?.role === "owner", JSON.stringify(login).slice(0, 100));
|
check("login owner", !!login.token && login.user?.role === "owner", JSON.stringify(login).slice(0, 100));
|
||||||
const t = login.token;
|
const t = login.token;
|
||||||
const { json: me } = await req("GET", "/auth/me", null, t);
|
const { json: me } = await req("GET", "/auth/me", null, t);
|
||||||
check("/api/auth/me returns user", me.user?.email === "owner@agendapro.demo", JSON.stringify(me).slice(0, 100));
|
check("/api/auth/me returns user", me.user?.email === "owner@agendamax.demo", JSON.stringify(me).slice(0, 100));
|
||||||
|
|
||||||
// Slug del negocio (para consultar slots públicos)
|
// Slug del negocio (para consultar slots públicos)
|
||||||
const { json: settings } = await req("GET", "/settings", null, t);
|
const { json: settings } = await req("GET", "/settings", null, t);
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ function ensureSeed() {
|
|||||||
seedBusiness({
|
seedBusiness({
|
||||||
businessId: biz.id,
|
businessId: biz.id,
|
||||||
template: getTemplate(DEFAULT_TEMPLATE_KEY)!,
|
template: getTemplate(DEFAULT_TEMPLATE_KEY)!,
|
||||||
ownerEmail: "owner@agendapro.demo",
|
ownerEmail: "owner@agendamax.demo",
|
||||||
ownerName: "Daniela Reyes",
|
ownerName: "Daniela Reyes",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ function check(name, cond, extra = "") {
|
|||||||
else { fail++; console.log(` \u2717 ${name} ${extra}`); }
|
else { fail++; console.log(` \u2717 ${name} ${extra}`); }
|
||||||
}
|
}
|
||||||
|
|
||||||
const { json: login } = await req("POST", "/auth/login", { email: "owner@agendapro.demo", password: "demo1234" });
|
const { json: login } = await req("POST", "/auth/login", { email: "owner@agendamax.demo", password: "demo1234" });
|
||||||
const t = login.token;
|
const t = login.token;
|
||||||
check("login owner", !!t);
|
check("login owner", !!t);
|
||||||
|
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ export function ensurePlatformAdmin() {
|
|||||||
if (exists) return;
|
if (exists) return;
|
||||||
db.prepare(
|
db.prepare(
|
||||||
`INSERT INTO users (business_id, email, password, name, role, avatar_color)
|
`INSERT INTO users (business_id, email, password, name, role, avatar_color)
|
||||||
VALUES (NULL, 'admin@agendapro.demo', 'demo1234', 'Administrador', 'admin', '#0f172a')`
|
VALUES (NULL, 'admin@agendamax.demo', 'demo1234', 'Administrador', 'admin', '#0f172a')`
|
||||||
).run();
|
).run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,7 +330,7 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
|
|||||||
biz = db
|
biz = db
|
||||||
.prepare(`INSERT INTO businesses (name, industry, currency, currency_symbol, phone, address, plan, status) VALUES (?, ?, ?, ?, ?, ?, 'trial', 'active') RETURNING id`)
|
.prepare(`INSERT INTO businesses (name, industry, currency, currency_symbol, phone, address, plan, status) VALUES (?, ?, ?, ?, ?, ?, 'trial', 'active') RETURNING id`)
|
||||||
.get("Lumière Estética & Spa", "Estética y Spa", "MXN", "$", "+52 55 1234 5678", "Av. Reforma 245, CDMX") as { id: number };
|
.get("Lumière Estética & Spa", "Estética y Spa", "MXN", "$", "+52 55 1234 5678", "Av. Reforma 245, CDMX") as { id: number };
|
||||||
seedBusiness({ businessId: biz.id, template: getTemplate(DEFAULT_TEMPLATE_KEY)!, ownerEmail: "owner@agendapro.demo", ownerName: "Daniela Reyes" });
|
seedBusiness({ businessId: biz.id, template: getTemplate(DEFAULT_TEMPLATE_KEY)!, ownerEmail: "owner@agendamax.demo", ownerName: "Daniela Reyes" });
|
||||||
console.log(`[seed] Created default business #${biz.id} with estetica-spa template + admin user.`);
|
console.log(`[seed] Created default business #${biz.id} with estetica-spa template + admin user.`);
|
||||||
} else {
|
} else {
|
||||||
console.log(`[seed] Default business #${biz.id} already exists — data preserved.`);
|
console.log(`[seed] Default business #${biz.id} already exists — data preserved.`);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const DEMO = import.meta.env.DEV || import.meta.env.VITE_DEMO_UI === "1";
|
|||||||
export function LoginPage() {
|
export function LoginPage() {
|
||||||
const { login, user } = useAuth();
|
const { login, user } = useAuth();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [email, setEmail] = useState(DEMO ? "owner@agendapro.demo" : "");
|
const [email, setEmail] = useState(DEMO ? "owner@agendamax.demo" : "");
|
||||||
const [password, setPassword] = useState(DEMO ? "demo1234" : "");
|
const [password, setPassword] = useState(DEMO ? "demo1234" : "");
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|||||||
+2
-2
@@ -43,9 +43,9 @@ async function login(browser, viewport, role) {
|
|||||||
await page.waitForTimeout(400);
|
await page.waitForTimeout(400);
|
||||||
const email =
|
const email =
|
||||||
role === "admin"
|
role === "admin"
|
||||||
? "admin@agendapro.demo"
|
? "admin@agendamax.demo"
|
||||||
: role === "owner"
|
: role === "owner"
|
||||||
? "owner@agendapro.demo"
|
? "owner@agendamax.demo"
|
||||||
: "[email protected]";
|
: "[email protected]";
|
||||||
// Fill the login form
|
// Fill the login form
|
||||||
await page.fill('input[type="email"]', email);
|
await page.fill('input[type="email"]', email);
|
||||||
|
|||||||
Reference in New Issue
Block a user