Merge pull request #396 from SamR1/fix-static-map-generation
Fix static map generation
This commit is contained in:
commit
c3fb4319a2
54
.github/workflows/.tests-python.yml
vendored
54
.github/workflows/.tests-python.yml
vendored
@ -87,6 +87,7 @@ jobs:
|
||||
run: pytest fittrackee -p no:warnings --cov fittrackee --cov-report term-missing
|
||||
|
||||
end2end:
|
||||
name: e2e tests
|
||||
runs-on: ubuntu-latest
|
||||
needs: ["python"]
|
||||
container: python:3.10
|
||||
@ -129,3 +130,56 @@ jobs:
|
||||
sleep 5
|
||||
nohup flask worker --processes=1 >> nohup.out 2>&1 &
|
||||
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444
|
||||
|
||||
end2end_package:
|
||||
name: e2e tests with package
|
||||
runs-on: ubuntu-latest
|
||||
needs: ["python"]
|
||||
container: python:3.10
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:14
|
||||
env:
|
||||
POSTGRES_DB: fittrackee_test
|
||||
POSTGRES_USER: fittrackee
|
||||
POSTGRES_PASSWORD: fittrackee
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
selenium:
|
||||
image: selenium/standalone-firefox
|
||||
mailhog:
|
||||
image: mailhog/mailhog:latest
|
||||
redis:
|
||||
image: redis:latest
|
||||
env:
|
||||
APP_SETTINGS: fittrackee.config.End2EndTestingConfig
|
||||
EMAIL_URL: "smtp://mailhog:1025"
|
||||
REDIS_URL: "redis://redis:6379"
|
||||
HOST: "0.0.0.0"
|
||||
PORT: 5000
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Update pip and install build
|
||||
run: python3 -m pip install --upgrade pip build
|
||||
- name: Create and source virtual environment
|
||||
run: |
|
||||
python3 -m venv .venv
|
||||
. .venv/bin/activate
|
||||
- name: Build fittrackee package
|
||||
run: python3 -m build
|
||||
- name: Install fittrackee package
|
||||
run: python3 -m pip install dist/fittrackee-$(cat VERSION).tar.gz
|
||||
- name: Run migrations
|
||||
run: ftcli db upgrade
|
||||
- name: Install pytest and selenium
|
||||
run: python3 -m pip install pytest==7.4.0 pytest-selenium==4.0.1 selenium==4.9.0
|
||||
- name: Start application and run tests with Selenium
|
||||
run: |
|
||||
setsid nohup fittrackee >> nohup.out 2>&1 &
|
||||
export TEST_APP_URL=http://$(hostname --ip-address):5000
|
||||
sleep 5
|
||||
nohup flask worker --processes=1 >> nohup.out 2>&1 &
|
||||
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444
|
||||
|
109
e2e/test.gpx
Normal file
109
e2e/test.gpx
Normal file
@ -0,0 +1,109 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<gpx xmlns:gpxdata="http://www.cluetrust.com/XML/GPXDATA/1/0" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:gpxext="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns="http://www.topografix.com/GPX/1/1">'
|
||||
<metadata/>
|
||||
<trk>
|
||||
<name>just a workout</name>
|
||||
<trkseg>
|
||||
<trkpt lat="44.68095" lon="6.07367">
|
||||
<ele>998</ele>
|
||||
<time>2018-03-13T12:44:45Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.68091" lon="6.07367">
|
||||
<ele>998</ele>
|
||||
<time>2018-03-13T12:44:50Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.6808" lon="6.07364">
|
||||
<ele>994</ele>
|
||||
<time>2018-03-13T12:45:00Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.68075" lon="6.07364">
|
||||
<ele>994</ele>
|
||||
<time>2018-03-13T12:45:05Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.68071" lon="6.07364">
|
||||
<ele>994</ele>
|
||||
<time>2018-03-13T12:45:10Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.68049" lon="6.07361">
|
||||
<ele>993</ele>
|
||||
<time>2018-03-13T12:45:30Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.68019" lon="6.07356">
|
||||
<ele>992</ele>
|
||||
<time>2018-03-13T12:45:55Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.68014" lon="6.07355">
|
||||
<ele>992</ele>
|
||||
<time>2018-03-13T12:46:00Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67995" lon="6.07358">
|
||||
<ele>987</ele>
|
||||
<time>2018-03-13T12:46:15Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67977" lon="6.07364">
|
||||
<ele>987</ele>
|
||||
<time>2018-03-13T12:46:30Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67972" lon="6.07367">
|
||||
<ele>987</ele>
|
||||
<time>2018-03-13T12:46:35Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67966" lon="6.07368">
|
||||
<ele>987</ele>
|
||||
<time>2018-03-13T12:46:40Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67961" lon="6.0737">
|
||||
<ele>986</ele>
|
||||
<time>2018-03-13T12:46:45Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67938" lon="6.07377">
|
||||
<ele>986</ele>
|
||||
<time>2018-03-13T12:47:05Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67933" lon="6.07381">
|
||||
<ele>986</ele>
|
||||
<time>2018-03-13T12:47:10Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67922" lon="6.07385">
|
||||
<ele>985</ele>
|
||||
<time>2018-03-13T12:47:20Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67911" lon="6.0739">
|
||||
<ele>980</ele>
|
||||
<time>2018-03-13T12:47:30Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.679" lon="6.07399">
|
||||
<ele>980</ele>
|
||||
<time>2018-03-13T12:47:40Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67896" lon="6.07402">
|
||||
<ele>980</ele>
|
||||
<time>2018-03-13T12:47:45Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67884" lon="6.07408">
|
||||
<ele>979</ele>
|
||||
<time>2018-03-13T12:47:55Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67863" lon="6.07423">
|
||||
<ele>981</ele>
|
||||
<time>2018-03-13T12:48:15Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67858" lon="6.07425">
|
||||
<ele>980</ele>
|
||||
<time>2018-03-13T12:48:20Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67842" lon="6.07434">
|
||||
<ele>979</ele>
|
||||
<time>2018-03-13T12:48:35Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67837" lon="6.07435">
|
||||
<ele>979</ele>
|
||||
<time>2018-03-13T12:48:40Z</time>
|
||||
</trkpt>
|
||||
<trkpt lat="44.67822" lon="6.07442">
|
||||
<ele>975</ele>
|
||||
<time>2018-03-13T12:48:55Z</time>
|
||||
</trkpt>
|
||||
</trkseg>
|
||||
</trk>
|
||||
</gpx>
|
@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||
@ -42,3 +44,28 @@ class TestWorkout:
|
||||
assert 'Distance: 10 km' in workout_details
|
||||
assert 'Average Speed: 10 km/h' in workout_details
|
||||
assert 'Max. Speed: 10 km/h' in workout_details
|
||||
|
||||
def test_user_can_add_workout_with_gpx(self, selenium):
|
||||
register_valid_user(selenium)
|
||||
app_menu = selenium.find_element(By.CLASS_NAME, 'nav-items-app-menu')
|
||||
add_workout_link = app_menu.find_elements(By.CLASS_NAME, 'nav-item')[3]
|
||||
|
||||
add_workout_link.click()
|
||||
selenium.implicitly_wait(1)
|
||||
|
||||
select = Select(selenium.find_element(By.ID, 'sport'))
|
||||
select.select_by_index(1)
|
||||
gpx_input = selenium.find_element(By.XPATH, "//input[@type='file']")
|
||||
gpx_input.send_keys(os.getcwd() + "/e2e/test.gpx")
|
||||
|
||||
confirm_button = selenium.find_elements(By.CLASS_NAME, 'confirm')[-1]
|
||||
confirm_button.click()
|
||||
|
||||
WebDriverWait(selenium, 30).until(
|
||||
EC.url_changes(f"{TEST_URL}/workouts/add")
|
||||
)
|
||||
|
||||
workout_details = selenium.find_element(By.ID, 'workout-info').text
|
||||
assert 'Duration: 0:04:10' in workout_details
|
||||
assert 'Distance: 0.32 km' in workout_details
|
||||
assert 'Average Speed: 4.61 km/h' in workout_details
|
||||
|
2
poetry.lock
generated
2
poetry.lock
generated
@ -2741,4 +2741,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.8.1"
|
||||
content-hash = "affd344c95768f4f0e10df464c78aca095d84812a25931b23eaffc38c8707907"
|
||||
content-hash = "f124215eb7293511623b07655a619a7660b53422f3645d6a8b47ce730f89cbf4"
|
||||
|
@ -35,6 +35,7 @@ flask-migrate = "^4.0"
|
||||
gpxpy = "=1.5.0"
|
||||
gunicorn = "^20.1"
|
||||
humanize = "^4.6"
|
||||
pillow = "9.5.0"
|
||||
psycopg2-binary = "^2.9"
|
||||
pyjwt = "^2.7"
|
||||
pyopenssl = "^23.2"
|
||||
|
Loading…
Reference in New Issue
Block a user