fix(spec): state-aware enterMobile + globalise properties for evaluator pickup

This commit is contained in:
pj committed 2026-04-18 06:39:00 +07:00
1 parent f2fe54debc
commit b19d83fd54
1 file changed
+16 -7
+16 -7
View File
@@ -87,12 +87,18 @@ const enterMobile = actions(() => {
const button = continueButton.current; const button = continueButton.current;
const phone = process.env.UATU_TEST_PHONE ?? ""; const phone = process.env.UATU_TEST_PHONE ?? "";
if (!field || !phone) return []; if (!field || !phone) return [];
const steps: ReturnType<typeof Tap | typeof InputText>[] = [ // Step by screen state so we never tap a disabled button, append to the
InputText({ into: field, text: phone }), // phone field, or toggle the terms checkbox off again.
]; if (field.text !== phone) {
if (terms) steps.push(Tap({ on: terms })); return [InputText({ into: field, text: phone })];
if (button) steps.push(Tap({ on: button })); }
return steps; if (terms && !terms.checked) {
return [Tap({ on: terms })];
}
if (button && button.enabled) {
return [Tap({ on: button })];
}
return [];
}); });
const enterOtp = actions(() => { const enterOtp = actions(() => {
@@ -100,6 +106,8 @@ const enterOtp = actions(() => {
const field = otpFirstBox.current; const field = otpFirstBox.current;
const otp = process.env.UATU_TEST_OTP ?? ""; const otp = process.env.UATU_TEST_OTP ?? "";
if (!field || !otp) return []; if (!field || !otp) return [];
// The first box shows the entered digit once filled; stop re-typing then.
if (field.text && field.text.length > 0) return [];
return [InputText({ into: field, text: otp })]; return [InputText({ into: field, text: otp })];
}); });
@@ -133,4 +141,5 @@ export const actionsRoot = weighted(
[2, swipes], [2, swipes],
); );
(globalThis as { actions?: unknown }).actions = actionsRoot; (globalThis as { actions?: unknown; properties?: unknown }).actions = actionsRoot;
(globalThis as { properties?: unknown }).properties = properties;