Skip to content
Snippets Groups Projects
Commit 9e31e9cb authored by Lene Wasskog's avatar Lene Wasskog
Browse files

test: Add tests for users and forecasts

parent 72af8825
No related branches found
No related tags found
1 merge request!154Merge all Wildfly 26 compatible updates into develop
......@@ -6,7 +6,7 @@ venv/touchfile: requirements.txt
touch .venv/touchfile
test: venv
@echo 'Running Django application locally'
@echo 'Run selenium tests'
. .venv/bin/activate \
&& pytest
......@@ -10,7 +10,8 @@ from selenium.webdriver.support import expected_conditions as EC
@pytest.fixture
def browser():
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
# Uncomment line below to prevent Chrome from opening
# chrome_options.add_argument("--headless")
driver = webdriver.Chrome(options=chrome_options)
driver.get("http://localhost/index.html")
......@@ -72,3 +73,23 @@ def test_admin_apple_fruit_moth(browser):
assert link.get_attribute("href") == "http://localhost/applefruitmoth"
link.click()
assert browser.title == "Rognebærmøllstasjoner"
def test_admin_users(browser):
browser.find_element(By.XPATH, '//a[text()="Admin"]').click()
link = WebDriverWait(browser, 20).until(
EC.element_to_be_clickable((By.XPATH, '//a[text()="Users"]'))
)
assert link.get_attribute("href") == "http://localhost/user"
link.click()
assert browser.title == "Users"
def test_admin_forecasts(browser):
browser.find_element(By.XPATH, '//a[text()="Admin"]').click()
link = WebDriverWait(browser, 20).until(
EC.element_to_be_clickable((By.XPATH, '//a[text()="Forecasts"]'))
)
assert link.get_attribute("href") == "http://localhost/forecastConfiguration"
link.click()
assert browser.title == "Forecasts"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment