Files
XC_VM/tests/e2e/tests/auth.setup.ts
T
Divarion_D 53efe7071c refactor(admin-ui): rename vuexy identifiers to newui + fix mangled names
Rename the last lowercase "vuexy" identifiers left after the de-brand:
- views {header,footer,menu,vendors,topbar}.vuexy.php -> .newui.php
- functions xc_admin_use_vuexy / xc_vuexy_vendor_* / _xc_vuexy_icon -> *_newui*
- constant XC_VUEXY_PAGES -> XC_NEWUI_PAGES
- E2E spec vuexy-tables.spec.ts -> newui-tables.spec.ts + drop the brand
  name from test/Makefile prose

Also fix two identifiers the earlier brand scrub corrupted (a bare "Vuexy"
in a name became "Bootstrap 5", inserting a space): class
XcVuexyMenuBuilder -> XcNewuiMenuBuilder (was a parse error in the menu view)
and global key xmVuexyVendors -> xmNewuiVendors.

Refs: #148 #178
2026-09-03 19:50:15 +03:00

31 lines
1.2 KiB
TypeScript

import { test as setup, expect } from '@playwright/test';
import fs from 'node:fs';
const authFile = '.auth/admin.json';
/**
* Logs into the admin panel once and stores the session for the browser
* projects. The login form (Views/admin/login.php) posts username/password to
* ./login; the access code is already part of XC_E2E_BASE_URL.
*/
setup('authenticate', async ({ page }) => {
const user = process.env.XC_E2E_USER;
const pass = process.env.XC_E2E_PASS;
expect(user, 'set XC_E2E_USER').toBeTruthy();
expect(pass, 'set XC_E2E_PASS').toBeTruthy();
await page.goto('./login');
await page.locator('#username').fill(user!);
await page.locator('#password').fill(pass!);
await page.locator('#login_button').click();
// After login the panel redirects to the dashboard, whose sidebar only
// renders once authenticated. Waiting on the element (rather than waitForURL's
// 'load' event) is robust to the heavy dashboard being slow to fully load,
// especially headed.
await expect(page.locator('#layout-menu')).toBeVisible({ timeout: 30_000 });
fs.mkdirSync('.auth', { recursive: true });
await page.context().storageState({ path: authFile });
});