async def logged_in_page(webpack_server, page, user, page_login):
    """
    Log the user into the page.

    This involves setting cookies as if the server has already approved the user, then clicking
    "Login" to trigger the OAuth flow.
    """
    await page_login(page, user)
    await page.goto(webpack_server)
    login_button = await page.waitForXPath('//button[contains(., "Login")]')
    await login_button.click()
    return page