Skip to content
Snippets Groups Projects
Commit c46f4b56 authored by Klaas Kliffen's avatar Klaas Kliffen :satellite:
Browse files

tests: initial tests

parent 109b8b10
No related branches found
No related tags found
1 merge request!1Initial setup
Pipeline #72654 passed
.env 0 → 100644
*.pyc
.env/
.venv/
...@@ -9,7 +9,12 @@ integration: ...@@ -9,7 +9,12 @@ integration:
- docker:dind - docker:dind
tags: tags:
- "sdc-dev" - "sdc-dev"
before_script:
- docker compose build # TODO: cache build?
script: script:
# Spin up front and backend containers # Spin up front and backend containers
- echo "Using FE=${LUDWIG_FRONTEND_VERSION:-latest}" - echo "Using FE=${LUDWIG_FRONTEND_VERSION:-latest}"
- echo "Using BE=${LUDWIG_BACKEND_VERSION:-latest}" - echo "Using BE=${LUDWIG_BACKEND_VERSION:-latest}"
# - docker compose up -d frontend backend && sleep 10
# - docker compose exec backend python manage.py migrate
- docker compose run integration pytest
# Installs Selenium dependencies
# Webdrivermanager does not support 3.12 yet
FROM python:3.11
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y firefox-esr build-essential tree curl
WORKDIR /workdir
COPY requirements.txt /workdir/requirements.txt
RUN pip install -r requirements.txt
RUN webdrivermanager firefox:v0.34.0 --linkpath /usr/local/bin
WORKDIR /workdir
CMD ["/bin/bash"]
# Ludwig Integration Test # Ludwig Integration Test
## Running integration test
```bash
docker compose run integration pytest
```
services:
frontend:
image: git.astron.nl:5000/astron-sdc/ludwig-frontend:${FE_VERSION:-latest}
networks:
- front
backend:
image: git.astron.nl:5000/astron-sdc/ludwig-backend:${BE_VERSION:-latest}
networks:
- front
- back
depends_on:
- db
db:
image: postgres:16
networks:
- back
integration:
image: git.astron.nl:5000/astron-sdc/ludwig-integration
build: .
volumes:
- "./:/workdir"
networks:
- front
depends_on:
- frontend
- backend
networks:
front:
back:
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver import FirefoxOptions
class PythonOrgSearch(unittest.TestCase):
def setUp(self):
opts = FirefoxOptions()
opts.add_argument("--headless")
self.driver = webdriver.Firefox(options=opts)
def test_search_in_python_org(self):
driver = self.driver
driver.get("http://www.python.org")
self.assertIn("Python", driver.title)
elem = driver.find_element(By.NAME, "q")
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
self.assertNotIn("No results found.", driver.page_source)
def tearDown(self):
self.driver.close()
class DummyTest(unittest.TestCase):
def test_okay(self):
the_answer = 42
self.assertEqual(the_answer, 42)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment