Skip to content

Commit 01f2c93

Browse files
committed
ci: wait for the store to hold the booking in the MCP e2e
The page reports a store change a moment after it shows the booking confirmation, so reading `TravelStore` once right after the confirmation could see the state from before the booking. The check now reads again until the booking shows, for up to 5 seconds, like the confirmation check before it.
1 parent b28b596 commit 01f2c93

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎scripts/e2e-mcp.mjs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,11 +2033,17 @@ async function runActions(state) {
20332033
booked,
20342034
r.markdown.slice(0, 300),
20352035
);
2036-
const stores = await read('ngrx-inspect-store', { store: ctx.storeId('TravelStore') });
2036+
// The page reports the store change a moment after it shows the confirmation, so wait for it.
2037+
const holdsBooking = (text) => /Ada Lovelace|BK-?\d+|booking[^\n]*\(1\)/i.test(text);
2038+
let stores = '';
2039+
await waitUntil(async () => {
2040+
stores = await read('ngrx-inspect-store', { store: ctx.storeId('TravelStore') });
2041+
return holdsBooking(stores);
2042+
}, 5000);
20372043
write(
20382044
'run-form-action',
20392045
'TravelStore holds the booking',
2040-
/Ada Lovelace|BK-?\d+|booking[^\n]*\(1\)/i.test(stores),
2046+
holdsBooking(stores),
20412047
stores.slice(0, 300),
20422048
);
20432049
const submitHistory = await read('list-form-changes', { form, type: 'submit' });

0 commit comments

Comments
 (0)