Skip to content

Commit

Permalink
Add system tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbrittain committed Oct 9, 2024
1 parent 7174c63 commit dd200cd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ jobs:
3.12
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v2
- name: Run tests
- name: Setup test environment
run: |
uv sync --all-extras
uv sync --dev
uv pip install "adtl[parquet] @ git+https://github.com/globaldothealth/adtl"
- name: Unit tests (and coverage report)
run: |
uv run pytest --cov=InsightBoard --cov-report=html tests/unit
- name: System tests
run: |
uv run pytest tests/system
- name: Upload coverage report
uses: actions/upload-artifact@v4
Expand Down
Empty file.
Empty file.
Empty file.
28 changes: 13 additions & 15 deletions tests/system/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,7 @@ def driver():


def select_project(driver, project_name):
dropdown = driver.find_element(By.ID, "project-dropdown")
dropdown.click()
option_to_select = driver.find_element(By.XPATH, f'//div[text()="{project_name}"]')
option_to_select.click()
# assert that the project is selected
time.sleep(1)
assert dropdown.text == project_name
dropdown_select(driver, "project-dropdown", project_name)


def page_upload(driver):
Expand All @@ -98,6 +92,17 @@ def page_upload(driver):
return PageUpload(driver)


def dropdown_select(driver, dropdown_id, option):
dropdown = driver.find_element(By.ID, dropdown_id)
dropdown.click()
option_to_select = dropdown.find_element(
By.XPATH, f'//div[text()="{option}"]'
)
option_to_select.click()
dropdown_value = dropdown.find_element(By.CLASS_NAME, "Select-value-label")
assert dropdown_value.text == option


class PageUpload:
def __init__(self, driver):
self.driver = driver
Expand All @@ -111,14 +116,7 @@ def clear_data(self):
file.unlink()

def select_parser(self, parser_name):
dropdown = self.driver.find_element(By.ID, "parser-dropdown")
dropdown.click()
option_to_select = self.driver.find_element(
By.XPATH, f'//div[text()="{parser_name}"]'
)
option_to_select.click()
time.sleep(1)
assert dropdown.text == parser_name
dropdown_select(self.driver, "parser-dropdown", parser_name)

def select_data_file(self, file_path):
input_box = self.driver.find_element(By.XPATH, '//input[@type="file"]')
Expand Down

0 comments on commit dd200cd

Please sign in to comment.