Backend modules from tastefully 8bd93d15: core-libs, core-session, api-gateway, mobile-api, services-auth, services-system, services-counter, services-member, services-log, services-email. solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal from tastefully 8bd93d15. Copied as tracked files only. Literal secrets replaced with environment placeholders: - services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY, MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default) - services-system: JUMIO_TOKEN, JUMIO_SECRET (optional) - services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed - core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default removed, ipgeolocation key read from IPGEOLOCATION_API_KEY - services-system EkycAppConfig: commented Jumio credentials removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
21 lines
1.1 KiB
TypeScript
21 lines
1.1 KiB
TypeScript
import { fireEvent, screen } from "@testing-library/react";
|
|
|
|
/** "09:30" -> "9:30 AM", "00:00" -> "12:00 AM", "23:59" -> "11:59 PM": the DateTimePicker's option label. */
|
|
export function timeOptionLabel(hhmm: string) {
|
|
const [h, m] = hhmm.split(":").map(Number);
|
|
return `${h % 12 || 12}:${String(m).padStart(2, "0")} ${h < 12 ? "AM" : "PM"}`;
|
|
}
|
|
|
|
/**
|
|
* Picks `hhmm` (HH:mm) in the time dropdown labelled `label`.
|
|
* Keyboard events, not userEvent: a full pointer simulation over the 97-option list made form tests
|
|
* that set two or four times run past the test timeout on a loaded machine.
|
|
* The option is found by its text, not by role and name: computing the accessible name of every
|
|
* option took about 1 s per pick in jsdom, against about 30 ms for a text match.
|
|
*/
|
|
export async function pickTime(label: string | RegExp, hhmm: string) {
|
|
fireEvent.keyDown(screen.getByLabelText(label), { key: "Enter" });
|
|
const text = await screen.findByText(timeOptionLabel(hhmm), { selector: '[role="option"] *' });
|
|
fireEvent.keyDown(text.closest('[role="option"]')!, { key: "Enter" });
|
|
}
|