def METHOD_NAME(find_ports_mock, flow):
    find_ports_mock.side_effect = lambda: 100
    flow = flow()
    app = LightningApp(flow)
    assert flow._layout == {}
    # we copy the dict here because after we dispatch the dict will get update with new instances
    # as the layout gets updated during the loop.
    frontends = app.frontends.copy()
    MultiProcessRuntime(app).dispatch()
    assert flow.counter == 3
    # The target url is available for the frontend after we started the servers in dispatch
    assert flow._layout == {"target": "http://localhost:100/root"}
    assert app.frontends[flow.name].flow is flow
    # we start the servers for the frontends that we collected at the time of app instantiation
    frontends[flow.name].start_server.assert_called_once()
    # leaf layout nodes can't be changed, they stay the same from when they first got configured
    assert app.frontends[flow.name] == frontends[flow.name]