diff --git a/.github/workflows/e2e_tests.yml b/.github/workflows/e2e_tests.yml index 1c870b77c0..d8951c4c26 100644 --- a/.github/workflows/e2e_tests.yml +++ b/.github/workflows/e2e_tests.yml @@ -130,6 +130,17 @@ jobs: cd end2end npx playwright test --project=end2end + - name: Generate PG dump from Playwright + if: failure() + run: | + ./lizmap-ctl dump-pgsql + + - name: Check the database diff from Playwright + if: failure() + run: | + git diff qgis-projects/tests/tests_dataset.sql + git restore qgis-projects/tests/tests_dataset.sql + - name: Notify in case of playwright failure, from mainstream branches only uses: peter-evans/commit-comment@v3 if: github.repository == '3liz/lizmap-web-client' && failure() && steps.test-playwright.outcome != 'success' && github.event_name == 'repository_dispatch' @@ -184,11 +195,17 @@ jobs: tests/end2end/cypress/screenshots tests/end2end/cypress/downloads - - name: Check DB diff + - name: Generate PG dump from Cypress + if: failure() run: | - cd qgis-projects/tests/ - PGPASSWORD=lizmap1234! pg_dump -h localhost -p 8132 -U lizmap -f --no-owner --no-acl -n tests_projects -f tests_dataset.sql -# git diff tests/qgis-projects/tests/tests_dataset.sql + ./lizmap-ctl dump-pgsql + + - name: Check the database diff from Cypress + if: failure() + run: | + git diff qgis-projects/tests/tests_dataset.sql + git restore qgis-projects/tests/tests_dataset.sql + # [[ -z $(git status --porcelain -uno) ]] # exit $? diff --git a/tests/lizmap-ctl b/tests/lizmap-ctl index ce833fa934..35de35c876 100755 --- a/tests/lizmap-ctl +++ b/tests/lizmap-ctl @@ -126,6 +126,9 @@ case $COMMAND in shell-pgsql) docker exec -it --user postgres -e PGPASSWORD="lizmap1234!" lizmap${LZMBRANCH}_test_pgsql /bin/bash -l ;; + dump-pgsql) + docker exec -it -e PGPASSWORD="lizmap1234!" lizmap${LZMBRANCH}_test_pgsql pg_dump -U lizmap --no-owner --no-acl -n tests_projects -f /srv/lzm/tests/qgis-projects/tests/tests_dataset.sql + ;; redis-cli) docker exec -it lizmap${LZMBRANCH}_test_redis redis-cli ;; diff --git a/tests/qgis-projects/media/.empty b/tests/qgis-projects/media/.empty deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/qgis-projects/media/specific_media_folder/.empty b/tests/qgis-projects/media/specific_media_folder/.empty deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/qgis-projects/media/specific_media_folder/random-4.jpg b/tests/qgis-projects/media/specific_media_folder/random-4.jpg new file mode 100644 index 0000000000..28c5cfb2c2 Binary files /dev/null and b/tests/qgis-projects/media/specific_media_folder/random-4.jpg differ diff --git a/tests/qgis-projects/tests/README.md b/tests/qgis-projects/tests/README.md index 3fe114d4e4..950eb347f0 100644 --- a/tests/qgis-projects/tests/README.md +++ b/tests/qgis-projects/tests/README.md @@ -16,6 +16,7 @@ The PostgreSQL dump (schema + data) `tests_dataset.sql` contains all data to run * Command to dump (don't forget to remove data generated by running tests before) : * All data : `pg_dump -d "service=lizmapdb" --no-owner --no-acl -n tests_projects -f tests_dataset.sql` * Some tables : `pg_dump -d "service=lizmapdb" -t tests_projects.XXX -t tests_projects.YYY --no-owner --no-acl -n tests_projects -f to_merge.sql` + * Using the docker container `./lizmap-ctl dump-pgsql` * Commands to restore : ```bash diff --git a/tests/qgis-projects/tests/media/random-1.jpg b/tests/qgis-projects/tests/media/random-1.jpg new file mode 100644 index 0000000000..b85782ab72 Binary files /dev/null and b/tests/qgis-projects/tests/media/random-1.jpg differ diff --git a/tests/qgis-projects/tests/media/upload/form_edition_all_field_type/form_edition_upload/image_file/random-3.jpg b/tests/qgis-projects/tests/media/upload/form_edition_all_field_type/form_edition_upload/image_file/random-3.jpg new file mode 100644 index 0000000000..80326eca2c Binary files /dev/null and b/tests/qgis-projects/tests/media/upload/form_edition_all_field_type/form_edition_upload/image_file/random-3.jpg differ diff --git a/tests/qgis-projects/tests/media/upload/form_edition_all_field_type/form_edition_upload/image_file_mandatory/random-2.jpg b/tests/qgis-projects/tests/media/upload/form_edition_all_field_type/form_edition_upload/image_file_mandatory/random-2.jpg new file mode 100644 index 0000000000..2b1f3f93fc Binary files /dev/null and b/tests/qgis-projects/tests/media/upload/form_edition_all_field_type/form_edition_upload/image_file_mandatory/random-2.jpg differ diff --git a/tests/qgis-projects/tests/media/upload/form_edition_all_field_type/form_edition_upload/text_file/lorem-1.txt b/tests/qgis-projects/tests/media/upload/form_edition_all_field_type/form_edition_upload/text_file/lorem-1.txt new file mode 100644 index 0000000000..a1a0538247 --- /dev/null +++ b/tests/qgis-projects/tests/media/upload/form_edition_all_field_type/form_edition_upload/text_file/lorem-1.txt @@ -0,0 +1,4 @@ +Lorem ipsum odor amet, consectetuer adipiscing elit. +Ac feugiat gravida luctus, sodales est lectus per. +Turpis torquent luctus posuere semper aliquam donec ornare. +Tortor habitasse natoque sapien parturient maecenas metus lacinia? diff --git a/tests/qgis-projects/tests/media/upload/form_edition_all_field_type/form_edition_upload/text_file_mandatory/lorem-2.txt b/tests/qgis-projects/tests/media/upload/form_edition_all_field_type/form_edition_upload/text_file_mandatory/lorem-2.txt new file mode 100644 index 0000000000..56ad3c5b69 --- /dev/null +++ b/tests/qgis-projects/tests/media/upload/form_edition_all_field_type/form_edition_upload/text_file_mandatory/lorem-2.txt @@ -0,0 +1 @@ +Lorem ipsum odor amet, consectetuer adipiscing elit. diff --git a/tests/qgis-projects/tests/tests_dataset.sql b/tests/qgis-projects/tests/tests_dataset.sql index 31bb33cc42..903030e749 100644 --- a/tests/qgis-projects/tests/tests_dataset.sql +++ b/tests/qgis-projects/tests/tests_dataset.sql @@ -3291,6 +3291,7 @@ COPY tests_projects.form_edition_snap_polygon (id, geom) FROM stdin; -- COPY tests_projects.form_edition_upload (id, generic_file, text_file, image_file, text_file_mandatory, image_file_mandatory, image_file_specific_root_folder) FROM stdin; +2 \N \N \N media/upload/form_edition_all_field_type/form_edition_upload/text_file_mandatory/lorem-2.txt media/upload/form_edition_all_field_type/form_edition_upload/image_file_mandatory/random-2.jpg ../media/specific_media_folder/random-4.jpg \. @@ -4011,7 +4012,7 @@ SELECT pg_catalog.setval('tests_projects.form_edition_snap_polygon_id_seq', 2, t -- Name: form_edition_upload_id_seq; Type: SEQUENCE SET; Schema: tests_projects; Owner: - -- -SELECT pg_catalog.setval('tests_projects.form_edition_upload_id_seq', 1, true); +SELECT pg_catalog.setval('tests_projects.form_edition_upload_id_seq', 2, true); --