Skip to content

Commit 93a95bf

Browse files
committed
fix: harden iOS alert smoke scenario
1 parent 97c87ee commit 93a95bf

2 files changed

Lines changed: 21 additions & 13 deletions

File tree

examples/test-app/src/screens/AutomationLabScreen.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,20 @@ export function AutomationLabScreen(props: {
8585
}, []);
8686

8787
function showAutomationAlert() {
88-
Alert.alert('Automation confirmation', 'Choose either result to update the visible canary.', [
89-
{
90-
style: 'cancel',
91-
text: 'Cancel',
92-
onPress: () => setAlertResult('cancelled'),
93-
},
94-
{
95-
text: 'OK',
96-
onPress: () => setAlertResult('accepted'),
97-
},
98-
]);
88+
setAlertResult('opened');
89+
requestAnimationFrame(() => {
90+
Alert.alert('Automation confirmation', 'Choose either result to update the visible canary.', [
91+
{
92+
style: 'cancel',
93+
text: 'Cancel',
94+
onPress: () => setAlertResult('cancelled'),
95+
},
96+
{
97+
text: 'OK',
98+
onPress: () => setAlertResult('accepted'),
99+
},
100+
]);
101+
});
99102
}
100103

101104
async function requestMicrophonePermission() {

test/integration/ios-simulator-e2e/live-automation-scenario.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,14 @@ export async function assertAutomationInput(context: LiveContext): Promise<void>
148148
await assertWaitText(context, 'Long presses: 1');
149149
verifyCommand(context, C.longPress, '800ms hold increments the long-press counter');
150150

151-
await runStep(context, 'scroll native alert canary into view', ['scroll', 'down', '1']);
151+
await assertElementTextAfterScrolling(
152+
context,
153+
'id="automation-open-alert"',
154+
'Open automation alert',
155+
);
152156
await runStep(context, 'open native alert', ['click', 'id="automation-open-alert"']);
153-
const alert = await runStep(context, 'wait for native alert', ['alert', 'wait', '5000']);
157+
await assertWaitText(context, 'Alert result: opened');
158+
const alert = await runStep(context, 'wait for native alert', ['alert', 'wait', '10000']);
154159
assertJsonContains(alert, 'Automation confirmation', 'alert wait should return fixture alert');
155160
await runStep(context, 'inspect native alert', ['alert', 'get']);
156161
await runStep(context, 'dismiss native alert', ['alert', 'dismiss']);

0 commit comments

Comments
 (0)