-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
76 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
# Integration Tests | ||
|
||
## Env Vars | ||
Integration tests for fEMR. This project will bring up the entire fEMR stack with docker then run tests against it. | ||
|
||
```bash | ||
docker run -it --rm -v $(pwd):/app -w /app femr-femr pandoc README.md -o README.md | ||
``` | ||
Assumes that the femr docker container's name is `femr-femr`, otherwise you will need to re-build it with the new name. | ||
|
||
## Run with Docker | ||
|
||
## Running Tests | ||
Ensure that the femr container is built with name `femr-femr`, before running the tests. | ||
|
||
In the `integration-test` directory, run the tests with: | ||
|
||
```bash | ||
docker-compose -f docker-compose.test.yml up --build | ||
docker compose up --build | ||
``` | ||
|
||
## Running Tests with Coverage | ||
## Build Image | ||
|
||
In the root of the fEMR repository: | ||
|
||
```bash | ||
docker-compose -f docker-compose.test.yml -f docker-compose.coverage.yml up --build | ||
docker compose build | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
testcontainers==4.9.0 | ||
pytest==8.3.4 | ||
pytest==8.3.4 | ||
selenium==4.27.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import pytest | ||
import time | ||
import json | ||
from selenium import webdriver | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.common.action_chains import ActionChains | ||
from selenium.webdriver.support import expected_conditions | ||
from selenium.webdriver.support.wait import WebDriverWait | ||
from selenium.webdriver.common.keys import Keys | ||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | ||
import os | ||
import requests | ||
|
||
|
||
def test_femr_is_alive(): | ||
femr_address = os.getenv("FEMR_ADDRESS") | ||
|
||
assert femr_address is not None, "FEMR_ADDRESS environment variable not set" | ||
|
||
response = requests.get(femr_address) | ||
assert response.status_code == 200 | ||
|
||
def test_can_login_and_logout_to_admin(): | ||
femr_address = os.getenv("FEMR_ADDRESS") | ||
|
||
assert femr_address is not None, "FEMR_ADDRESS environment variable not set" | ||
|
||
driver_address = os.getenv("SELENIUM_ADDRESS") | ||
|
||
assert driver_address is not None, "SELENIUM_ADDRESS environment variable not set" | ||
|
||
driver = webdriver.Remote(command_executor=driver_address, options=webdriver.ChromeOptions()) | ||
|
||
driver.get(f"{femr_address}/") | ||
|
||
# Test Login | ||
driver.set_window_size(1361, 1157) | ||
driver.find_element(By.NAME, "email").click() | ||
driver.find_element(By.NAME, "email").send_keys("admin") | ||
driver.find_element(By.NAME, "password").send_keys("admin") | ||
driver.find_element(By.CSS_SELECTOR, "input:nth-child(4)").click() | ||
assert "Welcome to fEMR" in driver.find_element(By.ID, "home_index_h2_Welcome").text | ||
|
||
# Test Logout | ||
driver.find_element(By.CSS_SELECTOR, ".glyphicon-log-out").click() | ||
assert driver.find_element(By.CSS_SELECTOR, "h1").text == "Please sign in" | ||
|
This file was deleted.
Oops, something went wrong.