def METHOD_NAME(browser, pg_sleep, registered_agent, ui_url):
    browser.get(ui_url)  # Goto home
    browser.select("a.instance-link").click()  # Click first instance
    browser.select("div.sidebar a.activity").click()  # Click Activity
    # Pause auto-refresh
    browser.hover(".main tr td.query")
    for tr in browser.select_all('.main tbody tr'):
        query = tr.find_element(By.CSS_SELECTOR, 'td.query pre')
        if 'test-activity' in query.text:
            tr.find_element(By.CSS_SELECTOR, 'input[type=checkbox]').click()
            break
    else:
        assert False, "pg_sleep not running"
    # Ensure auto_refresh button is shown
    auto_refresh_resume = browser.select("span#autoRefreshResume")
    assert 'd-none' not in auto_refresh_resume.get_attribute('class')
    browser.select("#killButton").click()  # Click read Terminate
    browser.select("#submitKill").click()  # Confirmation dialog
    # Ensure psql session is killed.
    with pytest.raises(ErrorReturnCode) as ei:
        pg_sleep.wait(timeout=1)
    assert 2 == ei.value.exit_code
    # Ensure processes vanished from view.
    sleep(.1)
    try:
        query = browser.absent("td.query").text
    except Exception:
        pass
    else:
        # If a query is running, ensure it's not pg_sleep.
        assert 'pg_sleep' not in query