irregularHandler

in Japanese(日本語)

Declares an in-app message (promo card, announcement) that may or may not appear, and closes it automatically whenever it does.

Functions

function description
irregularHandler(detect, dismiss:, maxDismissals: 10) Declares an interruption. Whenever detect resolves during any later step (operation or assertion), it is closed automatically — dismiss is tapped if given, otherwise detect itself is tapped. Typically declared once in beforeEach().

Example

func beforeEach() {
    irregularHandler("#promo_modal", dismiss: "#btn_promo_close")
}

Notes

The interruption swallowed an interaction

If a declared interruption appears between sending an interaction and it taking effect, the tool cannot tell whether the interaction already landed. It never resends it — resending could double-fire something that already went through (a submit, a purchase). (The one exception is an interaction known not to have been delivered — a tap blocked by an iOS system alert; see iOS system alerts.) If the step that closed the interruption then fails, a note like this is recorded:

the interruption appeared during this step — an interaction sent just before it
may have been swallowed by it (nothing was re-sent: repeating it could double-fire)

Recovering from this is the scenario's job — check whether the intended state was reached (e.g. ifCanSelect) and repeat the tap if not, but only for interactions that are safe to repeat. A navigation tap is safe; a confirm/submit/pay action is not, since only the scenario's author knows which is which.

Using it from MCP's ft_batch

The same declaration can be written as one line in ft_batch's steps (quoted, space-separated arguments, like the other steps).

irregularHandler 'Stay safe on your route' dismiss: 'OK'; tap '#station_row'; tap '#route_card'