diff --git a/.github/workflows/.tests-python.yml b/.github/workflows/.tests-python.yml index 6c1dc844..55ce2579 100644 --- a/.github/workflows/.tests-python.yml +++ b/.github/workflows/.tests-python.yml @@ -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 @@ -131,6 +132,7 @@ jobs: 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 diff --git a/e2e/test.gpx b/e2e/test.gpx new file mode 100644 index 00000000..5f387ca2 --- /dev/null +++ b/e2e/test.gpx @@ -0,0 +1,109 @@ + +' + + + just a workout + + + 998 + + + + 998 + + + + 994 + + + + 994 + + + + 994 + + + + 993 + + + + 992 + + + + 992 + + + + 987 + + + + 987 + + + + 987 + + + + 987 + + + + 986 + + + + 986 + + + + 986 + + + + 985 + + + + 980 + + + + 980 + + + + 980 + + + + 979 + + + + 981 + + + + 980 + + + + 979 + + + + 979 + + + + 975 + + + + + diff --git a/e2e/test_workouts.py b/e2e/test_workouts.py index 521c3fb6..c7a12211 100644 --- a/e2e/test_workouts.py +++ b/e2e/test_workouts.py @@ -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