API mocking means replacing the real API with a fixed response (a fixture). This technique makes tests deterministic: the username will be the same every time.
Pass contentType: 'application/json' and a JSON string as body into route.fulfill. For example '{"name":"Test User"}' — the UI will write that name into the #username element.
page is already available. Intercept the /api/user request and return a JSON response containing the name "Test User". Then click the «Load profile» button.
Several URL patterns and JSON structures are accepted — as long as the name key is "Test User".