diff --git a/selenium/tests/test_selenium.py b/selenium/tests/test_selenium.py index 45d44fdffd11f0106ad1a5edec3744ae763560da..73886a89623ffd01a4268b10895e49c516c5674e 100644 --- a/selenium/tests/test_selenium.py +++ b/selenium/tests/test_selenium.py @@ -7,7 +7,12 @@ from selenium.webdriver.support import expected_conditions as EC # https://github.com/SeleniumHQ/seleniumhq.github.io/blob/trunk/examples/python/README.md # BROWSER = 'chrome' -BROWSER = "firefox" +# BROWSER = "firefox" +BROWSER = "edge" + +HOST_URL = "http://vipslogic-local.no/" +#HOST_URL = "https://logic.testvips.nibio.no" +#HOST_URL = "https://logic.vips.nibio.no" @pytest.fixture @@ -20,10 +25,15 @@ def browser(): firefox_options = webdriver.FirefoxOptions() firefox_options.headless = False driver = webdriver.Firefox(options=firefox_options) + elif BROWSER == "edge": + edge_options = webdriver.EdgeOptions() + edge_options.headless = False + driver = webdriver.Edge(options=edge_options) else: raise Exception("Browser must be set to either chrome or firefox") - driver.get("http://vipslogic/index.html") + #driver.get("http://vipslogic/index.html") + driver.get(f"{HOST_URL}/index.html") assert driver.title == "Please log in" driver.implicitly_wait(0.5) @@ -45,7 +55,7 @@ def test_admin_organisms(browser): link = WebDriverWait(browser, 15).until( EC.element_to_be_clickable((By.XPATH, '//a[text()="Organisms"]')) ) - assert link.get_attribute("href") == "http://vipslogic/organism" + assert link.get_attribute("href") == f"{HOST_URL}/organism" link.click() assert browser.title == "Organisms" link = WebDriverWait(browser, 15).until( @@ -60,7 +70,7 @@ def test_admin_scheduling(browser): link = WebDriverWait(browser, 10).until( EC.element_to_be_clickable((By.XPATH, '//a[text()="Scheduling"]')) ) - assert link.get_attribute("href") == "http://vipslogic/scheduling" + assert link.get_attribute("href") == f"{HOST_URL}/scheduling" link.click() assert browser.title == "Scheduling overview" @@ -70,7 +80,7 @@ def test_admin_organization_group(browser): link = WebDriverWait(browser, 10).until( EC.element_to_be_clickable((By.XPATH, '//a[text()="Organization groups"]')) ) - assert link.get_attribute("href") == "http://vipslogic/organizationgroup" + assert link.get_attribute("href") == f"{HOST_URL}/organizationgroup" link.click() assert browser.title == "Organization groups" @@ -80,7 +90,7 @@ def test_admin_apple_fruit_moth(browser): link = WebDriverWait(browser, 10).until( EC.element_to_be_clickable((By.XPATH, '//a[text()="Apple fruit moth"]')) ) - assert link.get_attribute("href") == "http://vipslogic/applefruitmoth" + assert link.get_attribute("href") == f"{HOST_URL}/applefruitmoth" link.click() assert browser.title == "Rognebærmøllstasjoner" @@ -90,7 +100,7 @@ def test_admin_users(browser): link = WebDriverWait(browser, 20).until( EC.element_to_be_clickable((By.XPATH, '//a[text()="Users"]')) ) - assert link.get_attribute("href") == "http://vipslogic/user" + assert link.get_attribute("href") == f"{HOST_URL}/user" link.click() WebDriverWait(browser, 20).until( EC.visibility_of_element_located((By.XPATH, "//h1[text()='Users']")) @@ -103,7 +113,7 @@ def test_admin_forecasts(browser): link = WebDriverWait(browser, 20).until( EC.element_to_be_clickable((By.XPATH, '//a[text()="Forecasts"]')) ) - assert link.get_attribute("href") == "http://vipslogic/forecastConfiguration" + assert link.get_attribute("href") == f"{HOST_URL}/forecastConfiguration" link.click() WebDriverWait(browser, 20).until( EC.visibility_of_element_located((By.XPATH, "//h1[text()='Forecasts']"))