Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • VIPS/VIPSLogic
1 result
Select Git revision
Show changes
Commits on Source (17)
......@@ -8,3 +8,6 @@ classes/
*.iml
/.idea/
.vscode/settings.json
selenium/.pytest_cache
selenium/.venv
selenium/tests/__pycache__
......@@ -60,31 +60,11 @@
<version>2.3.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>edu.ucar</groupId>
<artifactId>cdm</artifactId>
<version>4.6.21</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>8.3.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-spatial</artifactId>
<version>5.6.15.Final</version>
<exclusions>
<exclusion>
<artifactId>postgresql</artifactId>
<groupId>postgresql</groupId>
</exclusion>
<exclusion>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
......@@ -139,13 +119,6 @@
<artifactId>JavaAPIforKml</artifactId>
<version>2.2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.postgis/postgis-jdbc -->
<dependency>
<groupId>net.postgis</groupId>
<artifactId>postgis-jdbc</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
......@@ -179,18 +152,28 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-spatial</artifactId>
<version>5.6.15.Final</version>
<exclusions>
<exclusion>
<artifactId>postgresql</artifactId>
<groupId>postgresql</groupId>
</exclusion>
<exclusion>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
<version>2.16.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
......@@ -261,35 +244,18 @@
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
<version>1.5</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>70.1</version>
</dependency>
<!--dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1211</version>
<scope>provided</scope>
</dependency-->
<dependency>
<groupId>org.openjdk.jol</groupId>
<artifactId>jol-core</artifactId>
<version>0.16</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-api</artifactId>
<version>20.5</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>20.5</version>
</dependency>
<dependency>
<groupId>javax.measure</groupId>
<artifactId>unit-api</artifactId>
......@@ -298,13 +264,7 @@
<dependency>
<groupId>com.webcohesion.enunciate</groupId>
<artifactId>enunciate-core-annotations</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>com.webcohesion.enunciate</groupId>
<artifactId>enunciate-rt-util</artifactId>
<version>2.13.3</version>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>com.bedatadriven</groupId>
......@@ -321,13 +281,17 @@
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.12.1</version>
<configuration>
<source>11</source>
<target>11</target>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
......@@ -366,7 +330,7 @@
<plugin>
<groupId>com.webcohesion.enunciate</groupId>
<artifactId>enunciate-maven-plugin</artifactId>
<version>2.13.3</version>
<version>2.17.1</version>
<executions>
<execution>
<goals>
......
venv: venv/touchfile
venv/touchfile: requirements.txt
python3 -m venv .venv
. .venv/bin/activate; python3 -m pip install --upgrade -q pip; pip install -Ur requirements.txt
touch .venv/touchfile
test: venv
@echo 'Run selenium tests'
. .venv/bin/activate \
&& pytest
# Selenium tests
Ensure application is running locally. Tests expect login form to be available on http://vipslogic/index.html. Run tests like this:
```
$ make test
```
selenium==4.16.0
pytest
trio
pytest-trio
flake8
\ No newline at end of file
from selenium import webdriver
import pytest
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
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"
@pytest.fixture
def browser():
if BROWSER == "chrome":
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(options=chrome_options)
elif BROWSER == "firefox":
firefox_options = webdriver.FirefoxOptions()
firefox_options.headless = False
driver = webdriver.Firefox(options=firefox_options)
else:
raise Exception("Browser must be set to either chrome or firefox")
driver.get("http://vipslogic/index.html")
assert driver.title == "Please log in"
driver.implicitly_wait(0.5)
driver.find_element(by=By.NAME, value="username").send_keys("seleniumtest")
driver.find_element(by=By.NAME, value="password").send_keys("seleniumTEST")
driver.find_element(by=By.CSS_SELECTOR, value="button").click()
assert driver.title == "Welcome to VIPSLogic"
yield driver
driver.quit()
def test_name_of_logged_in_user(browser):
link = browser.find_element(By.XPATH, '//a[text()="Selenium Testbruker"]')
assert link is not None
def test_admin_organisms(browser):
browser.find_element(By.XPATH, '//a[text()="Admin"]').click()
link = WebDriverWait(browser, 15).until(
EC.element_to_be_clickable((By.XPATH, '//a[text()="Organisms"]'))
)
assert link.get_attribute("href") == "http://vipslogic/organism"
link.click()
assert browser.title == "Organisms"
link = WebDriverWait(browser, 15).until(
EC.element_to_be_clickable((By.XPATH, '//a[text()="List all pests"]'))
)
link.click()
assert browser.title == "All pests"
def test_admin_scheduling(browser):
browser.find_element(By.XPATH, '//a[text()="Admin"]').click()
link = WebDriverWait(browser, 10).until(
EC.element_to_be_clickable((By.XPATH, '//a[text()="Scheduling"]'))
)
assert link.get_attribute("href") == "http://vipslogic/scheduling"
link.click()
assert browser.title == "Scheduling overview"
def test_admin_organization_group(browser):
browser.find_element(By.XPATH, '//a[text()="Admin"]').click()
link = WebDriverWait(browser, 10).until(
EC.element_to_be_clickable((By.XPATH, '//a[text()="Organization groups"]'))
)
assert link.get_attribute("href") == "http://vipslogic/organizationgroup"
link.click()
assert browser.title == "Organization groups"
def test_admin_apple_fruit_moth(browser):
browser.find_element(By.XPATH, '//a[text()="Admin"]').click()
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"
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://vipslogic/user"
link.click()
WebDriverWait(browser, 20).until(
EC.visibility_of_element_located((By.XPATH, "//h1[text()='Users']"))
)
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://vipslogic/forecastConfiguration"
link.click()
WebDriverWait(browser, 20).until(
EC.visibility_of_element_located((By.XPATH, "//h1[text()='Forecasts']"))
)
assert browser.title == "Forecasts"