Skip to content

Commit

Permalink
Tests - Add small tests data about upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Oct 2, 2024
1 parent bf2f579 commit 9540a9a
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 5 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 $?

Expand Down
3 changes: 3 additions & 0 deletions tests/lizmap-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
Expand Down
Empty file removed tests/qgis-projects/media/.empty
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tests/qgis-projects/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file added tests/qgis-projects/tests/media/random-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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?
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Lorem ipsum odor amet, consectetuer adipiscing elit.
3 changes: 2 additions & 1 deletion tests/qgis-projects/tests/tests_dataset.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
\.


Expand Down Expand Up @@ -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);


--
Expand Down

0 comments on commit 9540a9a

Please sign in to comment.