diff --git a/README.md b/README.md index 4d88cb0..5a247e0 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ phpMyAdmin admin UI will be at http://localhost:8080 - Run the app with `docker-compose up; docker-compose down;` - Login to playwright container with `docker exec -ti species-challenge-playwright-1 bash` -- Run tests with `python -m pytest -v`. Add `-s` option to the end to see print outputs. +- Run tests with `python -m pytest -v -s`. The `-s` option enables print outputs. ## OpenShift setup @@ -77,6 +77,7 @@ Note that in order to create MariaDB database on Rahti, PHPMyAdmin data dump doe ### Next +* Fix autocomplete-added species min/max dates being 2022-?? * If user removes name and then trashes the participation, saving fails, and some data disappears. * Should removal be completely different procedure, that only UPDATES trashed = 1, and does not UPDATE anything else? * Trim whitespace from MX codes, both on read and write @@ -100,6 +101,7 @@ Note that in order to create MariaDB database on Rahti, PHPMyAdmin data dump doe - Accessibility - Challenge sort order (int) for the front page - larger number shown on top - Later / nice: + - Todo if simple form fullness verification field is not enough: Calculate taxon count on frontend, make backend validate this is same as taxa with dates. - Show challenge days also on participation form (in case challenge is open, but challenge period has not yet started) - If today is not within date begin and end, don't update taxon datw by clicking taxon name (now updates, but browser validation then prevents saving) - Move login_url, api_url, target id yms. konfiguraatiotiedostoon diff --git a/app/templates/form_challenge100.html b/app/templates/form_challenge100.html index 53eeedc..076f216 100644 --- a/app/templates/form_challenge100.html +++ b/app/templates/form_challenge100.html @@ -187,10 +187,14 @@ } // Todo: comma between fin and swe only when both exist + + // Replace . with _ in id, to be valid CSS selector + const id_underscore = id.replace(/\./g, '_'); + newLi.innerHTML = ` ${fin}, ${swe} (${sci}) - - + + i ` // taxaList.appendChild(newLi); // Append to end of list diff --git a/tests-playwright/test_anon_user.py b/tests-playwright/test_anon_user.py index 32d4fee..66bc19a 100644 --- a/tests-playwright/test_anon_user.py +++ b/tests-playwright/test_anon_user.py @@ -19,7 +19,7 @@ def test_anon_public_pages(browser): # Access a challenge that doesn't exist, which should redirect to front page page.goto("http://web:8081/haaste/99") assert front_page_text in page.content() - + # Access pages that require login def test_anon_restricted_pages(browser): @@ -50,6 +50,5 @@ def test_anon_restricted_pages(browser): assert "Kirjaudu ensin sisään" in page.content() assert front_page_text in page.content() - page.close() diff --git a/tests-playwright/test_login.py b/tests-playwright/test_login.py index a81127a..bb88aa9 100644 --- a/tests-playwright/test_login.py +++ b/tests-playwright/test_login.py @@ -116,9 +116,13 @@ def test_add_edit_participation(browser): # Add taxa in different ways page.fill("#MX_71896", "2024-01-01") # Add by filling in the field - page.fill("#MX_71663", "2024-06-01") # Add by filling in the field page.click("#MX_73304_id") # Add by clicking the taxon name + # Add taxon by autocomplete + page.fill('input#autocomplete-input', 'valko') + page.click('#autocomplete-results > :first-child') + page.fill("#MX_66563", "2024-06-01") # Add by filling in the field + # Submit the form page.click("#submit_button") @@ -138,7 +142,7 @@ def test_add_edit_participation(browser): # Remove taxon in different ways page.fill("#MX_71896", "") # Editing field directly - page.click('span.clear_date[data-clear-for="MX_71663"]') # Clicking the clear button + page.click('span.clear_date[data-clear-for="MX_66563"]') # Clicking the clear button # Submit the form page.click("#submit_button")