Commit 7ec8b353 authored by Duggan, John's avatar Duggan, John
Browse files

Add functional unit tests

parent 422c8ef6
Loading
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
"""Unit tests for LocalStorageManager."""

from selenium.webdriver import Firefox
from selenium.webdriver import ActionChains, Firefox
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait


def test_tool_components(driver: Firefox) -> None:
    # todo: add tests here - emulate run button click in the gallery app,
    # check that progress bar appears, check content of the output and error windows
    # click cancel - check progress bas disappears
    assert 1 == 1
    wait = WebDriverWait(driver, timeout=10)
    run_button = driver.find_element(By.ID, "execution_test_run")
    cancel_button = driver.find_element(By.ID, "execution_test_cancel")

    ActionChains(driver).click(run_button).perform()
    # The progress bar should be visible and the output textareas should have content.
    wait.until(expected_conditions.visibility_of_element_located((By.ID, "progress_bar_test_show_progress")))
    assert driver.find_element(By.ID, "tool_outputs_test_outputs").get_attribute("value") == "test_output"
    assert driver.find_element(By.ID, "tool_outputs_test_errors").get_attribute("value") == "test_error"

    ActionChains(driver).click(cancel_button).perform()
    # The finished bar should be visible.
    wait.until(expected_conditions.visibility_of_element_located((By.ID, "progress_bar_test_show_ok")))