@pytest.fixture()
async def driver(request, ops_test):
    status = yaml.safe_load(check_output(['juju', 'status', '-m', ops_test.model_full_name, '--format=yaml']))
    endpoint = status['applications']['kubeflow-dashboard']['address']
    application = ops_test.model.applications['kubeflow-dashboard']
    config = (await application.get_config())
    port = config['port']['value']
    url = f'http://{endpoint}.nip.io:{port}/'
    options = Options()
    options.headless = True
    with webdriver.Firefox(options=options) as driver:
        wait = WebDriverWait(driver, 180, 1, (JavascriptException, StopIteration))
        for _ in range(60):
            try:
                driver.get(url)
                break
            except WebDriverException:
                sleep(5)
        else:
            driver.get(url)
        (yield (driver, wait, url))
        driver.get_screenshot_as_file(f'/tmp/selenium-{request.node.name}.png')
@pytest.fixture()
async def driver(request, ops_test):
    status = yaml.safe_load(check_output(['juju', 'status', '-m', ops_test.model_full_name, '--format=yaml']))
    endpoint = status['applications']['kubeflow-dashboard']['address']
    application = ops_test.model.applications['kubeflow-dashboard']
    config = (await application.get_config())
    port = config['port']['value']
    url = f'http://{endpoint}.nip.io:{port}/'
    options = Options()
    options.headless = True
    with webdriver.Firefox(options=options) as driver:
        wait = WebDriverWait(driver, 180, 1, (JavascriptException, StopIteration))
        for _ in range(60):
            try:
                driver.get(url)
                break
            except WebDriverException:
                sleep(5)
        else:
            driver.get(url)
        (yield (driver, wait, url))
        driver.get_screenshot_as_file(f'/tmp/selenium-{request.node.name}.png')