From c084be79bb356c11b888cb5d8117606f2cdc9a25 Mon Sep 17 00:00:00 2001 From: mknd1 <24305436+nokedajunky@users.noreply.github.com> Date: Mon, 19 Feb 2024 13:22:22 +0100 Subject: [PATCH] [MM-T2078] Write Webapp E2E with Cypress: "MM-T2078 Profile picture: file types accepted" (#25824) Automatic Merge --- .../tests/fixtures/profile_picture.bmp | Bin 0 -> 30054 bytes .../tests/fixtures/profile_picture.jpeg | Bin 0 -> 1988 bytes .../tests/fixtures/profile_picture.jpg | Bin 0 -> 1711 bytes .../tests/fixtures/profile_picture.png | Bin 0 -> 2679 bytes .../profile_settings/profile_settings_spec.js | 59 +++++++++++++++++- 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 e2e-tests/cypress/tests/fixtures/profile_picture.bmp create mode 100644 e2e-tests/cypress/tests/fixtures/profile_picture.jpeg create mode 100644 e2e-tests/cypress/tests/fixtures/profile_picture.jpg create mode 100644 e2e-tests/cypress/tests/fixtures/profile_picture.png diff --git a/e2e-tests/cypress/tests/fixtures/profile_picture.bmp b/e2e-tests/cypress/tests/fixtures/profile_picture.bmp new file mode 100644 index 0000000000000000000000000000000000000000..6bc68e584e25fbdef194ca3725859da3c1a96a98 GIT binary patch literal 30054 zcmeI(Ig27e6u|M>Z?TbJwg`%mf#GI?V`ii#vaE>;f(Mv*L<$Ou7>J>v;DIQDpx{R^ z64Y1(O$EVY-&jK2y+6|1&-wkFt5a zUJnKX2@F_`p`^6S<+4~TRE^neRtlGRI2`Wxdo?MBZ)3??E|-60siDTb;6$TQRiM>s zm7&RG>h*eWePoZ}CfkC+pvtmXEHeBGcjBX!s@iNece~xg;h-o+qtR}+Gh#I_S@C%M z(aPy`s-ecc+)b<1N)?#NWCTIte!s5*i6@hZ5zl5bb-kU>=k0c@veN0au|dt~+N-Cu zTsiG_TS_hz3R3BGI+a*jqtTFFRTI2Nlf_*VJ8 z4^*u9wemhXvJgN30R#|0009ILKmY**5I_I{1Q0*~0R#|0009ILKmY**5I_I{1Q0*~ a0R#|0009ILKmY**5I_I{1Q7T{0)GJBlP-(^ literal 0 HcmV?d00001 diff --git a/e2e-tests/cypress/tests/fixtures/profile_picture.jpeg b/e2e-tests/cypress/tests/fixtures/profile_picture.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..ebb5abf8801262b1243bd9db6d085210a38afbf2 GIT binary patch literal 1988 zcmcgqX;4#F7`-7O5Ee-YizpTZWb9axunQp!d!cIB<3gbcB+v)}0)p(-(Kd)8tw5ul@dH0@szV*HL$wabIfc13q za03Vg00?LS*%(6P;p`mj;Uxa{)Epz$(T@jYzXA=3VMv#P;sbP4Tx)mt@E8Qr>%1$%oF0G;~*a| zn6v$SoFN_x@tt8GaM}kvB$^HTpM`vgkrBt>S}@>_Rp=~#U+7eX9$gR%e1JP}g5Mvy zLx?H@z-Ar*WcG$e;{i~68i36M8=BEC0H~b;pr&g>+xRBYR5tZpIux|aF&F^6E&)LG z5CHf;08l#e&IWCt=uICo=|X))K`RVI06NeI9)JZxfC(aDQ{B7U{rCco7Ava99Bt19j}hXLmUeyLBNqnlp+*} zRmLbo>c52SF2E^*HqeGd7yvmO0*OP&1Yiq1Ye;wy-$N0FR*=U)HghaAoN{OcQVxYu zSoc84AyM*Z1)RDfUSm5(TT{!xkznR@Vzar0wKFxo8Vb_*DA&8Bu!{Sz!n!&DRFDX$ z6C@5efMvh;_5Wj1Ny<-8BaO~PRi$UQ;8#jHD__l~H_q7?CM744`sR}wrNXG56-UD} zM`(>;xNCd-qbJY91E;>EzV@uPtEVq@nk$QvxxtT#r4w9tzszpG3_s^BBne~%rJEuFM>zI?3H>Ulqo^dnE=N345wBs3E-ggIzvioH~ zZt+6=!kBe}&eb^5$TM-RJ<&L(qMFwpy;LvhEX8>B^Yt-O@2-4fz`Csy{iO@L`Ym=&o*u;x2Sze zzIcpzyvf!!Zk2Fy-q_&rWZLPqZdTYDd9G!oJViQ{XvuhxY7%QN?5>Nru9iD@`TLOBM(k0I)T2A*; zehs@dyqNykEni_!OOK@ti1Dn1C}H4R)`By0u154S%g{BHpLwD+wBb&0sAz9{#Snkd zP~3CwM(`CWyE&(Ozk_Z}*L~}OJ;a0`nDOH0Yt-U7tEb`Z{)_j=2S$wYyVOoCPgT@q z=8%IJjL*xMoHg$EBuV12h9F<&wyjsJ^}ItH^xP+Ovb2V^F(qb?s`}H&_(1OfGd}6J zzOMtGm6dY%KMGu0?Gt%u;XJq`DCycp_d7t>84R=0X)`VudXp5NdcAgPK_c9iX1B1q z9HmF;N?+R%CmhRvJ5sw$uAf?Z)7-qL#bM-PYDODz@j9ue#-e#E&3YI48`A&@-L8{2 zk!xsnkIF16SX^54wHVA|%7Dq4zsj%e_njp=$$;N(QMdT^gnS2!^LTU0tb7SuSIaTo l^nt%-zkn7=NxD<*>Miwir8Lay=?YG|e>86Y^F>eA|2Oo|a*F@} literal 0 HcmV?d00001 diff --git a/e2e-tests/cypress/tests/fixtures/profile_picture.jpg b/e2e-tests/cypress/tests/fixtures/profile_picture.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0f594d29cc81280d7389ed94ececbc933f3b7a7b GIT binary patch literal 1711 zcmex=+ z$QDV5ur)yJBnaCE#4ax>C;_So0I`cgf}DZu6d+q89f_TU#7-_K0;%r-s5rZ)ISRxP=f? zS-`-+-@?GK?L0yZ5hewRMTubJSb!u`S{ehxr{xR`ypaqH!WS4AxT3*wKmv!`6o67P zKzHQ>VLC$&Ln?y;gC|2CLo$ONkY&VRz+lK=_Ww46GXpad2!KdtAYfr*0Rav+HdZ!H z4lXWE4o*%k9)2D!Za!{KPF_J?K7IiKK>;ovAz>i_VIW%oWC$ZjCo>BNP@@1hCpS=( zMDYIrgCGaP35FBQj7khlf{e_9jQ@`?NCAVJnGuu_;ed^ugO!s7C}$`DOq@)t%*>4J zEX)vTMkZz!RyKA)4k2Mq5k)akaV0||V@C<6#3b{w%|I<8C??Cv%CM{XT_(w z_YeQdKmCxqe!1NDytZpkq)$)Hy1W0>mSxq+f}K12&J|bR@G?4WmNhGDy?DrtSsI(>P2VU9g&$!xmdiA=bv{`CT zF1iL93mOaGzHQ?#Y@>FI|8jB7*S@wBrO#?tZ+q_WaI1g*jSAWL`JoNRp4nbJE0}fF zZ1uBMi=S!E?AkG7o`R%D>|Bp8oxAR8KisnP?&bXxk12;oAB#DhX!OVT^!0*!w|19Y z7vH`1vWw5p%vot&t2_JWB|o0!gBGyT*Dss@(|FbWuQ&TYgH7_{{o-3w_j}1s**dxU z#L0Efw+W3ZvOT3M_x9~Hd6c=VEBAY`Z)j*y$1<%)>AN34eyV!BlzH{8$}iV$$~rFnBx^iB z@$;VZl2g)Vx-B`q_gj4L;m~*4Z+2(znmJEvyU%e^_s>6%G$~#_8X;wCuysw|otR%? zd+VpW`M%qqm+{@gU%&fr^`r0QAAkM)@s$5-_3!*&(@yT$SHFDU#MA!{J)WQY@Y(bF z{@<1F9`Ej-XKnf8p<5~EHMMtNWv4#*6(4f*@~>*ICx*h)U+y)YevVytV~or3n&?@p zS7kj)Q=YXu~D`n1>jrHnRrPgb0b+h)r^QdCc zs_bLMa$40%+ROL7e=h7(_NT4ntJ2)?u%jhQ!*5d0MLi*i~s-t literal 0 HcmV?d00001 diff --git a/e2e-tests/cypress/tests/fixtures/profile_picture.png b/e2e-tests/cypress/tests/fixtures/profile_picture.png new file mode 100644 index 0000000000000000000000000000000000000000..3e555984997307d5dfdf588f0d20df25dc31c5b2 GIT binary patch literal 2679 zcmeH}>o?o!7RP@fO4TKdcFvflei?T`FNevi1B7RbOxM)cmp@%%@UN1RycK`zqh9*? zcGA?DtYt!HRJSODT&+w!R7YOz*ly;biZ)IPGu?)pgb8tB;{ua<=VvTrZ2 z$%Kf`jOOtt!Q9io{NqZ%{o`*uD7&8+l_yhrc=cg1bmvRVO<(a$=GIayMXhWtgrj)} zoFcCZ+Ebh4TgwZntf$57*#9ouFa&dGjm_f?}tv&w3PIH*H@=pmiY}2$LqtI`i{BZ*m-N?Uw+v( zu&RD13`f&7K7`*|8fT<$%!kZ#ZpflFgvM;8Ja*Ezh?BKD)k2u&pi{P%LK3H27`5q8 z`?JsPA$%a&)>z-Jtubsz{P3ZO=7iGbgmH&;eYcFwXXY*m{H^5)LN5(L-d++lZEdwV5vB*rR}^?_zrJ-8T&#$wxFj9HE-!hC2D6XcMeU)y6BMmhb_wW#AOV zJzIenW1ROEXZKs6$pd?g4&udw{*|cl3-$Obsmr`(ZCxY&+y8iO43Bv;Pu)2X#t3hg zraUepiHbD(#@`#|GOZ3%&6dmIH9*&OtW#9SRRKGVCB4>t%eZy00=Y1=L{Vk^C~(^z8R=v zPhnOdiQ%`5;2hbS#xhAwaf5yA18AS0sj}N42EvKZhEeZoqFa)nJ$7}fxqo4=7@3JO zw$FN%A^nhFXzt=r9jdsdD-$xMTZuzeZqsFl!-|K4U^RH|3aGQAdy5 z0D8Jf4F;ml4T9POZILt*E9NCt$3t;DMAcx|m@6@FHyl_oTG0pogdR&OL}=Mk}=?98S=VROGiiSL7k3h!ZW3 z#SaZ2^~Wluq$gy_`&o3(DrHM@*= z>a9elNd+6Ei4MiDNzg~@r)zf+;-f^d$$qOr^ z5T-t`7b{K>8oxRgXXevuM>TWZlYI*mJMdoS>M{bW-7hf0pR$%L-z4uy{wUa>X_<(; zO=?~sBxop(h{P3>i%FBuHIpE7HXoZ)?rxLUg`J8o^OkuGN7^qz%;;nT%nNJ|{1qhM zx*ZDhYRxQ0>w&kmP5nrF!P`mOR%x1dR@bU*(G&v{tl`$c9MH(;@Q8H|*eAFYU%wp?e+!^ hg?$G8{UnuG9I@|kDs=H#)chm?+^I8O% { it('MM-T2044 Clear fields, values revert', () => { cy.uiOpenProfileModal('Profile Settings'); - // # Click "Edit" to the right of "Full Name" + // # Click 'Edit' to the right of 'Full Name' cy.get('#nameEdit').should('be.visible').click(); // # Clear the first name @@ -48,4 +48,61 @@ describe('Profile Settings', () => { // # Close the modal cy.uiClose(); }); + + const fileTypes = [ + { + extension: 'PNG', + fileName: 'profile_picture.png', + }, + { + extension: 'JPG', + fileName: 'profile_picture.jpg', + }, + { + extension: 'JPEG', + fileName: 'profile_picture.jpeg', + }, + { + extension: 'BMP', + fileName: 'profile_picture.bmp', + }, + ]; + + fileTypes.forEach((fileType, index) => { + it(`MM-T2078_${index + 1} Profile picture: file ${fileType.extension} type accepted`, () => { + // # Save the default profile picture link so it can be compared to the new one + cy.uiGetProfileHeader().findByRole('img').invoke('attr', 'src').as('defaultProfilePictureLink'); + + cy.uiOpenProfileModal('Profile Settings'); + + // # Click 'Edit' to the right of the 'Profile Picture' + cy.get('#pictureEdit').should('be.visible').click(); + + // # Confirm the 'Save' button is blocked when no picture selected + cy.findByTestId('saveSettingPicture').should('have.class', 'disabled'); + + // # Insert the file profile picture - keep in mind that using the hidden input field is needed + cy.findByTestId('uploadPicture').attachFile(fileType.fileName); + + // # Click the 'Save' button after the image is uploaded + cy.findByTestId('saveSettingPicture').should('not.have.class', 'disabled').click(); + + // # Confirm the user was returned to the Profile modal with the 'Profile Picture' description changed and 'Edit' button visible again + cy.get('#pictureDesc').should('include.text', 'Image last updated'); + cy.get('#pictureEdit').should('be.visible'); + + // # Close the modal + cy.uiClose(); + + // # Save the new custom profile picture link so it can be compared to the old one + cy.uiGetProfileHeader().findByRole('img').invoke('attr', 'src').as('customProfilePictureLink'); + + cy.then(function() { + expect(this.customProfilePictureLink).to.not.equal(this.defaultProfilePictureLink); + + // # This regular expression (/\?_=\d+$/) checks if the string ends with ?_= followed by one or more digits. + expect(this.customProfilePictureLink, 'New custom profile picture link should end with "?image_="').to.match(/image\?_=\d+$/); + }); + }); + }); });