From 4908172a036901948712c990286934b784032b7c Mon Sep 17 00:00:00 2001 From: robinvandermolen Date: Mon, 23 Dec 2024 09:57:19 +0100 Subject: [PATCH] :white_check_mark: [#4795] Add e2e test for msg file upload --- src/openforms/tests/e2e/data/test.msg | Bin 0 -> 11264 bytes src/openforms/tests/e2e/test_file_upload.py | 61 ++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 src/openforms/tests/e2e/data/test.msg diff --git a/src/openforms/tests/e2e/data/test.msg b/src/openforms/tests/e2e/data/test.msg new file mode 100644 index 0000000000000000000000000000000000000000..b597796de62bb5b61b4584d863f83cb1cf44672c GIT binary patch literal 11264 zcmeHNO>7&-6`ti%f0XqX)pqR0Y6>Cd|&G%a($OuHp^yNiBL^?8k9P0fl`}FR|IVnZPLgFSezxwJM;1h7Sh@&4?Tt0 zt2FtqB2Fb^?l1{wmU_>zB|=+Z1!Y{>=@F)Ba=H)7!ix0zzaoNfnU+@r-)75fj-C#? z?D08EyrwA*QA|)-y8M-G`A3L<;P0bSq}wWM5Mcc)UR{{d+j!9nEkr|>Z4@Eb4vLsp ztZ__P7sYOh_fe!Rfb~&CT|cGh6ZxI+<&nVMT>tWXAT_8OUU^0n>p-3tXmmH$f4Q`) z0#_84<5yHQL>2nX zs`z`UEo>VEKm0*-AhFDT(Ft$z)6DQr?z{$aDK%>PIL`#T8#u$y6bBlyXGgbgd{AN(oU>#F?2 zo|pE&AHJ*o_4gmiyDGl)A7~i9{GU+NKgbh0rHYTWvWFsqKmREu`3L16d({sGx*z@| zaj&%h3Lgymq{=^ZzyA6IzS{m9lz-`4LIkzt4}8eK?*1cm8GE`a|L||??|;CD4_;UQ z1+J6Z2H{!^tt%t+3E5|KKaw;e37TjrY7NqM`N$P z^NZenKP|F9X+1OKPHAhW>DGOoZpJyC!6x~~jAhw0n_*z~3f+^V%w}U0O>uW_6K#2S z_Hpv2QK}MBImZ~~*_?BX4964j+Rsd^ zt9RDya;hc>b#$85CiPcNNf6A+w)ay1nq7bQdjC9?nT|hYIt{P?9x?#lrg-MrspU6g zFTSSJO^TH-T^>jd|0StUI>vWf#x-5LwGmkhy{doK)*o8y`3K8{&!236y6vsL!`S6mIUpVhX%r^x$&|54Zf(qO|$%fnY# zUS*t8%gfiomp9J}{+9;3680p<;C1Vp9H&~?s|f!1YWGi)cUAmjgbN=G!5?2rA?-G< z@}&D$274OzwJQFj)K-oE|Be6m2;svoK&ZukLTKNJivDfto+|%G3Adj7-Ftq_e_j0# zj1ON$Fz?GhMu7RRi?6|dIz&;Ge|3C(e^3{{DgLD#nn}U849)b@=(`ddX`_8K^WNRS zClf#fnac5uv9<&`1Wf*RHOAVv(K@@;gL)Zs_D?~}vM398Bk%r3*iUf4i-~$EFP-%aq5k$s^oTLGZL5#617dz$`9U7v6yta2??#xl zy!5envB8J1zq8|K$p4)w#XtPSe>RXx=rUN4Pik)~%qo g^ibbcFZB-Ryt}Tx5dGoY1x instead of openforms/static/sdk + @sync_to_async + def setUpTestData(): + # set up a form + form = FormFactory.create( + name="Form with file upload", + slug="form-with-file-upload", + generate_minimal_setup=True, + formstep__form_definition__name="First step", + formstep__form_definition__slug="first-step", + formstep__form_definition__configuration={ + "components": [ + { + "type": "file", + "key": "fileUpload", + "label": "File Upload", + "storage": "url", + "validate": { + "required": True, + }, + } + ] + }, + translation_enabled=False, # force Dutch + ask_privacy_consent=False, + ask_statement_of_truth=False, + ) + return form + + form = await setUpTestData() + form_url = str( + furl(self.live_server_url) + / reverse("forms:form-detail", kwargs={"slug": form.slug}) + ) + + with patch("openforms.utils.validators.allow_redirect_url", return_value=True): + async with browser_page() as page: + await page.goto(form_url) + + await page.get_by_role("button", name="Formulier starten").click() + + async with page.expect_file_chooser() as fc_info: + await page.get_by_text("blader").click() + + file_chooser = await fc_info.value + await file_chooser.set_files(TEST_FILES / "test.msg") + + await page.wait_for_load_state("networkidle") + + uploaded_file = page.get_by_role("link", name="test.msg") + await expect(uploaded_file).to_be_visible() + + await page.get_by_role("button", name="Volgende").click() + await page.get_by_role("button", name="Verzenden").click() + await expect( + page.get_by_text("Een moment geduld", exact=False) + ).to_be_visible()