From 279384498d1381a0b5e34f4e88c080b83ecd3cbb Mon Sep 17 00:00:00 2001 From: Willian Keller Date: Fri, 27 Jul 2018 08:53:11 -0300 Subject: [PATCH 001/238] Add Brazilian Credit Cards Support Add Brazilian Credit Cards Support #1 --- app/code/Magento/Payment/etc/payment.xml | 9 +++++++++ .../Payment/view/base/web/images/cc/au.png | Bin 0 -> 1791 bytes .../Payment/view/base/web/images/cc/elo.png | Bin 0 -> 1397 bytes .../Payment/view/base/web/images/cc/hc.png | Bin 0 -> 1427 bytes 4 files changed, 9 insertions(+) create mode 100644 app/code/Magento/Payment/view/base/web/images/cc/au.png create mode 100644 app/code/Magento/Payment/view/base/web/images/cc/elo.png create mode 100644 app/code/Magento/Payment/view/base/web/images/cc/hc.png diff --git a/app/code/Magento/Payment/etc/payment.xml b/app/code/Magento/Payment/etc/payment.xml index 19b5eb709c649..4afb6b01b366c 100644 --- a/app/code/Magento/Payment/etc/payment.xml +++ b/app/code/Magento/Payment/etc/payment.xml @@ -41,5 +41,14 @@ + + + + + + + + + diff --git a/app/code/Magento/Payment/view/base/web/images/cc/au.png b/app/code/Magento/Payment/view/base/web/images/cc/au.png new file mode 100644 index 0000000000000000000000000000000000000000..04cb2df8fa332127111138efe7499c74dea562bb GIT binary patch literal 1791 zcmVBW zK~z}7)tG&3U1c4|KfmWW=iGbS+ioq)Fxr*j*3FGD%%%Bk!1o$8i(;n8WJ&G5^2oS}VR}VF_ZTn3e{O2O(HFn{gnPDUd zvV7%sooP7rbl32+UAtJf?hr(vg;Fx0m~12k1h9Yq3hvx+H<_w%hTa!uWV#V041HdF zZY%4qKZNE=N|zKK;jRVHKDchpVO~DC1uKd%Zbt5!k>c&A>-qW4M_Jg|jt-Zlaw-Il z0S%!pljDiUx6yX$;+es7y3jNz28Th3#V{xVy(UAaWcl2eTlmDaZ$L)CGiYRS10G4Q zPtp~TbO*RW52prF2C@QKSaIbEHr)3d@48xgO@={}A`}aNEy+iD^#qDnwQpfMh|9bUEXG61|OE46nP{MB{5GfiJtKwKWQ^YGZTz0HS(gef_nkXbP zx-UkNK*2A?f&pZDT^xcpPH8FYTyqAOGsS?&I81}XG#9YVA$DPiy)44aaY$W^nWadT zLyQ}{iHV-oBHv=>5wy?Zx-G8VBRS!d91lqT9pFy-&{eeBq!sFtqG4qLZ*X|T0tIjd zgJd0ML4;jaz*|wkE()=ihnNo~n5-M?B^{7VP)N(3wXAZM!^47j4zC)RTb6ZfnT-X( zbyF|3RHw) zo2I2>2?q|Z;=qwrw6ray-)7GmM$R(8m*zp&Fv!+HsFwecNwUwRlDyy5s5f`r$9`QO%1UKRI7hYhKay_y170KDtSF{^nNI z1YP)ry}I?WyYTh>C;74}N(& z5Bzi^N1nQcS+)IKQrE@rUbvopEmt8jRqLaZ&zxf5-JUu8@xZ6~!y_AMs_CGqs$=W} zAO7_4M(+6TL#+SIGi?6qle~4hfz@|BNpoWx)#+gtH@4Cr{Ee#q%ND zzV6Sw^yYHzdE^0Bf8;d^QHsmvcCfgijkfknnY*lWY%rPNadA1(No^BBtzeu(U1j5( zH4v5BFCQZHP$zgM!HC1DLE=(H^##K5m0CO@avrK+CBcfri6HS*e-BKj`2R5(E=ZCK hRdK~!h%iBg{{f~>4i{y7PpAL@002ovPDHLkV1ifUU4sAs literal 0 HcmV?d00001 diff --git a/app/code/Magento/Payment/view/base/web/images/cc/elo.png b/app/code/Magento/Payment/view/base/web/images/cc/elo.png new file mode 100644 index 0000000000000000000000000000000000000000..eba0296a09104b059809ff2beea5ce501dab24e4 GIT binary patch literal 1397 zcmV-*1&aEKP)(lr0Rd#KBdHf=K;tl)tQ zmwSG{%jceZ&iDL|*r+r*l!motnn4Hz5(|(JYXVpb;1g3J1OTqJXxC_ZNUT88XFtoa=Abf*RNm4$jHdQ{5T17fd)^r30vNh2u}$N{~X01_fh~8 zt5)b`e~Z~{=KlTr8488?vfa6Jhiz?b)HE%#e%G#D8NbKldFg$El^YHG=6DeoW-Me% zk_kbk1erAO%J)TVe6N5~>IjHsQ)O9jo6W`x7cOumJ9FmDs=$R%?Cr6W3mQ46kui`I zWD?|@Aft+NkBsd2w2*+J5F&qYr4&z{I+X=DG&IDnt}Y%rbclgKAj@~`*s)ba9JJbu zd~mmr$r(M*e`n)?&q{dw>-7xXw=q2nre_5iGt*UFKtNkE^2>r(S66d>ex4*5iA31Z z(ecWf?(Xgk7D7Ze!Sf8I*Q6d477 z{l!W^c%$6Idu7e^m29PgTr!dd zgON8z%wz;)OwZbFmi)m72M03%m6eqQz=nnf`u%<;lgTXL(a}-v*|R5Ss#NGqd{XA+ zQ-_!S4ewGXauuFp*8wA$068o9`GLZm;5p^cYPDwWw{PE$zP>(qJf6(6hYufOcz75- zpAUY&e_7cwD+QSbq!gG)E+Cyl?SzmRf1m@91Vjo}o629uCnqN}P2}9Ua}duP!}$0( zPM$o8OP4O;=FOWqo6L*$G?heJ0%;IilnD@viNaU(J&kv20f;034U^$y{%4ho7cV}K zf&fX3jg6tby&ao3Z^nreClCk(GX9n9Q6h#vnFK-9>k83mvVm%;<0>&UtZ+A22q=lc zpO}9Gs;a7DFc{>(zyMoYTUlIOOq0o!@t2mCva_?3PNy?#--|ik+1Z)d^O3cJ@roUs zc6d2a?&XexV(R5Ts#0UH@MFuyMJbj#wzm~!sm{weo^t|HN};^G9HCGMi9`aYPoG9p zQxk6Az73@m+-^5&YHD!p+BLMav>+S~FHR>lHJQH=jYbg&1aRcY5&UrZGWynUL#y77 z2vUfX_$~Deo7e%jiX18A|8(; znoeP0;R&QBQ6w~&r4BkJkrG6Raa>8x;)}U4j4sSBs(cPBk!tnBvejxuMMVW{HXBG{ zYHA7-6BCF;B02Zi?RMDhb_9dLY(-ZlbIP+K!E?_dQ}jp(;M*@P>u9Pg{X|F00000NkvXXu0mjf DE(3;T literal 0 HcmV?d00001 diff --git a/app/code/Magento/Payment/view/base/web/images/cc/hc.png b/app/code/Magento/Payment/view/base/web/images/cc/hc.png new file mode 100644 index 0000000000000000000000000000000000000000..203e0b7e305c16191909dc552f26e7e2c76afa49 GIT binary patch literal 1427 zcmV;E1#J3>P)s_c}|bbeS$9rE~*}#h`#j5JZhgh(`YqF(9sq8c-zB#P~x@ zfQS+|BoPx)W0a7f;u19&1S>`f5&>BPrGR$Yf>XN8^4`qbu0I9}qy8}dFeT~vch7zA z-0z-q?m730&&x+kEAHapcvn)K*1R;jhZZe7QIQTgm z-*JWobOE@Z&C_o3nnkv|8@qpi^s)8}0n)U>O-K-$icr-H-Vp+X7}5zv zL1-F6$uC9aPPogBFP(G>tP~Zv*KQ8Q)BxbQI3OAlc41rPHP$v;Y+|XK?20 zZ;+mMk;kP(FE2-ngsHu6A(P*Hoyi;CpmF(9G94!YXnuM*k>*Awu3CYjX`~JxVeH~X z)XbYp)tpZ>xncs(6VX;Qi5k$T)Ac?PBP8l{$I)V^x!)#siVh8 z?EH>!eI0cVE~b3?^-Ns#JZ>t3UOI{iE1o6yM}pL`V+2Z~Sn)Xcexb+p@-n0^IkI9E ze#XSJb4+^mCG0Z^^jHPbbKSp&m z$wP+`2o%G>s3<4f(?e+7IQA}nh22GEV(1uEF{J0A zmzAOzMTBa{V8y%O++jB=W2i+2MO9Ulw6-Aa9Eopt5@~KE+HwW<*|P+qQOwSG-Z4P~ zt+*IP4^VU09U#E&>mTyCmah;hS|mc>PrH$>3xFC9W5wfSPMpN3tl;dAyQ!IX8@}Uk z)oW`}LqU$OTTiB=gZ5X}G5(pS$h4mTRpsdFHTaH0wz~%<807eC>uGrWF^tMeoW4Fz zz5Om;Hp`@!*N{APn8E!A@G>Um$y2zg6u#rowPh={3l~s!?NnULWbnX2JS&^8Hh?() zbW?*tr03z=_E33LgGIRM3~DHd8VWJ(!}s{*ktMjvG`?-)rqf8@M`#*aaRh`wIxcQH zjT#K%=W_Wfpa=rRQBW0R&c@AT(29!@0SzyeM$rwtoQ0z6cvg0(hXjfvNGb753!$p{ z{&G%+4(G*60O@(S=}dkuV-g&F8PajcC3B4Va7pH%qKC(_O_)raAG}#=J*{frx+m%9m0iT^A(~7#85#zuut`h+zUfavvW7 h9|0f6qKQis{7;G9J|AYPA143+002ovPDHLkV1hClmmvTE literal 0 HcmV?d00001 From 6c1b1442e16e32e7af5cd0951000732e5564afb5 Mon Sep 17 00:00:00 2001 From: Willian Keller Date: Tue, 7 Aug 2018 15:52:47 -0300 Subject: [PATCH 002/238] Add Brazilian Credit Cards regex #1 --- .../credit-card-type.js | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js index 3ac67f6f31002..b438371cc24a5 100644 --- a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js +++ b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js @@ -110,6 +110,39 @@ define([ name: 'CVC', size: 3 } + }, + { + title: 'Hipercard', + type: 'HC', + pattern: '^((606282)|(637095)|(637568)|(637599)|(637609)|(637612))\\d*$', + gaps: [4, 8, 12], + lengths: [13, 16], + code: { + name: 'CVC', + size: 3 + } + }, + { + title: 'Elo', + type: 'ELO', + pattern: '^((509091)|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|(457393)|(431274)|(50990[0-2])|(5099[7-9][0-9])|(50996[4-9])|(509[1-8][0-9][0-9])|(5090(0[0-2]|0[4-9]|1[2-9]|[24589][0-9]|3[1-9]|6[0-46-9]|7[0-24-9]))|(5067(0[0-24-8]|1[0-24-9]|2[014-9]|3[0-379]|4[0-9]|5[0-3]|6[0-5]|7[0-8]))|(6504(0[5-9]|1[0-9]|2[0-9]|3[0-9]))|(6504(8[5-9]|9[0-9])|6505(0[0-9]|1[0-9]|2[0-9]|3[0-8]))|(6505(4[1-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-8]))|(6507(0[0-9]|1[0-8]))|(65072[0-7])|(6509(0[1-9]|1[0-9]|20))|(6516(5[2-9]|6[0-9]|7[0-9]))|(6550(0[0-9]|1[0-9]))|(6550(2[1-9]|3[0-9]|4[0-9]|5[0-8])))\\d*$', + gaps: [4, 8, 12], + lengths: [16], + code: { + name: 'CVC', + size: 3 + } + }, + { + title: 'Aura', + type: 'AU', + pattern: '^5078\\d*$', + gaps: [4, 8, 12], + lengths: [19], + code: { + name: 'CVC', + size: 3 + } } ]; From 8832267ac724434fc661ab71f59429cbc62d0e7b Mon Sep 17 00:00:00 2001 From: Volodymyr Kublytskyi Date: Thu, 13 Sep 2018 18:03:30 +0300 Subject: [PATCH 003/238] magento/payment-improvements#1: Add Brazilian Credit Cards Support - formatting of pattern to match code style requirements --- .../credit-card-number-validator/credit-card-type.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js index b438371cc24a5..1b387b384104f 100644 --- a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js +++ b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js @@ -125,7 +125,16 @@ define([ { title: 'Elo', type: 'ELO', - pattern: '^((509091)|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|(457393)|(431274)|(50990[0-2])|(5099[7-9][0-9])|(50996[4-9])|(509[1-8][0-9][0-9])|(5090(0[0-2]|0[4-9]|1[2-9]|[24589][0-9]|3[1-9]|6[0-46-9]|7[0-24-9]))|(5067(0[0-24-8]|1[0-24-9]|2[014-9]|3[0-379]|4[0-9]|5[0-3]|6[0-5]|7[0-8]))|(6504(0[5-9]|1[0-9]|2[0-9]|3[0-9]))|(6504(8[5-9]|9[0-9])|6505(0[0-9]|1[0-9]|2[0-9]|3[0-8]))|(6505(4[1-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-8]))|(6507(0[0-9]|1[0-8]))|(65072[0-7])|(6509(0[1-9]|1[0-9]|20))|(6516(5[2-9]|6[0-9]|7[0-9]))|(6550(0[0-9]|1[0-9]))|(6550(2[1-9]|3[0-9]|4[0-9]|5[0-8])))\\d*$', + pattern: '^((509091)|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|' + + '(457393)|(431274)|(50990[0-2])|(5099[7-9][0-9])|(50996[4-9])|(509[1-8][0-9][0-9])|' + + '(5090(0[0-2]|0[4-9]|1[2-9]|[24589][0-9]|3[1-9]|6[0-46-9]|7[0-24-9]))|' + + '(5067(0[0-24-8]|1[0-24-9]|2[014-9]|3[0-379]|4[0-9]|5[0-3]|6[0-5]|7[0-8]))|' + + '(6504(0[5-9]|1[0-9]|2[0-9]|3[0-9]))|' + + '(6504(8[5-9]|9[0-9])|6505(0[0-9]|1[0-9]|2[0-9]|3[0-8]))|' + + '(6505(4[1-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-8]))|' + + '(6507(0[0-9]|1[0-8]))|(65072[0-7])|(6509(0[1-9]|1[0-9]|20))|' + + '(6516(5[2-9]|6[0-9]|7[0-9]))|(6550(0[0-9]|1[0-9]))|' + + '(6550(2[1-9]|3[0-9]|4[0-9]|5[0-8])))\\d*$', gaps: [4, 8, 12], lengths: [16], code: { From 6ffb464c3e8a11791aea875a2e8cb6629c7ac51e Mon Sep 17 00:00:00 2001 From: Volodymyr Kublytskyi Date: Thu, 13 Sep 2018 18:14:27 +0300 Subject: [PATCH 004/238] magento/payment-improvements#1: Add Brazilian Credit Cards Support - added patterns for Brazilian cards to validator --- app/code/Magento/Payment/Model/Method/Cc.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index c23ad5b535dd8..06661469014a5 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -148,6 +148,22 @@ public function validate() 'JCB' => '/^35(2[8-9][0-9]{12,15}|[3-8][0-9]{13,16})/', 'MI' => '/^(5(0|[6-9])|63|67(?!59|6770|6774))\d*$/', 'MD' => '/^(6759(?!24|38|40|6[3-9]|70|76)|676770|676774)\d*$/', + + //Hipercard + 'HC' => '/^((606282)|(637095)|(637568)|(637599)|(637609)|(637612))\d*$/', + //Elo + 'ELO' => '/^((509091)|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|' . + '(457393)|(431274)|(50990[0-2])|(5099[7-9][0-9])|(50996[4-9])|(509[1-8][0-9][0-9])|' . + '(5090(0[0-2]|0[4-9]|1[2-9]|[24589][0-9]|3[1-9]|6[0-46-9]|7[0-24-9]))|' . + '(5067(0[0-24-8]|1[0-24-9]|2[014-9]|3[0-379]|4[0-9]|5[0-3]|6[0-5]|7[0-8]))|' . + '(6504(0[5-9]|1[0-9]|2[0-9]|3[0-9]))|' . + '(6504(8[5-9]|9[0-9])|6505(0[0-9]|1[0-9]|2[0-9]|3[0-8]))|' . + '(6505(4[1-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-8]))|' . + '(6507(0[0-9]|1[0-8]))|(65072[0-7])|(6509(0[1-9]|1[0-9]|20))|' . + '(6516(5[2-9]|6[0-9]|7[0-9]))|(6550(0[0-9]|1[0-9]))|' . + '(6550(2[1-9]|3[0-9]|4[0-9]|5[0-8])))\d*$/', + //Aura + 'AU' => '/^5078\d*$/' ]; $ccNumAndTypeMatches = isset( From 22a40ccdbcd699fcc61be1330611f70126744f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karla=20Saarem=C3=A4e?= Date: Fri, 19 Oct 2018 19:29:10 +0300 Subject: [PATCH 005/238] text showing feature added feature to show text when icon is set to false --- lib/web/css/source/lib/_icons.less | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/lib/web/css/source/lib/_icons.less b/lib/web/css/source/lib/_icons.less index d113935e2b1cd..08e4798426343 100644 --- a/lib/web/css/source/lib/_icons.less +++ b/lib/web/css/source/lib/_icons.less @@ -25,9 +25,12 @@ @_icon-font-text-hide: @icon-font__text-hide, @_icon-font-display: @icon-font__display ) when (@_icon-font-position = before) { - ._lib-icon-text-hide(@_icon-font-text-hide); .lib-css(display, @_icon-font-display); - text-decoration: none; + text-decoration: none; + + & when not (@_icon-font-content = false) { + ._lib-icon-text-hide(@_icon-font-text-hide); + } &:before { ._lib-icon-font( @@ -68,10 +71,13 @@ @_icon-font-text-hide: @icon-font__text-hide, @_icon-font-display: @icon-font__display ) when (@_icon-font-position = after) { - ._lib-icon-text-hide(@_icon-font-text-hide); .lib-css(display, @_icon-font-display); text-decoration: none; - + + & when not (@_icon-font-content = false) { + ._lib-icon-text-hide(@_icon-font-text-hide); + } + &:after { ._lib-icon-font( @_icon-font-content, @@ -151,8 +157,11 @@ @_icon-image-text-hide: @icon__text-hide ) when (@_icon-image-position = before) { display: inline-block; - ._lib-icon-text-hide(@_icon-image-text-hide); - + + & when not (@_icon-image = false) { + ._lib-icon-text-hide(@_icon-font-text-hide); + } + &:before { ._lib-icon-image( @_icon-image, @@ -179,7 +188,10 @@ @_icon-image-text-hide: @icon__text-hide ) when (@_icon-image-position = after) { display: inline-block; - ._lib-icon-text-hide(@_icon-image-text-hide); + + & when not (@_icon-image = false) { + ._lib-icon-text-hide(@_icon-font-text-hide); + } &:after { ._lib-icon-image( From 4b9b8a3f533c017ab7ba9c8ac2f52bb47777a6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karla=20Saarem=C3=A4e?= Date: Tue, 23 Oct 2018 20:05:05 +0300 Subject: [PATCH 006/238] Update _icons.less fix typo --- lib/web/css/source/lib/_icons.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/css/source/lib/_icons.less b/lib/web/css/source/lib/_icons.less index 08e4798426343..abb8b43368f13 100644 --- a/lib/web/css/source/lib/_icons.less +++ b/lib/web/css/source/lib/_icons.less @@ -159,7 +159,7 @@ display: inline-block; & when not (@_icon-image = false) { - ._lib-icon-text-hide(@_icon-font-text-hide); + ._lib-icon-text-hide(@_icon-image-text-hide); } &:before { From a8f662ebe2ed6a190ea34d407a6085678add93f0 Mon Sep 17 00:00:00 2001 From: Wiard van Rij Date: Sat, 27 Oct 2018 03:08:48 +0200 Subject: [PATCH 007/238] Changes log info on varnish purges --- .../Magento/CacheInvalidate/Model/PurgeCache.php | 14 ++++++++++++-- .../Magento/Framework/Cache/InvalidateLogger.php | 6 ++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php index 727e18280d76f..293f82ef67f7d 100644 --- a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php +++ b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php @@ -118,6 +118,7 @@ private function splitTags($tagsPattern) private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedTagsChunk) { $headers = [self::HEADER_X_MAGENTO_TAGS_PATTERN => $formattedTagsChunk]; + $unresponsiveServerCount = 0; foreach ($servers as $server) { $headers['Host'] = $server->getHost(); try { @@ -131,10 +132,19 @@ private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedT $socketAdapter->read(); $socketAdapter->close(); } catch (\Exception $e) { - $this->logger->critical($e->getMessage(), compact('server', 'formattedTagsChunk')); - return false; + $unresponsiveServerCount++; + if ($unresponsiveServerCount == count($servers)) { + $this->logger->critical('Available cache server(s) are unresponsive: ' . $e->getMessage(), compact('server', + 'formattedTagsChunk')); + return false; + } else { + $this->logger->warning('Unresponsive cache server hit, yet more cache servers are available: ' . + $e->getMessage(), compact('server', 'formattedTagsChunk')); + continue; + } } } + $this->logger->execute(compact('servers', 'formattedTagsChunk')); return true; } diff --git a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php index 10886f911e295..c440d3c03ecc5 100644 --- a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php +++ b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php @@ -65,4 +65,10 @@ public function critical($message, $params) { $this->logger->critical($message, $this->makeParams($params)); } + + public function warning($message, $params) + { + $this->logger->warning($message, $this->makeParams($params)); + } + } From 04aa94e7062eab740d88c814277e08e0458596a1 Mon Sep 17 00:00:00 2001 From: Wiard van Rij Date: Sat, 27 Oct 2018 03:10:31 +0200 Subject: [PATCH 008/238] Add docblock --- lib/internal/Magento/Framework/Cache/InvalidateLogger.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php index c440d3c03ecc5..60817c281880d 100644 --- a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php +++ b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php @@ -66,6 +66,13 @@ public function critical($message, $params) $this->logger->critical($message, $this->makeParams($params)); } + /** + * Log warning + * + * @param string $message + * @param mixed $params + * @return void + */ public function warning($message, $params) { $this->logger->warning($message, $this->makeParams($params)); From 0ab520a162e03e4a45161ced4bcb32eaef12ad89 Mon Sep 17 00:00:00 2001 From: Wiard van Rij Date: Tue, 13 Nov 2018 22:39:36 +0100 Subject: [PATCH 009/238] Changes logger logic --- .../CacheInvalidate/Model/PurgeCache.php | 28 +++++++++++-------- .../Framework/Cache/InvalidateLogger.php | 2 +- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php index 293f82ef67f7d..316afc12e8454 100644 --- a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php +++ b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php @@ -118,7 +118,7 @@ private function splitTags($tagsPattern) private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedTagsChunk) { $headers = [self::HEADER_X_MAGENTO_TAGS_PATTERN => $formattedTagsChunk]; - $unresponsiveServerCount = 0; + $unresponsiveServerError = []; foreach ($servers as $server) { $headers['Host'] = $server->getHost(); try { @@ -132,16 +132,22 @@ private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedT $socketAdapter->read(); $socketAdapter->close(); } catch (\Exception $e) { - $unresponsiveServerCount++; - if ($unresponsiveServerCount == count($servers)) { - $this->logger->critical('Available cache server(s) are unresponsive: ' . $e->getMessage(), compact('server', - 'formattedTagsChunk')); - return false; - } else { - $this->logger->warning('Unresponsive cache server hit, yet more cache servers are available: ' . - $e->getMessage(), compact('server', 'formattedTagsChunk')); - continue; - } + $unresponsiveServerError[] = "Cache host: " . $server->getHost() . ":" . $server->getPort() . + "resulted in error message: " . $e->getMessage(); + continue; + } + } + + if($errorCount = count($unresponsiveServerError) > 0) { + + $loggerMessage = implode(" ",$unresponsiveServerError); + + if($errorCount == count($servers)) { + $this->logger->critical('No cache server(s) could be purged ' . $loggerMessage, compact('server', + 'formattedTagsChunk')); + } else { + $this->logger->warning('Unresponsive cache server(s) hit' . $loggerMessage, compact('server', + 'formattedTagsChunk')); } } diff --git a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php index 60817c281880d..4895e65694fe4 100644 --- a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php +++ b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php @@ -78,4 +78,4 @@ public function warning($message, $params) $this->logger->warning($message, $this->makeParams($params)); } -} +} \ No newline at end of file From fb5a9d137e77848861b8312db39c23c9bab88f70 Mon Sep 17 00:00:00 2001 From: Wiard van Rij Date: Wed, 14 Nov 2018 13:34:10 +0100 Subject: [PATCH 010/238] fixes style --- app/code/Magento/CacheInvalidate/Model/PurgeCache.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php index 316afc12e8454..f018a399a5f3f 100644 --- a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php +++ b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php @@ -138,11 +138,13 @@ private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedT } } - if($errorCount = count($unresponsiveServerError) > 0) { + $errorCount = count($unresponsiveServerError); - $loggerMessage = implode(" ",$unresponsiveServerError); + if ($errorCount > 0) { - if($errorCount == count($servers)) { + $loggerMessage = implode(" ", $unresponsiveServerError); + + if ($errorCount == count($servers)) { $this->logger->critical('No cache server(s) could be purged ' . $loggerMessage, compact('server', 'formattedTagsChunk')); } else { From 7f2c079e2ebbc604056ef359c4c627b9cd7c776d Mon Sep 17 00:00:00 2001 From: Wiard van Rij Date: Wed, 14 Nov 2018 13:35:43 +0100 Subject: [PATCH 011/238] Fixes return statement --- app/code/Magento/CacheInvalidate/Model/PurgeCache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php index f018a399a5f3f..890f02533dcd1 100644 --- a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php +++ b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php @@ -134,7 +134,6 @@ private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedT } catch (\Exception $e) { $unresponsiveServerError[] = "Cache host: " . $server->getHost() . ":" . $server->getPort() . "resulted in error message: " . $e->getMessage(); - continue; } } @@ -147,6 +146,7 @@ private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedT if ($errorCount == count($servers)) { $this->logger->critical('No cache server(s) could be purged ' . $loggerMessage, compact('server', 'formattedTagsChunk')); + return false; } else { $this->logger->warning('Unresponsive cache server(s) hit' . $loggerMessage, compact('server', 'formattedTagsChunk')); From d74640a3c3e1c68a6e0b232178c347b219e96340 Mon Sep 17 00:00:00 2001 From: Wiard van Rij Date: Wed, 14 Nov 2018 21:36:15 +0100 Subject: [PATCH 012/238] Fixes cosmetic --- app/code/Magento/CacheInvalidate/Model/PurgeCache.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php index 890f02533dcd1..6786c6fa2539a 100644 --- a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php +++ b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php @@ -144,12 +144,12 @@ private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedT $loggerMessage = implode(" ", $unresponsiveServerError); if ($errorCount == count($servers)) { - $this->logger->critical('No cache server(s) could be purged ' . $loggerMessage, compact('server', - 'formattedTagsChunk')); + $this->logger->critical('No cache server(s) could be purged ' . $loggerMessage, + compact('server', 'formattedTagsChunk')); return false; } else { - $this->logger->warning('Unresponsive cache server(s) hit' . $loggerMessage, compact('server', - 'formattedTagsChunk')); + $this->logger->warning('Unresponsive cache server(s) hit' . $loggerMessage, + compact('server', 'formattedTagsChunk')); } } From 9a5bc5ffc8b9119b9d69cad5aa155c6b75c5d9bc Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko Date: Thu, 15 Nov 2018 14:04:39 +0200 Subject: [PATCH 013/238] Removed unnecessary blank line --- lib/internal/Magento/Framework/Cache/InvalidateLogger.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php index 4895e65694fe4..dd97e88b6344b 100644 --- a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php +++ b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php @@ -77,5 +77,4 @@ public function warning($message, $params) { $this->logger->warning($message, $this->makeParams($params)); } - -} \ No newline at end of file +} From de6af27f23374277478d1903e4e68c1f3dfdc59b Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko Date: Thu, 15 Nov 2018 14:08:09 +0200 Subject: [PATCH 014/238] Fixed function calls formatting --- .../Magento/CacheInvalidate/Model/PurgeCache.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php index 6786c6fa2539a..e236b5fb3908f 100644 --- a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php +++ b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php @@ -144,13 +144,17 @@ private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedT $loggerMessage = implode(" ", $unresponsiveServerError); if ($errorCount == count($servers)) { - $this->logger->critical('No cache server(s) could be purged ' . $loggerMessage, - compact('server', 'formattedTagsChunk')); + $this->logger->critical( + 'No cache server(s) could be purged ' . $loggerMessage, + compact('server', 'formattedTagsChunk') + ); return false; - } else { - $this->logger->warning('Unresponsive cache server(s) hit' . $loggerMessage, - compact('server', 'formattedTagsChunk')); } + + $this->logger->warning( + 'Unresponsive cache server(s) hit' . $loggerMessage, + compact('server', 'formattedTagsChunk') + ); } $this->logger->execute(compact('servers', 'formattedTagsChunk')); From 34bdaa9c587b33cc2452e325dac329ba0b597066 Mon Sep 17 00:00:00 2001 From: stani Date: Fri, 26 Oct 2018 10:28:22 +0200 Subject: [PATCH 015/238] magento-engcom/import-export-improvements#75: fix stoping on errors so that it uses isErrorLimitExceeded instead of count errors, and include checking critical errors in isErrorLimitExceeded --- app/code/Magento/ImportExport/Model/Import.php | 9 ++------- .../Import/ErrorProcessing/ProcessingErrorAggregator.php | 4 ++-- .../ErrorProcessing/ProcessingErrorAggregatorTest.php | 1 + 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/ImportExport/Model/Import.php b/app/code/Magento/ImportExport/Model/Import.php index 064c696ad0a84..19ab8f885c01d 100644 --- a/app/code/Magento/ImportExport/Model/Import.php +++ b/app/code/Magento/ImportExport/Model/Import.php @@ -288,7 +288,7 @@ public function getOperationResultMessages(ProcessingErrorAggregatorInterface $v { $messages = []; if ($this->getProcessedRowsCount()) { - if ($validationResult->getErrorsCount()) { + if ($validationResult->isErrorLimitExceeded()) { $messages[] = __('Data validation failed. Please fix the following errors and upload the file again.'); // errors info @@ -588,12 +588,7 @@ public function validateSource(\Magento\ImportExport\Model\Import\AbstractSource $messages = $this->getOperationResultMessages($errorAggregator); $this->addLogComment($messages); - $result = !$errorAggregator->getErrorsCount(); - $validationStrategy = $this->getData(self::FIELD_NAME_VALIDATION_STRATEGY); - if ($validationStrategy === ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_SKIP_ERRORS) { - $result = true; - } - + $result = !$errorAggregator->isErrorLimitExceeded(); if ($result) { $this->addLogComment(__('Import data validation is complete.')); } diff --git a/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php b/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php index 7f49e2022c410..c1b7b96d9b157 100644 --- a/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php +++ b/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php @@ -191,10 +191,10 @@ public function hasToBeTerminated() public function isErrorLimitExceeded() { $isExceeded = false; - $errorsCount = $this->getErrorsCount([ProcessingError::ERROR_LEVEL_NOT_CRITICAL]); + $errorsCount = $this->getErrorsCount(); if ($errorsCount > 0 && $this->validationStrategy == self::VALIDATION_STRATEGY_STOP_ON_ERROR - && $errorsCount >= $this->allowedErrorsCount + && $errorsCount > $this->allowedErrorsCount ) { $isExceeded = true; } diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Import/ErrorProcessing/ProcessingErrorAggregatorTest.php b/app/code/Magento/ImportExport/Test/Unit/Model/Import/ErrorProcessing/ProcessingErrorAggregatorTest.php index a4c380d51ebe3..ecad4f4748c15 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Import/ErrorProcessing/ProcessingErrorAggregatorTest.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Import/ErrorProcessing/ProcessingErrorAggregatorTest.php @@ -216,6 +216,7 @@ public function testIsErrorLimitExceededTrue() */ public function testIsErrorLimitExceededFalse() { + $this->model->initValidationStrategy('validation-stop-on-errors', 5); $this->model->addError('systemException'); $this->model->addError('systemException', 'critical', 7, 'Some column name', 'Message', 'Description'); $this->model->addError('systemException', 'critical', 4, 'Some column name', 'Message', 'Description'); From ddda1fb94446caae6f405d6b431ff44eaaa369b5 Mon Sep 17 00:00:00 2001 From: stani Date: Fri, 26 Oct 2018 12:26:35 +0200 Subject: [PATCH 016/238] magento-engcom/import-export-improvements#75: always show detailed error information --- .../ImportExport/Controller/Adminhtml/Import/Validate.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php b/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php index 204e9b11085ed..f10dfc1130bbe 100644 --- a/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php +++ b/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php @@ -85,7 +85,7 @@ private function processValidationResult($validationResult, $resultBlock) $resultBlock->addError( __('Data validation failed. Please fix the following errors and upload the file again.') ); - $this->addErrorMessages($resultBlock, $errorAggregator); + if ($errorAggregator->getErrorsCount()) { $this->addMessageToSkipErrors($resultBlock); } @@ -99,6 +99,8 @@ private function processValidationResult($validationResult, $resultBlock) $errorAggregator->getErrorsCount() ) ); + + $this->addErrorMessages($resultBlock, $errorAggregator); } else { if ($errorAggregator->getErrorsCount()) { $this->collectErrors($resultBlock); From 31f238e8680f6a7912f01581bacc0a16c41088f4 Mon Sep 17 00:00:00 2001 From: David Manners Date: Fri, 16 Nov 2018 09:46:30 +0000 Subject: [PATCH 017/238] magento-engcom/import-export-improvements#75: update validate controller with phpcs errors --- .../ImportExport/Controller/Adminhtml/Import/Validate.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php b/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php index f10dfc1130bbe..b96145e0d3ece 100644 --- a/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php +++ b/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php @@ -13,6 +13,9 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\ImportExport\Model\Import\Adapter as ImportAdapter; +/** + * Controller responsible for validating the import process and showing the results + */ class Validate extends ImportResultController implements HttpPostActionInterface { /** @@ -111,6 +114,8 @@ private function processValidationResult($validationResult, $resultBlock) } /** + * Get the import class + * * @return Import * @deprecated 100.1.0 */ From fe2c0358c0f3702af0fe2c95f8d78805a86e4934 Mon Sep 17 00:00:00 2001 From: David Manners Date: Fri, 16 Nov 2018 12:53:14 +0000 Subject: [PATCH 018/238] magento-engcom/import-export-improvements#75: update the aggregator based on phpcs feedback --- .../ProcessingErrorAggregator.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php b/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php index c1b7b96d9b157..028bf2c464d4b 100644 --- a/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php +++ b/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php @@ -61,6 +61,8 @@ public function __construct( } /** + * Add error via code and level + * * @param string $errorCode * @param string $errorLevel * @param int|null $rowNumber @@ -96,6 +98,8 @@ public function addError( } /** + * Add row to be skipped during import + * * @param int $rowNumber * @return $this */ @@ -110,6 +114,8 @@ public function addRowToSkip($rowNumber) } /** + * Add specific row to invalid list via row number + * * @param int $rowNumber * @return $this */ @@ -126,6 +132,8 @@ protected function processInvalidRow($rowNumber) } /** + * Add error message template + * * @param string $code * @param string $template * @return $this @@ -138,6 +146,8 @@ public function addErrorMessageTemplate($code, $template) } /** + * Check if row is invalid by row number + * * @param int $rowNumber * @return bool */ @@ -147,6 +157,8 @@ public function isRowInvalid($rowNumber) } /** + * Get number of invalid rows + * * @return int */ public function getInvalidRowsCount() @@ -155,6 +167,8 @@ public function getInvalidRowsCount() } /** + * Initialize validation strategy + * * @param string $validationStrategy * @param int $allowedErrorCount * @return $this @@ -178,6 +192,8 @@ public function initValidationStrategy($validationStrategy, $allowedErrorCount = } /** + * Check if import has to be terminated + * * @return bool */ public function hasToBeTerminated() @@ -186,6 +202,8 @@ public function hasToBeTerminated() } /** + * Check if error limit has been exceeded + * * @return bool */ public function isErrorLimitExceeded() @@ -203,6 +221,8 @@ public function isErrorLimitExceeded() } /** + * Check if import has a fatal error + * * @return bool */ public function hasFatalExceptions() @@ -211,6 +231,8 @@ public function hasFatalExceptions() } /** + * Get all errors from an import process + * * @return ProcessingError[] */ public function getAllErrors() @@ -228,6 +250,8 @@ public function getAllErrors() } /** + * Get a specific set of errors via codes + * * @param string[] $codes * @return ProcessingError[] */ @@ -244,6 +268,8 @@ public function getErrorsByCode(array $codes) } /** + * Get an error via row number + * * @param int $rowNumber * @return ProcessingError[] */ @@ -258,6 +284,8 @@ public function getErrorByRowNumber($rowNumber) } /** + * Get a set rows via a set of error codes + * * @param array $errorCode * @param array $excludedCodes * @param bool $replaceCodeWithMessage @@ -292,6 +320,8 @@ public function getRowsGroupedByErrorCode( } /** + * Get the max allowed error count + * * @return int */ public function getAllowedErrorsCount() @@ -300,6 +330,8 @@ public function getAllowedErrorsCount() } /** + * Get current error count + * * @param string[] $errorLevels * @return int */ @@ -318,6 +350,8 @@ public function getErrorsCount( } /** + * Clear the error aggregator + * * @return $this */ public function clear() @@ -331,6 +365,8 @@ public function clear() } /** + * Check if an error has already been added to the aggregator + * * @param int $rowNum * @param string $errorCode * @param string $columnName @@ -348,6 +384,8 @@ protected function isErrorAlreadyAdded($rowNum, $errorCode, $columnName = null) } /** + * Build an error message via code, message and column name + * * @param string $errorCode * @param string $errorMessage * @param string $columnName @@ -369,6 +407,8 @@ protected function getErrorMessage($errorCode, $errorMessage, $columnName) } /** + * Process the error statistics for a given error level + * * @param string $errorLevel * @return $this */ From ad1f1bf338b495997d048a354e908aa0f3fcf5bd Mon Sep 17 00:00:00 2001 From: Alexandr Voronoy Date: Sat, 24 Nov 2018 19:59:01 +0200 Subject: [PATCH 019/238] Api-functional test with fixtures and integration --- .../GraphQl/SendFriend/SendFriendTest.php | 469 ++++++++++++++++++ .../Fixtures/process_config_data.php | 22 + .../Fixtures/sendfriend_configuration.php | 24 + .../sendfriend_configuration_rollback.php | 22 + .../SendFriend/_files/product_simple.php | 212 ++++++++ .../_files/product_simple_rollback.php | 26 + 6 files changed, 775 insertions(+) create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php create mode 100644 dev/tests/integration/testsuite/Magento/SendFriend/Fixtures/process_config_data.php create mode 100644 dev/tests/integration/testsuite/Magento/SendFriend/Fixtures/sendfriend_configuration.php create mode 100644 dev/tests/integration/testsuite/Magento/SendFriend/Fixtures/sendfriend_configuration_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/SendFriend/_files/product_simple.php create mode 100644 dev/tests/integration/testsuite/Magento/SendFriend/_files/product_simple_rollback.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php new file mode 100644 index 0000000000000..57e61895e6d17 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php @@ -0,0 +1,469 @@ +dataObjectFactory = Bootstrap::getObjectManager()->get(DataObjectFactory::class); + $this->sendFriendFactory = Bootstrap::getObjectManager()->get(SendFriendFactory::class); + } + + /** + * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php + */ + public function testSendFriend() + { + $query = + <<graphQlQuery($query); + self::assertEquals('Name', $response['sendEmailToFriend']['sender']['name']); + self::assertEquals('e@mail.com', $response['sendEmailToFriend']['sender']['email']); + self::assertEquals('Lorem Ipsum', $response['sendEmailToFriend']['sender']['message']); + self::assertEquals('Recipient Name 1', $response['sendEmailToFriend']['recipients'][0]['name']); + self::assertEquals('recipient1@mail.com', $response['sendEmailToFriend']['recipients'][0]['email']); + self::assertEquals('Recipient Name 2', $response['sendEmailToFriend']['recipients'][1]['name']); + self::assertEquals('recipient2@mail.com', $response['sendEmailToFriend']['recipients'][1]['email']); + } + + public function testSendWithoutExistProduct() + { + $query = + <<expectException(\Exception::class); + $this->expectExceptionMessage('The product that was requested doesn\'t exist. Verify the product and try again.'); + $this->graphQlQuery($query); + } + + /** + * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php + */ + public function testMaxSendEmailToFriend() + { + /** @var SendFriend $sendFriend */ + $sendFriend = $this->sendFriendFactory->create(); + + $query = + <<expectException(\Exception::class); + $this->expectExceptionMessage("No more than {$sendFriend->getMaxRecipients()} emails can be sent at a time."); + $this->graphQlQuery($query); + } + + /** + * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php + */ + public function testSendWithoutRecipentsName() + { + $query = + <<expectException(\Exception::class); + $this->expectExceptionMessage('Please provide Name for all of recipients.'); + $this->graphQlQuery($query); + } + + /** + * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php + */ + public function testSendWithoutRecipentsEmail() + { + $query = + <<expectException(\Exception::class); + $this->expectExceptionMessage('Please provide Email for all of recipients.'); + $this->graphQlQuery($query); + } + + /** + * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php + */ + public function testSendWithoutSenderName() + { + $query = + <<expectException(\Exception::class); + $this->expectExceptionMessage('Please provide Name of sender.'); + $this->graphQlQuery($query); + } + + /** + * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php + */ + public function testSendWithoutSenderEmail() + { + $query = + <<expectException(\Exception::class); + $this->expectExceptionMessage('Please provide Email of sender.'); + $this->graphQlQuery($query); + } + + /** + * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php + */ + public function testSendWithoutSenderMessage() + { + $query = + <<expectException(\Exception::class); + $this->expectExceptionMessage('Please provide Message.'); + $this->graphQlQuery($query); + } + + /** + * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php + * @magentoApiDataFixture Magento/SendFriend/Fixtures/sendfriend_configuration.php + */ + public function testLimitMessagesPerHour() + { + + /** @var SendFriend $sendFriend */ + $sendFriend = $this->sendFriendFactory->create(); + + $query = + <<expectException(\Exception::class); + $this->expectExceptionMessage("You can't send messages more than {$sendFriend->getMaxSendsToFriend()} times an hour."); + + for ($i = 0; $i <= $sendFriend->getMaxSendsToFriend() + 1; $i++) { + $this->graphQlQuery($query); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/SendFriend/Fixtures/process_config_data.php b/dev/tests/integration/testsuite/Magento/SendFriend/Fixtures/process_config_data.php new file mode 100644 index 0000000000000..2c672378fb832 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SendFriend/Fixtures/process_config_data.php @@ -0,0 +1,22 @@ + $value) { + $config->setDataByPath($key, $value); + $config->save(); + } +}; + +$deleteConfigData = function (WriterInterface $writer, array $configData, string $scope, int $scopeId) { + foreach ($configData as $path) { + $writer->delete($path, $scope, $scopeId); + } +}; diff --git a/dev/tests/integration/testsuite/Magento/SendFriend/Fixtures/sendfriend_configuration.php b/dev/tests/integration/testsuite/Magento/SendFriend/Fixtures/sendfriend_configuration.php new file mode 100644 index 0000000000000..229d6eddb496a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SendFriend/Fixtures/sendfriend_configuration.php @@ -0,0 +1,24 @@ + 1, + 'sendfriend/email/check_by' => 1, + +]; +$objectManager = Bootstrap::getObjectManager(); +$defConfig = $objectManager->create(Config::class); +$defConfig->setScope(ScopeConfigInterface::SCOPE_TYPE_DEFAULT); +$processConfigData($defConfig, $configData); diff --git a/dev/tests/integration/testsuite/Magento/SendFriend/Fixtures/sendfriend_configuration_rollback.php b/dev/tests/integration/testsuite/Magento/SendFriend/Fixtures/sendfriend_configuration_rollback.php new file mode 100644 index 0000000000000..9265e032bbc46 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SendFriend/Fixtures/sendfriend_configuration_rollback.php @@ -0,0 +1,22 @@ +get(WriterInterface::class); +$deleteConfigData($configWriter, $configData, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, 0); diff --git a/dev/tests/integration/testsuite/Magento/SendFriend/_files/product_simple.php b/dev/tests/integration/testsuite/Magento/SendFriend/_files/product_simple.php new file mode 100644 index 0000000000000..c275996000814 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SendFriend/_files/product_simple.php @@ -0,0 +1,212 @@ +reinitialize(); + +/** @var \Magento\TestFramework\ObjectManager $objectManager */ +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + +/** @var \Magento\Catalog\Api\CategoryLinkManagementInterface $categoryLinkManagement */ +$categoryLinkManagement = $objectManager->get(\Magento\Catalog\Api\CategoryLinkManagementInterface::class); + +$tierPrices = []; +/** @var \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory */ +$tierPriceFactory = $objectManager->get(\Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory::class); +/** @var $tpExtensionAttributes */ +$tpExtensionAttributesFactory = $objectManager->get(ProductTierPriceExtensionFactory::class); +/** @var $productExtensionAttributes */ +$productExtensionAttributesFactory = $objectManager->get(ProductExtensionInterfaceFactory::class); + +$adminWebsite = $objectManager->get(\Magento\Store\Api\WebsiteRepositoryInterface::class)->get('admin'); +$tierPriceExtensionAttributes1 = $tpExtensionAttributesFactory->create() + ->setWebsiteId($adminWebsite->getId()); +$productExtensionAttributesWebsiteIds = $productExtensionAttributesFactory->create( + ['website_ids' => $adminWebsite->getId()] +); + +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => \Magento\Customer\Model\Group::CUST_GROUP_ALL, + 'qty' => 2, + 'value' => 8 + ] + ] +)->setExtensionAttributes($tierPriceExtensionAttributes1); + +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => \Magento\Customer\Model\Group::CUST_GROUP_ALL, + 'qty' => 5, + 'value' => 5 + ] + ] +)->setExtensionAttributes($tierPriceExtensionAttributes1); + +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 3, + 'value' => 5 + ] + ] +)->setExtensionAttributes($tierPriceExtensionAttributes1); + +$tierPriceExtensionAttributes2 = $tpExtensionAttributesFactory->create() + ->setWebsiteId($adminWebsite->getId()) + ->setPercentageValue(50); + +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 10 + ] + ] +)->setExtensionAttributes($tierPriceExtensionAttributes2); + +/** @var $product \Magento\Catalog\Model\Product */ +$product = $objectManager->create(\Magento\Catalog\Model\Product::class); +$product->isObjectNew(true); +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) + ->setId(1) + ->setAttributeSetId(4) + ->setWebsiteIds([1]) + ->setName('Simple Product') + ->setSku('simple') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription("Short description") + ->setTaxClassId(0) + ->setTierPrices($tierPrices) + ->setDescription('Description with html tag') + ->setExtensionAttributes($productExtensionAttributesWebsiteIds) + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ] + )->setCanSaveCustomOptions(true) + ->setHasOptions(true); + +$oldOptions = [ + [ + 'previous_group' => 'text', + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'sort_order' => 0, + 'price' => 1, + 'price_type' => 'fixed', + 'sku' => '1-text', + 'max_characters' => 100, + ], + [ + 'previous_group' => 'date', + 'title' => 'Test Date and Time', + 'type' => 'date_time', + 'is_require' => 1, + 'sort_order' => 0, + 'price' => 2, + 'price_type' => 'fixed', + 'sku' => '2-date', + ], + [ + 'previous_group' => 'select', + 'title' => 'Test Select', + 'type' => 'drop_down', + 'is_require' => 1, + 'sort_order' => 0, + 'values' => [ + [ + 'option_type_id' => null, + 'title' => 'Option 1', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '3-1-select', + ], + [ + 'option_type_id' => null, + 'title' => 'Option 2', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '3-2-select', + ], + ] + ], + [ + 'previous_group' => 'select', + 'title' => 'Test Radio', + 'type' => 'radio', + 'is_require' => 1, + 'sort_order' => 0, + 'values' => [ + [ + 'option_type_id' => null, + 'title' => 'Option 1', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '4-1-radio', + ], + [ + 'option_type_id' => null, + 'title' => 'Option 2', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '4-2-radio', + ], + ] + ] +]; + +$options = []; + +/** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory $customOptionFactory */ +$customOptionFactory = $objectManager->create(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class); + +foreach ($oldOptions as $option) { + /** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterface $option */ + $option = $customOptionFactory->create(['data' => $option]); + $option->setProductSku($product->getSku()); + + $options[] = $option; +} + +$product->setOptions($options); + +/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); +$productRepository->save($product); + +$categoryLinkManagement->assignProductToCategories( + $product->getSku(), + [2] +); +///** +// * @var $configWriter \Magento\Framework\App\Config\Storage\WriterInterface +// */ +//$configWriter = $objectManager->get(\Magento\Framework\App\Config\Storage\WriterInterface::class); +///** +// * @var $cacheManager \Magento\Framework\App\Cache\Manager +// */ +//$cacheManager = $objectManager->get(\Magento\Framework\App\Cache\Manager::class); +//$configWriter->save('sendfriend/email/max_per_hour', 1); +//$configWriter->save('sendfriend/email/check_by', 1); +//$types = $cacheManager->getAvailableTypes(); +//$cacheManager->clean($types); + diff --git a/dev/tests/integration/testsuite/Magento/SendFriend/_files/product_simple_rollback.php b/dev/tests/integration/testsuite/Magento/SendFriend/_files/product_simple_rollback.php new file mode 100644 index 0000000000000..ed98732fc870e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SendFriend/_files/product_simple_rollback.php @@ -0,0 +1,26 @@ +get(\Magento\Framework\Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + +try { + $product = $productRepository->get('simple', false, null, true); + $productRepository->delete($product); +} catch (\Magento\Framework\Exception\NoSuchEntityException $exception) { + //Product already removed +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); From 1a0e453745daf51ea218ba58c61f519d882de931 Mon Sep 17 00:00:00 2001 From: Stjepan Udovicic Date: Tue, 4 Dec 2018 14:30:00 +0100 Subject: [PATCH 020/238] Fix typo in SQL join --- .../Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php index 168fa8f50acc2..ae6ecd5269d47 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php @@ -604,7 +604,7 @@ protected function _applyCustomOption() [] )->joinLeft( ['otps' => $this->getTable('catalog_product_option_type_price')], - 'otps.option_type_id = otpd.option_type_id AND otpd.store_id = cs.store_id', + 'otps.option_type_id = otpd.option_type_id AND otps.store_id = cs.store_id', [] )->group( ['i.entity_id', 'i.customer_group_id', 'i.website_id', 'o.option_id'] From d5b0ffdd32ccc0d6ed23b41b33617958a659fc75 Mon Sep 17 00:00:00 2001 From: NazarKlovanych Date: Thu, 6 Dec 2018 16:42:01 +0200 Subject: [PATCH 021/238] fix issue-19596 Images in XML sitemap --- app/code/Magento/Sitemap/Model/Observer.php | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sitemap/Model/Observer.php b/app/code/Magento/Sitemap/Model/Observer.php index a536ec998b827..54b36ddaa278b 100644 --- a/app/code/Magento/Sitemap/Model/Observer.php +++ b/app/code/Magento/Sitemap/Model/Observer.php @@ -5,6 +5,8 @@ */ namespace Magento\Sitemap\Model; +use Magento\Store\Model\App\Emulation; +use Magento\Framework\App\ObjectManager; /** * Sitemap module observer * @@ -67,13 +69,21 @@ class Observer protected $inlineTranslation; /** + * @var \Magento\Store\Model\App\Emulation $appEmulation + */ + protected $appEmulation; + + /** + * Observer constructor. + * @param Emulation|null $appEmulation * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param \Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory $collectionFactory + * @param ResourceModel\Sitemap\CollectionFactory $collectionFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( + Emulation $appEmulation = null, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory $collectionFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, @@ -85,6 +95,8 @@ public function __construct( $this->_storeManager = $storeManager; $this->_transportBuilder = $transportBuilder; $this->inlineTranslation = $inlineTranslation; + $this->appEmulation = $appEmulation ?: ObjectManager::getInstance() + ->get(\Magento\Store\Model\App\Emulation::class); } /** @@ -112,10 +124,20 @@ public function scheduledGenerateSitemaps() foreach ($collection as $sitemap) { /* @var $sitemap \Magento\Sitemap\Model\Sitemap */ try { + + $this->appEmulation->startEnvironmentEmulation( + $sitemap->getStoreId(), + \Magento\Framework\App\Area::AREA_FRONTEND, + true + ); + $sitemap->generateXml(); } catch (\Exception $e) { $errors[] = $e->getMessage(); + } finally { + $this->appEmulation->stopEnvironmentEmulation(); } + } if ($errors && $this->_scopeConfig->getValue( From f7fb1865aac9b80d1bc57d6d1e28e78aff8bc7ee Mon Sep 17 00:00:00 2001 From: Emipro Date: Fri, 7 Dec 2018 14:33:48 +0530 Subject: [PATCH 022/238] Fixed Custom option price calculation is wrong with multi currency when option price type is percentage. --- app/code/Magento/Catalog/Block/Product/View/Options.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Product/View/Options.php b/app/code/Magento/Catalog/Block/Product/View/Options.php index 0720c018f6a9b..1f8041d115f89 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options.php @@ -160,7 +160,7 @@ public function hasOptions() */ protected function _getPriceConfiguration($option) { - $optionPrice = $this->pricingHelper->currency($option->getPrice(true), false, false); + $optionPrice = $option->getPrice(true); $data = [ 'prices' => [ 'oldPrice' => [ @@ -195,7 +195,7 @@ protected function _getPriceConfiguration($option) ], ], 'type' => $option->getPriceType(), - 'name' => $option->getTitle() + 'name' => $option->getTitle(), ]; return $data; } @@ -231,7 +231,7 @@ public function getJsonConfig() //pass the return array encapsulated in an object for the other modules to be able to alter it eg: weee $this->_eventManager->dispatch('catalog_product_option_price_configuration_after', ['configObj' => $configObj]); - $config=$configObj->getConfig(); + $config = $configObj->getConfig(); return $this->_jsonEncoder->encode($config); } From 4d84a7a5af05d347e1b726d5c4dca4d4cc7c97c6 Mon Sep 17 00:00:00 2001 From: Emipro Date: Fri, 7 Dec 2018 15:50:55 +0530 Subject: [PATCH 023/238] solved fixed price calculation --- app/code/Magento/Catalog/Block/Product/View/Options.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Block/Product/View/Options.php b/app/code/Magento/Catalog/Block/Product/View/Options.php index 1f8041d115f89..ece517d033f87 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options.php @@ -20,6 +20,11 @@ */ class Options extends \Magento\Framework\View\Element\Template { + /** + * Option type percent + */ + protected static $typePercent = 'percent'; + /** * @var Product */ @@ -160,7 +165,8 @@ public function hasOptions() */ protected function _getPriceConfiguration($option) { - $optionPrice = $option->getPrice(true); + $option->getPriceType() == self::$typePercent ? $optionPrice = $option->getPrice(true) : + $optionPrice = $this->pricingHelper->currency($option->getPrice(true), false, false); $data = [ 'prices' => [ 'oldPrice' => [ From 16f11f760b89bb240ce2f6948214da5775695d92 Mon Sep 17 00:00:00 2001 From: NazarKlovanych Date: Fri, 7 Dec 2018 14:11:16 +0200 Subject: [PATCH 024/238] Fix failed static tests --- app/code/Magento/Sitemap/Model/Observer.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Sitemap/Model/Observer.php b/app/code/Magento/Sitemap/Model/Observer.php index 54b36ddaa278b..62d7a5ab124e5 100644 --- a/app/code/Magento/Sitemap/Model/Observer.php +++ b/app/code/Magento/Sitemap/Model/Observer.php @@ -6,7 +6,7 @@ namespace Magento\Sitemap\Model; use Magento\Store\Model\App\Emulation; -use Magento\Framework\App\ObjectManager; + /** * Sitemap module observer * @@ -71,32 +71,31 @@ class Observer /** * @var \Magento\Store\Model\App\Emulation $appEmulation */ - protected $appEmulation; + private $appEmulation; /** * Observer constructor. - * @param Emulation|null $appEmulation * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param ResourceModel\Sitemap\CollectionFactory $collectionFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation + * @param Emulation|null $appEmulation */ public function __construct( - Emulation $appEmulation = null, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory $collectionFactory, + ResourceModel\Sitemap\CollectionFactory $collectionFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation + \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, + Emulation $appEmulation ) { $this->_scopeConfig = $scopeConfig; $this->_collectionFactory = $collectionFactory; $this->_storeManager = $storeManager; $this->_transportBuilder = $transportBuilder; $this->inlineTranslation = $inlineTranslation; - $this->appEmulation = $appEmulation ?: ObjectManager::getInstance() - ->get(\Magento\Store\Model\App\Emulation::class); + $this->appEmulation = $appEmulation; } /** @@ -124,10 +123,9 @@ public function scheduledGenerateSitemaps() foreach ($collection as $sitemap) { /* @var $sitemap \Magento\Sitemap\Model\Sitemap */ try { - $this->appEmulation->startEnvironmentEmulation( $sitemap->getStoreId(), - \Magento\Framework\App\Area::AREA_FRONTEND, + 'frontend', true ); @@ -137,7 +135,6 @@ public function scheduledGenerateSitemaps() } finally { $this->appEmulation->stopEnvironmentEmulation(); } - } if ($errors && $this->_scopeConfig->getValue( From c8afe9f71d99367bcdd24e4900e60bbba2fbc0dd Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko Date: Fri, 7 Dec 2018 15:45:16 +0200 Subject: [PATCH 025/238] Update app/code/Magento/Sitemap/Model/Observer.php Co-Authored-By: Nazar65 --- app/code/Magento/Sitemap/Model/Observer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sitemap/Model/Observer.php b/app/code/Magento/Sitemap/Model/Observer.php index 62d7a5ab124e5..7211db4f171f6 100644 --- a/app/code/Magento/Sitemap/Model/Observer.php +++ b/app/code/Magento/Sitemap/Model/Observer.php @@ -69,7 +69,7 @@ class Observer protected $inlineTranslation; /** - * @var \Magento\Store\Model\App\Emulation $appEmulation + * @var Emulation */ private $appEmulation; From d0c0bccdfec92a7657c3d94e86f7fa13b70b4df2 Mon Sep 17 00:00:00 2001 From: suryakant Date: Sat, 8 Dec 2018 11:46:23 +0530 Subject: [PATCH 026/238] fixed-checkbox-alignment: Checkbox alignement issue. --- .../Magento/backend/web/css/source/forms/_fields.less | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/_fields.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/_fields.less index 3503abcc30468..5e14266877c35 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/_fields.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/_fields.less @@ -121,6 +121,9 @@ > .admin__field-control { #mix-grid .column(@field-control-grid__column, @field-grid__columns); + input[type="checkbox"] { + margin-top: 11px; + } } > .admin__field-label { From fda07a290af211356db74eb0cb890dc4bf42a388 Mon Sep 17 00:00:00 2001 From: NazarKlovanych Date: Tue, 11 Dec 2018 13:54:44 +0200 Subject: [PATCH 027/238] Refactoring Sitemap Observer --- app/code/Magento/Sitemap/Model/Observer.php | 98 ++++------------ .../Sitemap/Model/SitemapSendEmail.php | 109 ++++++++++++++++++ 2 files changed, 132 insertions(+), 75 deletions(-) create mode 100644 app/code/Magento/Sitemap/Model/SitemapSendEmail.php diff --git a/app/code/Magento/Sitemap/Model/Observer.php b/app/code/Magento/Sitemap/Model/Observer.php index 62d7a5ab124e5..c12db1498d699 100644 --- a/app/code/Magento/Sitemap/Model/Observer.php +++ b/app/code/Magento/Sitemap/Model/Observer.php @@ -6,6 +6,11 @@ namespace Magento\Sitemap\Model; use Magento\Store\Model\App\Emulation; +use Magento\Sitemap\Model\SitemapSendEmail as SitemapEmail; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; +use ResourceModel\Sitemap\CollectionFactory; +use Magento\Store\Model\ScopeInterface; /** * Sitemap module observer @@ -26,21 +31,6 @@ class Observer */ const XML_PATH_CRON_EXPR = 'crontab/default/jobs/generate_sitemaps/schedule/cron_expr'; - /** - * Error email template configuration - */ - const XML_PATH_ERROR_TEMPLATE = 'sitemap/generate/error_email_template'; - - /** - * Error email identity configuration - */ - const XML_PATH_ERROR_IDENTITY = 'sitemap/generate/error_email_identity'; - - /** - * 'Send error emails to' configuration - */ - const XML_PATH_ERROR_RECIPIENT = 'sitemap/generate/error_email'; - /** * Core store config * @@ -53,49 +43,41 @@ class Observer */ protected $_collectionFactory; - /** - * @var \Magento\Framework\Mail\Template\TransportBuilder - */ - protected $_transportBuilder; - /** * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @var \Magento\Framework\Translate\Inline\StateInterface + * @var Emulation */ - protected $inlineTranslation; + private $appEmulation; /** - * @var \Magento\Store\Model\App\Emulation $appEmulation + * @var $sitemapEmail */ - private $appEmulation; + private $sitemapEmail; /** * Observer constructor. - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param ResourceModel\Sitemap\CollectionFactory $collectionFactory - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation - * @param Emulation|null $appEmulation + * @param ScopeConfigInterface $scopeConfig + * @param CollectionFactory $collectionFactory + * @param StoreManagerInterface $storeManager + * @param SitemapSendEmail $sitemapEmail + * @param Emulation $appEmulation */ public function __construct( - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - ResourceModel\Sitemap\CollectionFactory $collectionFactory, - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, + ScopeConfigInterface $scopeConfig, + CollectionFactory $collectionFactory, + StoreManagerInterface $storeManager, + SitemapEmail $sitemapEmail, Emulation $appEmulation ) { $this->_scopeConfig = $scopeConfig; $this->_collectionFactory = $collectionFactory; $this->_storeManager = $storeManager; - $this->_transportBuilder = $transportBuilder; - $this->inlineTranslation = $inlineTranslation; $this->appEmulation = $appEmulation; + $this->sitemapEmail = $sitemapEmail; } /** @@ -112,7 +94,7 @@ public function scheduledGenerateSitemaps() // check if scheduled generation enabled if (!$this->_scopeConfig->isSetFlag( self::XML_PATH_GENERATION_ENABLED, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ) ) { return; @@ -125,52 +107,18 @@ public function scheduledGenerateSitemaps() try { $this->appEmulation->startEnvironmentEmulation( $sitemap->getStoreId(), - 'frontend', + \Magento\Framework\App\Area::AREA_FRONTEND, true ); $sitemap->generateXml(); } catch (\Exception $e) { $errors[] = $e->getMessage(); + + $this->sitemapEmail->sendErrorEmail($errors); } finally { $this->appEmulation->stopEnvironmentEmulation(); } } - - if ($errors && $this->_scopeConfig->getValue( - self::XML_PATH_ERROR_RECIPIENT, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - ) { - $this->inlineTranslation->suspend(); - - $this->_transportBuilder->setTemplateIdentifier( - $this->_scopeConfig->getValue( - self::XML_PATH_ERROR_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - )->setTemplateOptions( - [ - 'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, - ] - )->setTemplateVars( - ['warnings' => join("\n", $errors)] - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_ERROR_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - )->addTo( - $this->_scopeConfig->getValue( - self::XML_PATH_ERROR_RECIPIENT, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - ); - $transport = $this->_transportBuilder->getTransport(); - $transport->sendMessage(); - - $this->inlineTranslation->resume(); - } } } diff --git a/app/code/Magento/Sitemap/Model/SitemapSendEmail.php b/app/code/Magento/Sitemap/Model/SitemapSendEmail.php new file mode 100644 index 0000000000000..cf450eba6e1e4 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/SitemapSendEmail.php @@ -0,0 +1,109 @@ +inlineTranslation = $inlineTranslation; + $this->_scopeConfig = $scopeConfig; + $this->_transportBuilder = $transportBuilder; + } + + /** + * Send's error email if sitemap generated with errors. + * + * @param array $errors + * @throws \Magento\Framework\Exception\MailException + */ + public function sendErrorEmail($errors) + { + $recipient = $this->_scopeConfig->getValue( + self::XML_PATH_ERROR_RECIPIENT, + ScopeInterface::SCOPE_STORE + ); + if ($errors && $recipient) { + $this->inlineTranslation->suspend(); + + $this->_transportBuilder->setTemplateIdentifier( + $this->_scopeConfig->getValue( + self::XML_PATH_ERROR_TEMPLATE, + ScopeInterface::SCOPE_STORE + ) + )->setTemplateOptions( + [ + 'area' => FrontNameResolver::AREA_CODE, + 'store' => Store::DEFAULT_STORE_ID, + ] + )->setTemplateVars( + ['warnings' => join("\n", $errors)] + )->setFrom( + $this->_scopeConfig->getValue( + self::XML_PATH_ERROR_IDENTITY, + ScopeInterface::SCOPE_STORE + ) + )->addTo($recipient); + + $transport = $this->_transportBuilder->getTransport(); + $transport->sendMessage(); + + $this->inlineTranslation->resume(); + } + } +} From d2d04b6ee9df35b9906f16459bdee1bba0db658d Mon Sep 17 00:00:00 2001 From: NazarKlovanych Date: Tue, 11 Dec 2018 13:58:05 +0200 Subject: [PATCH 028/238] Refactoring Sitemap Observer --- app/code/Magento/Sitemap/Model/Observer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sitemap/Model/Observer.php b/app/code/Magento/Sitemap/Model/Observer.php index c12db1498d699..10bb95b8029cf 100644 --- a/app/code/Magento/Sitemap/Model/Observer.php +++ b/app/code/Magento/Sitemap/Model/Observer.php @@ -9,7 +9,7 @@ use Magento\Sitemap\Model\SitemapSendEmail as SitemapEmail; use Magento\Store\Model\StoreManagerInterface; use Magento\Framework\App\Config\ScopeConfigInterface; -use ResourceModel\Sitemap\CollectionFactory; +use Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory; use Magento\Store\Model\ScopeInterface; /** From b88fa48da750a1f7be759b37d9007bf2ecdc5270 Mon Sep 17 00:00:00 2001 From: NazarKlovanych Date: Wed, 12 Dec 2018 14:41:44 +0200 Subject: [PATCH 029/238] Refactoring --- ...mapSendEmail.php => EmailNotification.php} | 80 +++++++++---------- app/code/Magento/Sitemap/Model/Observer.php | 53 ++++++++---- 2 files changed, 74 insertions(+), 59 deletions(-) rename app/code/Magento/Sitemap/Model/{SitemapSendEmail.php => EmailNotification.php} (53%) diff --git a/app/code/Magento/Sitemap/Model/SitemapSendEmail.php b/app/code/Magento/Sitemap/Model/EmailNotification.php similarity index 53% rename from app/code/Magento/Sitemap/Model/SitemapSendEmail.php rename to app/code/Magento/Sitemap/Model/EmailNotification.php index cf450eba6e1e4..515121de6e6e1 100644 --- a/app/code/Magento/Sitemap/Model/SitemapSendEmail.php +++ b/app/code/Magento/Sitemap/Model/EmailNotification.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types = 1); namespace Magento\Sitemap\Model; @@ -11,28 +12,14 @@ use Magento\Framework\Mail\Template\TransportBuilder; use Magento\Store\Model\ScopeInterface; use Magento\Backend\App\Area\FrontNameResolver; -use Magento\Store\Model\Store; +use Magento\Sitemap\Model\Observer as Observer; +use Psr\Log\LoggerInterface; /** * Sends emails for the scheduled generation of the sitemap file */ -class SitemapSendEmail +class EmailNotification { - /** - * Error email template configuration - */ - const XML_PATH_ERROR_TEMPLATE = 'sitemap/generate/error_email_template'; - - /** - * Error email identity configuration - */ - const XML_PATH_ERROR_IDENTITY = 'sitemap/generate/error_email_identity'; - - /** - * 'Send error emails to' configuration - */ - const XML_PATH_ERROR_RECIPIENT = 'sitemap/generate/error_email'; - /** * @var \Magento\Framework\Translate\Inline\StateInterface */ @@ -43,66 +30,75 @@ class SitemapSendEmail * * @var \Magento\Framework\App\Config\ScopeConfigInterface */ - private $_scopeConfig; + private $scopeConfig; /** * @var \Magento\Framework\Mail\Template\TransportBuilder */ - private $_transportBuilder; + private $transportBuilder; + + /** + * @var $logger + */ + private $logger; /** - * SitemapSendEmail constructor. + * EmailNotification constructor. * @param StateInterface $inlineTranslation * @param TransportBuilder $transportBuilder * @param ScopeConfigInterface $scopeConfig + * @param LoggerInterface $logger */ public function __construct( StateInterface $inlineTranslation, TransportBuilder $transportBuilder, - ScopeConfigInterface $scopeConfig + ScopeConfigInterface $scopeConfig, + LoggerInterface $logger ) { $this->inlineTranslation = $inlineTranslation; - $this->_scopeConfig = $scopeConfig; - $this->_transportBuilder = $transportBuilder; + $this->scopeConfig = $scopeConfig; + $this->transportBuilder = $transportBuilder; + $this->logger = $logger; } /** * Send's error email if sitemap generated with errors. * - * @param array $errors - * @throws \Magento\Framework\Exception\MailException + * @param array| $errors */ - public function sendErrorEmail($errors) + public function sendErrors($errors) { - $recipient = $this->_scopeConfig->getValue( - self::XML_PATH_ERROR_RECIPIENT, - ScopeInterface::SCOPE_STORE - ); - if ($errors && $recipient) { - $this->inlineTranslation->suspend(); - - $this->_transportBuilder->setTemplateIdentifier( - $this->_scopeConfig->getValue( - self::XML_PATH_ERROR_TEMPLATE, + $this->inlineTranslation->suspend(); + try { + $this->transportBuilder->setTemplateIdentifier( + $this->scopeConfig->getValue( + Observer::XML_PATH_ERROR_TEMPLATE, ScopeInterface::SCOPE_STORE ) )->setTemplateOptions( [ 'area' => FrontNameResolver::AREA_CODE, - 'store' => Store::DEFAULT_STORE_ID, + 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, ] )->setTemplateVars( ['warnings' => join("\n", $errors)] )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_ERROR_IDENTITY, + $this->scopeConfig->getValue( + Observer::XML_PATH_ERROR_IDENTITY, + ScopeInterface::SCOPE_STORE + ) + )->addTo( + $this->scopeConfig->getValue( + Observer::XML_PATH_ERROR_RECIPIENT, ScopeInterface::SCOPE_STORE ) - )->addTo($recipient); + ); - $transport = $this->_transportBuilder->getTransport(); + $transport = $this->transportBuilder->getTransport(); $transport->sendMessage(); - + } catch (\Exception $e) { + $this->logger->error('Sitemap sendErrors: '.$e->getMessage()); + } finally { $this->inlineTranslation->resume(); } } diff --git a/app/code/Magento/Sitemap/Model/Observer.php b/app/code/Magento/Sitemap/Model/Observer.php index 10bb95b8029cf..887b5a6541a56 100644 --- a/app/code/Magento/Sitemap/Model/Observer.php +++ b/app/code/Magento/Sitemap/Model/Observer.php @@ -6,7 +6,7 @@ namespace Magento\Sitemap\Model; use Magento\Store\Model\App\Emulation; -use Magento\Sitemap\Model\SitemapSendEmail as SitemapEmail; +use Magento\Sitemap\Model\EmailNotification as SitemapEmail; use Magento\Store\Model\StoreManagerInterface; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory; @@ -31,22 +31,37 @@ class Observer */ const XML_PATH_CRON_EXPR = 'crontab/default/jobs/generate_sitemaps/schedule/cron_expr'; + /** + * Error email template configuration + */ + const XML_PATH_ERROR_TEMPLATE = 'sitemap/generate/error_email_template'; + + /** + * Error email identity configuration + */ + const XML_PATH_ERROR_IDENTITY = 'sitemap/generate/error_email_identity'; + + /** + * 'Send error emails to' configuration + */ + const XML_PATH_ERROR_RECIPIENT = 'sitemap/generate/error_email'; + /** * Core store config * * @var \Magento\Framework\App\Config\ScopeConfigInterface */ - protected $_scopeConfig; + private $scopeConfig; /** * @var \Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory */ - protected $_collectionFactory; + private $collectionFactory; /** * @var \Magento\Store\Model\StoreManagerInterface */ - protected $_storeManager; + private $storeManager; /** * @var Emulation @@ -54,30 +69,30 @@ class Observer private $appEmulation; /** - * @var $sitemapEmail + * @var $emailNotification */ - private $sitemapEmail; + private $emailNotification; /** * Observer constructor. * @param ScopeConfigInterface $scopeConfig * @param CollectionFactory $collectionFactory * @param StoreManagerInterface $storeManager - * @param SitemapSendEmail $sitemapEmail + * @param EmailNotification $emailNotification * @param Emulation $appEmulation */ public function __construct( ScopeConfigInterface $scopeConfig, CollectionFactory $collectionFactory, StoreManagerInterface $storeManager, - SitemapEmail $sitemapEmail, + SitemapEmail $emailNotification, Emulation $appEmulation ) { - $this->_scopeConfig = $scopeConfig; - $this->_collectionFactory = $collectionFactory; - $this->_storeManager = $storeManager; + $this->scopeConfig = $scopeConfig; + $this->collectionFactory = $collectionFactory; + $this->storeManager = $storeManager; $this->appEmulation = $appEmulation; - $this->sitemapEmail = $sitemapEmail; + $this->emailNotification = $emailNotification; } /** @@ -90,9 +105,12 @@ public function __construct( public function scheduledGenerateSitemaps() { $errors = []; - + $recipient = $this->scopeConfig->getValue( + Observer::XML_PATH_ERROR_RECIPIENT, + ScopeInterface::SCOPE_STORE + ); // check if scheduled generation enabled - if (!$this->_scopeConfig->isSetFlag( + if (!$this->scopeConfig->isSetFlag( self::XML_PATH_GENERATION_ENABLED, ScopeInterface::SCOPE_STORE ) @@ -100,7 +118,7 @@ public function scheduledGenerateSitemaps() return; } - $collection = $this->_collectionFactory->create(); + $collection = $this->collectionFactory->create(); /* @var $collection \Magento\Sitemap\Model\ResourceModel\Sitemap\Collection */ foreach ($collection as $sitemap) { /* @var $sitemap \Magento\Sitemap\Model\Sitemap */ @@ -114,11 +132,12 @@ public function scheduledGenerateSitemaps() $sitemap->generateXml(); } catch (\Exception $e) { $errors[] = $e->getMessage(); - - $this->sitemapEmail->sendErrorEmail($errors); } finally { $this->appEmulation->stopEnvironmentEmulation(); } } + if ($errors && $recipient) { + $this->emailNotification->sendErrors($errors); + } } } From 85a2a561bf5f5fe585c27ef40564692860f31be3 Mon Sep 17 00:00:00 2001 From: NazarKlovanych Date: Wed, 12 Dec 2018 14:47:02 +0200 Subject: [PATCH 030/238] Refactoring --- app/code/Magento/Sitemap/Model/EmailNotification.php | 2 +- app/code/Magento/Sitemap/Model/Observer.php | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/app/code/Magento/Sitemap/Model/EmailNotification.php b/app/code/Magento/Sitemap/Model/EmailNotification.php index 515121de6e6e1..27c042870a1d6 100644 --- a/app/code/Magento/Sitemap/Model/EmailNotification.php +++ b/app/code/Magento/Sitemap/Model/EmailNotification.php @@ -38,7 +38,7 @@ class EmailNotification private $transportBuilder; /** - * @var $logger + * @var \Psr\Log\LoggerInterface $logger */ private $logger; diff --git a/app/code/Magento/Sitemap/Model/Observer.php b/app/code/Magento/Sitemap/Model/Observer.php index 887b5a6541a56..bd7a84f601b77 100644 --- a/app/code/Magento/Sitemap/Model/Observer.php +++ b/app/code/Magento/Sitemap/Model/Observer.php @@ -7,7 +7,6 @@ use Magento\Store\Model\App\Emulation; use Magento\Sitemap\Model\EmailNotification as SitemapEmail; -use Magento\Store\Model\StoreManagerInterface; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory; use Magento\Store\Model\ScopeInterface; @@ -58,11 +57,6 @@ class Observer */ private $collectionFactory; - /** - * @var \Magento\Store\Model\StoreManagerInterface - */ - private $storeManager; - /** * @var Emulation */ @@ -77,20 +71,17 @@ class Observer * Observer constructor. * @param ScopeConfigInterface $scopeConfig * @param CollectionFactory $collectionFactory - * @param StoreManagerInterface $storeManager * @param EmailNotification $emailNotification * @param Emulation $appEmulation */ public function __construct( ScopeConfigInterface $scopeConfig, CollectionFactory $collectionFactory, - StoreManagerInterface $storeManager, SitemapEmail $emailNotification, Emulation $appEmulation ) { $this->scopeConfig = $scopeConfig; $this->collectionFactory = $collectionFactory; - $this->storeManager = $storeManager; $this->appEmulation = $appEmulation; $this->emailNotification = $emailNotification; } From cc370e549d8b8e34ec5af553e0f8e671087ba1de Mon Sep 17 00:00:00 2001 From: Stjepan Udovicic Date: Sat, 15 Dec 2018 23:36:26 +0100 Subject: [PATCH 031/238] Fix typo in SQL for CustomOptionPriceModifier --- .../Product/Indexer/Price/CustomOptionPriceModifier.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php index 47fc6802d7eaf..fccb17ea8cb35 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php @@ -211,7 +211,7 @@ private function getSelectForOptionsWithMultipleValues(string $sourceTable): Sel } else { $select->joinLeft( ['otps' => $this->getTable('catalog_product_option_type_price')], - 'otps.option_type_id = otpd.option_type_id AND otpd.store_id = cwd.default_store_id', + 'otps.option_type_id = otpd.option_type_id AND otps.store_id = cwd.default_store_id', [] ); From a04cbf2acd3a149d9349ec2ea738010190dc7e10 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky Date: Fri, 21 Dec 2018 13:10:17 +0200 Subject: [PATCH 032/238] ENGCOM-3683: Unit test fix. --- .../Test/Unit/Model/EmailNotificationTest.php | 134 ++++++++++++++++++ .../Sitemap/Test/Unit/Model/ObserverTest.php | 108 ++++++-------- 2 files changed, 176 insertions(+), 66 deletions(-) create mode 100644 app/code/Magento/Sitemap/Test/Unit/Model/EmailNotificationTest.php diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/EmailNotificationTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/EmailNotificationTest.php new file mode 100644 index 0000000000000..eafb47c086bac --- /dev/null +++ b/app/code/Magento/Sitemap/Test/Unit/Model/EmailNotificationTest.php @@ -0,0 +1,134 @@ +objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class) + ->getMock(); + $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class) + ->getMock(); + $this->transportBuilderMock = $this->getMockBuilder(TransportBuilder::class) + ->disableOriginalConstructor() + ->getMock(); + $this->inlineTranslationMock = $this->getMockBuilder(StateInterface::class) + ->getMock(); + + $this->objectManager = new ObjectManager($this); + $this->model = $this->objectManager->getObject( + EmailNotification::class, + [ + 'inlineTranslation' => $this->inlineTranslationMock, + 'scopeConfig' => $this->scopeConfigMock, + 'transportBuilder' => $this->transportBuilderMock, + ] + ); + } + + public function testSendErrors() + { + $exception = 'Sitemap Exception'; + $transport = $this->createMock(TransportInterface::class); + + $this->scopeConfigMock->expects($this->at(0)) + ->method('getValue') + ->with( + Observer::XML_PATH_ERROR_TEMPLATE, + ScopeInterface::SCOPE_STORE + ) + ->willReturn('error-recipient@example.com'); + + $this->inlineTranslationMock->expects($this->once()) + ->method('suspend'); + + $this->transportBuilderMock->expects($this->once()) + ->method('setTemplateIdentifier') + ->will($this->returnSelf()); + + $this->transportBuilderMock->expects($this->once()) + ->method('setTemplateOptions') + ->with([ + 'area' => FrontNameResolver::AREA_CODE, + 'store' => Store::DEFAULT_STORE_ID, + ]) + ->will($this->returnSelf()); + + $this->transportBuilderMock->expects($this->once()) + ->method('setTemplateVars') + ->with(['warnings' => $exception]) + ->will($this->returnSelf()); + + $this->transportBuilderMock->expects($this->once()) + ->method('setFrom') + ->will($this->returnSelf()); + + $this->transportBuilderMock->expects($this->once()) + ->method('addTo') + ->will($this->returnSelf()); + + $this->transportBuilderMock->expects($this->once()) + ->method('getTransport') + ->willReturn($transport); + + $transport->expects($this->once()) + ->method('sendMessage'); + + $this->inlineTranslationMock->expects($this->once()) + ->method('resume'); + + $this->model->sendErrors(['Sitemap Exception']); + } +} diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/ObserverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ObserverTest.php index ac88f23ff9d69..5fae54ff3c5d0 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ObserverTest.php @@ -5,10 +5,14 @@ */ namespace Magento\Sitemap\Test\Unit\Model; +use Magento\Framework\App\Area; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Sitemap\Model\EmailNotification; +use Magento\Store\Model\App\Emulation; /** * Class ObserverTest + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ObserverTest extends \PHPUnit\Framework\TestCase @@ -33,21 +37,6 @@ class ObserverTest extends \PHPUnit\Framework\TestCase */ private $collectionFactoryMock; - /** - * @var \Magento\Framework\Mail\Template\TransportBuilder|\PHPUnit_Framework_MockObject_MockObject - */ - private $transportBuilderMock; - - /** - * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - private $storeManagerMock; - - /** - * @var \Magento\Framework\Translate\Inline\StateInterface|\PHPUnit_Framework_MockObject_MockObject - */ - private $inlineTranslationMock; - /** * @var \Magento\Sitemap\Model\ResourceModel\Sitemap\Collection|\PHPUnit_Framework_MockObject_MockObject */ @@ -63,6 +52,16 @@ class ObserverTest extends \PHPUnit\Framework\TestCase */ private $objectManagerMock; + /** + * @var Emulation|\PHPUnit_Framework_MockObject_MockObject + */ + private $appEmulationMock; + + /** + * @var EmailNotification|\PHPUnit_Framework_MockObject_MockObject + */ + private $emailNotificationMock; + protected function setUp() { $this->objectManagerMock = $this->getMockBuilder(\Magento\Framework\ObjectManagerInterface::class) @@ -74,28 +73,28 @@ protected function setUp() )->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $this->transportBuilderMock = $this->getMockBuilder(\Magento\Framework\Mail\Template\TransportBuilder::class) - ->disableOriginalConstructor() - ->getMock(); - $this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class) - ->getMock(); - $this->inlineTranslationMock = $this->getMockBuilder(\Magento\Framework\Translate\Inline\StateInterface::class) - ->getMock(); $this->sitemapCollectionMock = $this->createPartialMock( \Magento\Sitemap\Model\ResourceModel\Sitemap\Collection::class, ['getIterator'] ); - $this->sitemapMock = $this->createPartialMock(\Magento\Sitemap\Model\Sitemap::class, ['generateXml']); - + $this->sitemapMock = $this->createPartialMock( + \Magento\Sitemap\Model\Sitemap::class, + [ + 'generateXml', + 'getStoreId', + ] + ); + $this->appEmulationMock = $this->createMock(Emulation::class); + $this->emailNotificationMock = $this->createMock(EmailNotification::class); $this->objectManager = new ObjectManager($this); + $this->observer = $this->objectManager->getObject( \Magento\Sitemap\Model\Observer::class, [ 'scopeConfig' => $this->scopeConfigMock, 'collectionFactory' => $this->collectionFactoryMock, - 'storeManager' => $this->storeManagerMock, - 'transportBuilder' => $this->transportBuilderMock, - 'inlineTranslation' => $this->inlineTranslationMock + 'appEmulation' => $this->appEmulationMock, + 'emailNotification' => $this->emailNotificationMock ] ); } @@ -103,7 +102,7 @@ protected function setUp() public function testScheduledGenerateSitemapsSendsExceptionEmail() { $exception = 'Sitemap Exception'; - $transport = $this->createMock(\Magento\Framework\Mail\TransportInterface::class); + $storeId = 1; $this->scopeConfigMock->expects($this->once())->method('isSetFlag')->willReturn(true); @@ -115,11 +114,15 @@ public function testScheduledGenerateSitemapsSendsExceptionEmail() ->method('getIterator') ->willReturn(new \ArrayIterator([$this->sitemapMock])); - $this->sitemapMock->expects($this->once()) + $this->sitemapMock->expects($this->at(0)) + ->method('getStoreId') + ->willReturn($storeId); + + $this->sitemapMock->expects($this->at(1)) ->method('generateXml') ->willThrowException(new \Exception($exception)); - $this->scopeConfigMock->expects($this->at(1)) + $this->scopeConfigMock->expects($this->at(0)) ->method('getValue') ->with( \Magento\Sitemap\Model\Observer::XML_PATH_ERROR_RECIPIENT, @@ -127,43 +130,16 @@ public function testScheduledGenerateSitemapsSendsExceptionEmail() ) ->willReturn('error-recipient@example.com'); - $this->inlineTranslationMock->expects($this->once()) - ->method('suspend'); - - $this->transportBuilderMock->expects($this->once()) - ->method('setTemplateIdentifier') - ->will($this->returnSelf()); - - $this->transportBuilderMock->expects($this->once()) - ->method('setTemplateOptions') - ->with([ - 'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, - ]) - ->will($this->returnSelf()); - - $this->transportBuilderMock->expects($this->once()) - ->method('setTemplateVars') - ->with(['warnings' => $exception]) - ->will($this->returnSelf()); - - $this->transportBuilderMock->expects($this->once()) - ->method('setFrom') - ->will($this->returnSelf()); - - $this->transportBuilderMock->expects($this->once()) - ->method('addTo') - ->will($this->returnSelf()); - - $this->transportBuilderMock->expects($this->once()) - ->method('getTransport') - ->willReturn($transport); - - $transport->expects($this->once()) - ->method('sendMessage'); + $this->appEmulationMock->expects($this->at(0)) + ->method('startEnvironmentEmulation') + ->with( + $storeId, + Area::AREA_FRONTEND, + true + ); - $this->inlineTranslationMock->expects($this->once()) - ->method('resume'); + $this->appEmulationMock->expects($this->at(1)) + ->method('stopEnvironmentEmulation'); $this->observer->scheduledGenerateSitemaps(); } From 76040cca09f858b264ad67b7dc4d9a498df1ac08 Mon Sep 17 00:00:00 2001 From: Shikha Mishra Date: Thu, 27 Dec 2018 22:12:21 +0530 Subject: [PATCH 033/238] Updated Download.php --- app/code/Magento/Downloadable/Helper/Download.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index 150a5ec474f36..c2c091cd37003 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -198,6 +198,9 @@ public function getContentType() return $this->_downloadableFile->getFileType($this->_resourceFile); } } elseif ($this->_linkType == self::LINK_TYPE_URL) { + if(is_array($this->_handle->stat($this->_resourceFile)['type'])){ + return end($this->_handle->stat($this->_resourceFile)['type']); + }else return $this->_handle->stat($this->_resourceFile)['type']; } return $this->_contentType; From d5b7745bbddeb94dc1e7017f1b7249c2b139bb2d Mon Sep 17 00:00:00 2001 From: Shikha Mishra Date: Thu, 27 Dec 2018 22:17:42 +0530 Subject: [PATCH 034/238] Updated Http.php --- lib/internal/Magento/Framework/Filesystem/Driver/Http.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/Http.php b/lib/internal/Magento/Framework/Filesystem/Driver/Http.php index 3668bd17477a4..c59ee5efad5d6 100644 --- a/lib/internal/Magento/Framework/Filesystem/Driver/Http.php +++ b/lib/internal/Magento/Framework/Filesystem/Driver/Http.php @@ -39,6 +39,11 @@ public function isExists($path) if (strpos($status, '302 Found') !== false && isset($headers[1])) { $status = $headers[1]; } + + /* Handling 301 redirection */ + if (strpos($status, '301 Moved Permanently') !== false && isset($headers[1])) { + $status = $headers[1]; + } if (strpos($status, '200 OK') === false) { $result = false; From 5ee1d4281c1b6c3456aeec5a069ac0338c8b3898 Mon Sep 17 00:00:00 2001 From: milindsingh Date: Sat, 29 Dec 2018 00:08:12 +0530 Subject: [PATCH 035/238] Issue fix #20010 Wrong price amount in opengraph Issue fix #20010 Wrong price amount in opengraph --- .../frontend/templates/product/view/opengraph/general.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml index a2b91a5eeb99f..40f86c7e68d6c 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml @@ -14,7 +14,7 @@ -getProduct()->getFinalPrice()):?> +getProduct()->getPriceInfo()->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)->getAmount()):?> getChildHtml('meta.currency') ?> From 4bc5c6f99b0eebc868e42e04afad3a922f67de27 Mon Sep 17 00:00:00 2001 From: Meher jeet <42374679+mjsachan-cedcoss@users.noreply.github.com> Date: Sat, 29 Dec 2018 12:18:01 +0530 Subject: [PATCH 036/238] Update AbstractResource.php --- .../Magento/Catalog/Model/ResourceModel/AbstractResource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php index b9e629912a5b3..f7879d7f93281 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php @@ -485,7 +485,7 @@ protected function _canUpdateAttribute(AbstractAttribute $attribute, $value, arr * Retrieve attribute's raw value from DB. * * @param int $entityId - * @param int|string|array $attribute atrribute's ids or codes + * @param int|string|array $attribute attribute's ids or codes * @param int|\Magento\Store\Model\Store $store * @return bool|string|array * @SuppressWarnings(PHPMD.CyclomaticComplexity) From b863602f3479613dc75e990c18ef8e5bf34ad553 Mon Sep 17 00:00:00 2001 From: Meher jeet <42374679+mjsachan-cedcoss@users.noreply.github.com> Date: Sat, 29 Dec 2018 12:19:35 +0530 Subject: [PATCH 037/238] Update AdminCategoryActionGroup.xml --- .../Catalog/Test/Mftf/ActionGroup/AdminCategoryActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryActionGroup.xml index 57f91b78fcbe9..84e8e43e83845 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryActionGroup.xml @@ -154,7 +154,7 @@ - + From 32859084a65050c5397c26be5b00b158f9a0813a Mon Sep 17 00:00:00 2001 From: Milind Singh Date: Sat, 29 Dec 2018 15:00:45 +0530 Subject: [PATCH 038/238] Update Download.php --- app/code/Magento/Downloadable/Helper/Download.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index c2c091cd37003..3328e599e2903 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -198,10 +198,11 @@ public function getContentType() return $this->_downloadableFile->getFileType($this->_resourceFile); } } elseif ($this->_linkType == self::LINK_TYPE_URL) { - if(is_array($this->_handle->stat($this->_resourceFile)['type'])){ + if (is_array($this->_handle->stat($this->_resourceFile)['type'])) { return end($this->_handle->stat($this->_resourceFile)['type']); - }else - return $this->_handle->stat($this->_resourceFile)['type']; + } else { + return $this->_handle->stat($this->_resourceFile)['type']; + } } return $this->_contentType; } From 116c4a7a1fa7f12598939272f80d373012c9dfa2 Mon Sep 17 00:00:00 2001 From: Chris Snedaker Date: Mon, 31 Dec 2018 04:45:25 -0500 Subject: [PATCH 039/238] Updated to reduce overall complexity of function --- .../Magento/Downloadable/Helper/Download.php | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index 3328e599e2903..d9c95757c700a 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -183,26 +183,23 @@ public function getFileSize() * * @return string */ - public function getContentType() + public function getContentType() { $this->_getHandle(); - if ($this->_linkType == self::LINK_TYPE_FILE) { - if (function_exists( - 'mime_content_type' - ) && ($contentType = mime_content_type( - $this->_workingDirectory->getAbsolutePath($this->_resourceFile) - )) + if ($this->_linkType === self::LINK_TYPE_FILE) { + if (function_exists('mime_content_type') + && ($contentType = mime_content_type( + $this->_workingDirectory->getAbsolutePath($this->_resourceFile) + )) ) { return $contentType; - } else { - return $this->_downloadableFile->getFileType($this->_resourceFile); - } - } elseif ($this->_linkType == self::LINK_TYPE_URL) { - if (is_array($this->_handle->stat($this->_resourceFile)['type'])) { - return end($this->_handle->stat($this->_resourceFile)['type']); - } else { - return $this->_handle->stat($this->_resourceFile)['type']; } + return $this->_downloadableFile->getFileType($this->_resourceFile); + } + if ($this->_linkType === self::LINK_TYPE_URL) { + return (is_array($this->_handle->stat($this->_resourceFile)['type']) + ? end($this->_handle->stat($this->_resourceFile)['type']) + : $this->_handle->stat($this->_resourceFile)['type']); } return $this->_contentType; } From 5ecf4106c4642b7d240264846d76abdbab33437b Mon Sep 17 00:00:00 2001 From: Chris Snedaker Date: Mon, 31 Dec 2018 04:51:05 -0500 Subject: [PATCH 040/238] Merged logic and reduced overall complexity of function Note: if() constructions that return boolean values based on conditions, can be simplified to return the condition instead. --- .../Framework/Filesystem/Driver/Http.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/Http.php b/lib/internal/Magento/Framework/Filesystem/Driver/Http.php index c59ee5efad5d6..159c69d4ea37c 100644 --- a/lib/internal/Magento/Framework/Filesystem/Driver/Http.php +++ b/lib/internal/Magento/Framework/Filesystem/Driver/Http.php @@ -27,31 +27,18 @@ class Http extends File * * @param string $path * @return bool - * @throws FileSystemException */ public function isExists($path) { $headers = array_change_key_case(get_headers($this->getScheme() . $path, 1), CASE_LOWER); - $status = $headers[0]; - /* Handling 302 redirection */ - if (strpos($status, '302 Found') !== false && isset($headers[1])) { - $status = $headers[1]; - } - - /* Handling 301 redirection */ - if (strpos($status, '301 Moved Permanently') !== false && isset($headers[1])) { + /* Handling 301 or 302 redirection */ + if (isset($headers[1]) && preg_match('/^30[12]/', $status)) { $status = $headers[1]; } - if (strpos($status, '200 OK') === false) { - $result = false; - } else { - $result = true; - } - - return $result; + return !(strpos($status, '200 OK') === false); } /** From 9f2f292fdfe02d66aad4a38bf96099cf4a2472ab Mon Sep 17 00:00:00 2001 From: Yannis Livasov Date: Mon, 31 Dec 2018 18:25:27 +0300 Subject: [PATCH 041/238] hardcoded table name hardcoded table name --- app/code/Magento/Directory/Model/ResourceModel/Currency.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Directory/Model/ResourceModel/Currency.php b/app/code/Magento/Directory/Model/ResourceModel/Currency.php index ffbcce11cb4f6..5339b0c9eb5bd 100644 --- a/app/code/Magento/Directory/Model/ResourceModel/Currency.php +++ b/app/code/Magento/Directory/Model/ResourceModel/Currency.php @@ -216,7 +216,7 @@ protected function _getRatesByCode($code, $toCurrencies = null) $connection = $this->getConnection(); $bind = [':currency_from' => $code]; $select = $connection->select()->from( - $this->getTable('directory_currency_rate'), + $this->_currencyRateTable, ['currency_to', 'rate'] )->where( 'currency_from = :currency_from' From d0d57e38a727630393f7cc6a630af81cc36cb1ee Mon Sep 17 00:00:00 2001 From: nmalevanec Date: Wed, 2 Jan 2019 13:41:02 +0200 Subject: [PATCH 042/238] Fix functional test. --- .../Adminhtml/Product/Edit/Section/Options.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Options.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Options.php index 2ac4fb81ae604..d591f3b44462a 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Options.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Options.php @@ -403,4 +403,21 @@ public function getFileOptionElements() { return $this->_rootElement->getElements($this->hintMessage); } + + /** + * @inheritdoc + */ + protected function _fill(array $fields, SimpleElement $element = null) + { + $context = ($element === null) ? $this->_rootElement : $element; + foreach ($fields as $name => $field) { + $element = $this->getElement($context, $field); + if (!$element->isDisabled()) { + $element->getContext()->hover(); + $element->setValue($field['value']); + } else { + throw new \Exception("Unable to set value to field '$name' as it's disabled."); + } + } + } } From 01a5fce647de55f654cf75a40140ba40b2497cf4 Mon Sep 17 00:00:00 2001 From: Shikha Mishra Date: Wed, 2 Jan 2019 21:23:35 +0530 Subject: [PATCH 043/238] Updated Http.php --- lib/internal/Magento/Framework/Filesystem/Driver/Http.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/Http.php b/lib/internal/Magento/Framework/Filesystem/Driver/Http.php index 159c69d4ea37c..f32624f4e7513 100644 --- a/lib/internal/Magento/Framework/Filesystem/Driver/Http.php +++ b/lib/internal/Magento/Framework/Filesystem/Driver/Http.php @@ -34,7 +34,7 @@ public function isExists($path) $status = $headers[0]; /* Handling 301 or 302 redirection */ - if (isset($headers[1]) && preg_match('/^30[12]/', $status)) { + if (isset($headers[1]) && preg_match('/30[12]/', $status)) { $status = $headers[1]; } From ba325135318e2c856e5300d7139f529662679d3e Mon Sep 17 00:00:00 2001 From: chaplynsky <21673575+chaplynsky@users.noreply.github.com> Date: Sun, 6 Jan 2019 00:18:00 -0500 Subject: [PATCH 044/238] Fix error on logo upload for Transactional Emails (#20091) --- .../Email/view/adminhtml/ui_component/design_config_form.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Email/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Email/view/adminhtml/ui_component/design_config_form.xml index 91c38c92dc754..76a914d10b27d 100644 --- a/app/code/Magento/Email/view/adminhtml/ui_component/design_config_form.xml +++ b/app/code/Magento/Email/view/adminhtml/ui_component/design_config_form.xml @@ -13,7 +13,7 @@ true - + To optimize logo for high-resolution displays, upload an image that is 3x normal size and then specify 1x dimensions in the width/height fields below. From 9c9ded46a82d335465627926303fbb93ea82b014 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Fri, 7 Dec 2018 15:09:27 -0600 Subject: [PATCH 045/238] MQE-1352: bug fix in dev/tests/functional/utils/command.php --- .../lib/Magento/Mtf/Util/Command/Cli.php | 37 ++++++++++++++----- .../CurlTransport/WebapiDecorator.php | 20 ++++++++++ dev/tests/functional/utils/command.php | 26 +++++++++---- 3 files changed, 65 insertions(+), 18 deletions(-) diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php index 8fa22122cce89..840ec00df474a 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php @@ -8,6 +8,7 @@ use Magento\Mtf\Util\Protocol\CurlInterface; use Magento\Mtf\Util\Protocol\CurlTransport; +use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator; /** * Perform bin/magento commands from command line for functional tests executions. @@ -17,7 +18,7 @@ class Cli /** * Url to command.php. */ - const URL = 'dev/tests/functional/utils/command.php'; + const URL = '/dev/tests/functional/utils/command.php'; /** * Curl transport protocol. @@ -26,12 +27,21 @@ class Cli */ private $transport; + /** + * Webapi handler. + * + * @var WebapiDecorator + */ + private $webapiHandler; + /** * @param CurlTransport $transport + * @param WebapiDecorator $webapiHandler */ - public function __construct(CurlTransport $transport) + public function __construct(CurlTransport $transport, WebapiDecorator $webapiHandler) { $this->transport = $transport; + $this->webapiHandler = $webapiHandler; } /** @@ -43,22 +53,29 @@ public function __construct(CurlTransport $transport) */ public function execute($command, $options = []) { - $curl = $this->transport; - $curl->write($this->prepareUrl($command, $options), [], CurlInterface::GET); - $curl->read(); - $curl->close(); + $this->transport->write( + rtrim(str_replace('index.php', '', $_ENV['app_frontend_url']), '/') . self::URL, + $this->prepareParamArray($command, $options), + CurlInterface::POST, + [] + ); + $this->transport->read(); + $this->transport->close(); } /** - * Prepare url. + * Prepare parameter array. * * @param string $command * @param array $options [optional] - * @return string + * @return array */ - private function prepareUrl($command, $options = []) + private function prepareParamArray($command, $options = []) { $command .= ' ' . implode(' ', $options); - return $_ENV['app_frontend_url'] . self::URL . '?command=' . urlencode($command); + return [ + 'token' => urlencode($this->webapiHandler->getWebapiToken()), + 'command' => urlencode($command) + ]; } } diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/WebapiDecorator.php b/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/WebapiDecorator.php index 3aa756904ab00..846117e569d56 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/WebapiDecorator.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/WebapiDecorator.php @@ -70,6 +70,13 @@ class WebapiDecorator implements CurlInterface */ protected $response; + /** + * Webapi token. + * + * @var string + */ + protected $webapiToken; + /** * @construct * @param ObjectManager $objectManager @@ -110,6 +117,9 @@ protected function init() $integration->persist(); $this->setConfiguration($integration); + $this->webapiToken = $integration->getToken(); + } else { + $this->webapiToken = $integrationToken; } } @@ -219,4 +229,14 @@ public function close() { $this->transport->close(); } + + /** + * Return webapiToken. + * + * @return string + */ + public function getWebapiToken() + { + return $this->webapiToken; + } } diff --git a/dev/tests/functional/utils/command.php b/dev/tests/functional/utils/command.php index 8eaf82475a4e4..92710356db0ce 100644 --- a/dev/tests/functional/utils/command.php +++ b/dev/tests/functional/utils/command.php @@ -9,15 +9,25 @@ use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Output\NullOutput; -if (isset($_GET['command'])) { - $command = urldecode($_GET['command']); +if (!empty($_POST['token']) && !empty($_POST['command'])) { $magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER); $magentoObjectManager = $magentoObjectManagerFactory->create($_SERVER); - $cli = $magentoObjectManager->create(\Magento\Framework\Console\Cli::class); - $input = new StringInput($command); - $input->setInteractive(false); - $output = new NullOutput(); - $cli->doRun($input, $output); + $tokenModel = $magentoObjectManager->get(\Magento\Integration\Model\Oauth\Token::class); + + $tokenPassedIn = urldecode($_POST['token']); + $command = urldecode($_POST['command']); + + // Token returned will be null if the token we passed in is invalid + $tokenFromMagento = $tokenModel->loadByToken($tokenPassedIn)->getToken(); + if (!empty($tokenFromMagento) && ($tokenFromMagento == $tokenPassedIn)) { + $cli = $magentoObjectManager->create(\Magento\Framework\Console\Cli::class); + $input = new StringInput(escapeshellcmd($command)); + $input->setInteractive(false); + $output = new NullOutput(); + $cli->doRun($input, $output); + } else { + throw new \Exception("Command not unauthorized."); + } } else { - throw new \InvalidArgumentException("Command GET parameter is not set."); + throw new \InvalidArgumentException("Command POST parameters are not set."); } From b9d13e69c4928a0b6d740845bed305a399a42fd5 Mon Sep 17 00:00:00 2001 From: Govind Sharma Date: Tue, 8 Jan 2019 16:07:42 +0530 Subject: [PATCH 046/238] Fixed issue #19891 Fixed issue #19891 added check of attribute type_id --- .../Catalog/Controller/Adminhtml/Product/Attribute/Validate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php index 381ca5d08d82a..e73851534ab4b 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php @@ -105,7 +105,7 @@ public function execute() $attributeCode ); - if ($attribute->getId() && !$attributeId || $attributeCode === 'product_type') { + if ($attribute->getId() && !$attributeId || $attributeCode === 'product_type' || $attributeCode === 'type_id') { $message = strlen($this->getRequest()->getParam('attribute_code')) ? __('An attribute with this code already exists.') : __('An attribute with the same code (%1) already exists.', $attributeCode); From e35aad78182bb429f4649d2f245c06f43752847d Mon Sep 17 00:00:00 2001 From: Patrick McLain Date: Wed, 26 Dec 2018 20:35:41 -0500 Subject: [PATCH 047/238] Add endpoint for fetching/deleting vault tokens --- .../Model/Resolver/DeletePaymentToken.php | 82 +++++++ .../Model/Resolver/PaymentTokens.php | 72 ++++++ .../Model/VisibleTokenRetriever.php | 110 ++++++++++ app/code/Magento/VaultGraphQl/README.md | 5 + app/code/Magento/VaultGraphQl/composer.json | 24 ++ app/code/Magento/VaultGraphQl/etc/module.xml | 16 ++ .../Magento/VaultGraphQl/etc/schema.graphqls | 31 +++ .../Magento/VaultGraphQl/registration.php | 10 + composer.json | 1 + composer.lock | 4 +- .../Vault/CustomerPaymentTokensTest.php | 207 ++++++++++++++++++ .../Magento/Vault/_files/payment_tokens.php | 16 ++ 12 files changed, 576 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php create mode 100644 app/code/Magento/VaultGraphQl/Model/Resolver/PaymentTokens.php create mode 100644 app/code/Magento/VaultGraphQl/Model/VisibleTokenRetriever.php create mode 100644 app/code/Magento/VaultGraphQl/README.md create mode 100644 app/code/Magento/VaultGraphQl/composer.json create mode 100644 app/code/Magento/VaultGraphQl/etc/module.xml create mode 100644 app/code/Magento/VaultGraphQl/etc/schema.graphqls create mode 100644 app/code/Magento/VaultGraphQl/registration.php create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Vault/CustomerPaymentTokensTest.php diff --git a/app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php b/app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php new file mode 100644 index 0000000000000..5acd059fdc525 --- /dev/null +++ b/app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php @@ -0,0 +1,82 @@ +checkCustomerAccount = $checkCustomerAccount; + $this->paymentTokenManagement = $paymentTokenManagement; + $this->paymentTokenRepository = $paymentTokenRepository; + } + + /** + * @inheritdoc + */ + public function resolve( + Field $field, + $context, + ResolveInfo $info, + array $value = null, + array $args = null + ) { + if (!isset($args['public_hash'])) { + throw new GraphQlInputException(__('Specify the "public_hash" value.')); + } + + $currentUserId = $context->getUserId(); + $currentUserType = $context->getUserType(); + + $this->checkCustomerAccount->execute($currentUserId, $currentUserType); + + $token = $this->paymentTokenManagement->getByPublicHash($args['public_hash'], $currentUserId); + if (!$token) { + throw new GraphQlNoSuchEntityException( + __('Token could not be found by public hash: %1', $args['public_hash']) + ); + } + + return ['result' => $this->paymentTokenRepository->delete($token)]; + } +} diff --git a/app/code/Magento/VaultGraphQl/Model/Resolver/PaymentTokens.php b/app/code/Magento/VaultGraphQl/Model/Resolver/PaymentTokens.php new file mode 100644 index 0000000000000..d76cbd058e44e --- /dev/null +++ b/app/code/Magento/VaultGraphQl/Model/Resolver/PaymentTokens.php @@ -0,0 +1,72 @@ +visibleTokenRetriever = $visibleTokenRetriever; + $this->checkCustomerAccount = $checkCustomerAccount; + } + + /** + * @inheritdoc + */ + public function resolve( + Field $field, + $context, + ResolveInfo $info, + array $value = null, + array $args = null + ) { + $currentUserId = $context->getUserId(); + $currentUserType = $context->getUserType(); + + $this->checkCustomerAccount->execute($currentUserId, $currentUserType); + + $tokens = $this->visibleTokenRetriever->getVisibleAvailableTokens($currentUserId); + $result = []; + + foreach ($tokens as $token) { + $result[] = [ + 'public_hash' => $token->getPublicHash(), + 'payment_method_code' => $token->getPaymentMethodCode(), + 'type' => $token->getType(), + 'details' => $token->getTokenDetails(), + ]; + } + + return ['items' => $result]; + } +} diff --git a/app/code/Magento/VaultGraphQl/Model/VisibleTokenRetriever.php b/app/code/Magento/VaultGraphQl/Model/VisibleTokenRetriever.php new file mode 100644 index 0000000000000..a62f61a57862d --- /dev/null +++ b/app/code/Magento/VaultGraphQl/Model/VisibleTokenRetriever.php @@ -0,0 +1,110 @@ +paymentTokenRepository = $repository; + $this->filterBuilder = $filterBuilder; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + $this->searchResultsFactory = $searchResultsFactory; + $this->dateTimeFactory = $dateTimeFactory; + } + + /** + * Searches for all visible, non-expired tokens + * + * @param int $customerId + * @return PaymentTokenInterface[] + */ + public function getVisibleAvailableTokens($customerId) + { + $customerFilter = [ + $this->filterBuilder->setField(PaymentTokenInterface::CUSTOMER_ID) + ->setValue($customerId) + ->create() + ]; + $visibleFilter = [ + $this->filterBuilder->setField(PaymentTokenInterface::IS_VISIBLE) + ->setValue(1) + ->create() + ]; + $isActiveFilter = [ + $this->filterBuilder->setField(PaymentTokenInterface::IS_ACTIVE) + ->setValue(1) + ->create() + ]; + $expiresAtFilter = [ + $this->filterBuilder->setField(PaymentTokenInterface::EXPIRES_AT) + ->setConditionType('gt') + ->setValue( + $this->dateTimeFactory->create( + 'now', + new \DateTimeZone('UTC') + )->format('Y-m-d 00:00:00') + ) + ->create() + ]; + $this->searchCriteriaBuilder->addFilters($customerFilter); + $this->searchCriteriaBuilder->addFilters($visibleFilter); + $this->searchCriteriaBuilder->addFilters($isActiveFilter); + // add filters to different filter groups in order to filter by AND expression + $searchCriteria = $this->searchCriteriaBuilder->addFilters($expiresAtFilter)->create(); + + return $this->paymentTokenRepository->getList($searchCriteria)->getItems(); + } +} diff --git a/app/code/Magento/VaultGraphQl/README.md b/app/code/Magento/VaultGraphQl/README.md new file mode 100644 index 0000000000000..f5261d980d9d1 --- /dev/null +++ b/app/code/Magento/VaultGraphQl/README.md @@ -0,0 +1,5 @@ +# VaultGraphQl + +**VaultGraphQl** provides type and resolver information for the GraphQl module +to generate Vault (stored payment information) information endpoints. Also +provides mutations for modifying a payment token. diff --git a/app/code/Magento/VaultGraphQl/composer.json b/app/code/Magento/VaultGraphQl/composer.json new file mode 100644 index 0000000000000..3c3fee2f6b033 --- /dev/null +++ b/app/code/Magento/VaultGraphQl/composer.json @@ -0,0 +1,24 @@ +{ + "name": "magento/module-vault-graph-ql", + "description": "N/A", + "type": "magento2-module", + "require": { + "php": "~7.1.3||~7.2.0", + "magento/framework": "*", + "magento/module-graph-ql": "*", + "magento/module-vault": "*", + "magento/module-customer-graph-ql": "*" + }, + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Magento\\VaultGraphQl\\": "" + } + } +} diff --git a/app/code/Magento/VaultGraphQl/etc/module.xml b/app/code/Magento/VaultGraphQl/etc/module.xml new file mode 100644 index 0000000000000..8d29b7983c79f --- /dev/null +++ b/app/code/Magento/VaultGraphQl/etc/module.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + diff --git a/app/code/Magento/VaultGraphQl/etc/schema.graphqls b/app/code/Magento/VaultGraphQl/etc/schema.graphqls new file mode 100644 index 0000000000000..f269f8d3557f3 --- /dev/null +++ b/app/code/Magento/VaultGraphQl/etc/schema.graphqls @@ -0,0 +1,31 @@ +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + +type Mutation { + deletePaymentToken(public_hash: String!): DeletePaymentTokenOutput @resolver(class: "\\Magento\\VaultGraphQl\\Model\\Resolver\\DeletePaymentToken") @doc(description:"Delete customer Payment Token") +} + +type DeletePaymentTokenOutput { + result: Boolean! + customerPaymentTokens: CustomerPaymentTokens @resolver(class: "\\Magento\\VaultGraphQl\\Model\\Resolver\\PaymentTokens") +} + +type Query { + customerPaymentTokens: CustomerPaymentTokens @doc(description: "List of customer payment tokens") @resolver(class: "\\Magento\\VaultGraphQl\\Model\\Resolver\\PaymentTokens") +} + +type CustomerPaymentTokens @resolver(class: "\\Magento\\VaultGraphQl\\Model\\Resolver\\PaymentTokens") { + items: [PaymentToken]! @doc(description: "An array of payment tokens") +} + +type PaymentToken @doc(description: "Stored payment method available to customer") { + public_hash: String! @doc(description: "Token public hash") + payment_method_code: String! @doc(description: "Payment method code associated with token") + type: PaymentTokenTypeEnum! + details: String @doc(description: "Stored account details") +} + +enum PaymentTokenTypeEnum @doc(description: "The list of available payment token types") { + card + account +} diff --git a/app/code/Magento/VaultGraphQl/registration.php b/app/code/Magento/VaultGraphQl/registration.php new file mode 100644 index 0000000000000..3f48c00f0709e --- /dev/null +++ b/app/code/Magento/VaultGraphQl/registration.php @@ -0,0 +1,10 @@ +customerTokenService = Bootstrap::getObjectManager()->get(CustomerTokenServiceInterface::class); + $this->paymentTokenManagement = Bootstrap::getObjectManager()->get(VisibleTokenRetriever::class); + $this->tokenResource = Bootstrap::getObjectManager()->get(TokenResource::class); + $this->tokenCollectionFactory = Bootstrap::getObjectManager()->get(CollectionFactory::class); + } + + protected function tearDown() + { + parent::tearDown(); + + $collection = $this->tokenCollectionFactory->create(); + $collection->addFieldToFilter('customer_id', ['eq' => 1]); + + foreach ($collection->getItems() as $token) { + // Using the resource directly to delete. Deleting from the repository only makes token inactive + $this->tokenResource->delete($token); + } + } + + /** + * @magentoApiDataFixture Magento/Vault/_files/payment_tokens.php + */ + public function testGetCustomerPaymentTokens() + { + $currentEmail = 'customer@example.com'; + $currentPassword = 'password'; + + $query = <<graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword)); + + $this->assertEquals(2, count($response['customerPaymentTokens']['items'])); + $this->assertArrayHasKey('public_hash', $response['customerPaymentTokens']['items'][0]); + $this->assertArrayHasKey('details', $response['customerPaymentTokens']['items'][0]); + $this->assertArrayHasKey('payment_method_code', $response['customerPaymentTokens']['items'][0]); + $this->assertArrayHasKey('type', $response['customerPaymentTokens']['items'][0]); + // Validate gateway token is NOT returned + $this->assertArrayNotHasKey('gateway_token', $response['customerPaymentTokens']['items'][0]); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage GraphQL response contains errors: The current customer isn't authorized. + */ + public function testGetCustomerPaymentTokensIfUserIsNotAuthorized() + { + $query = <<graphQlQuery($query); + } + + /** + * @magentoApiDataFixture Magento/Vault/_files/payment_tokens.php + */ + public function testDeletePaymentToken() + { + $currentEmail = 'customer@example.com'; + $currentPassword = 'password'; + $tokens = $this->paymentTokenManagement->getVisibleAvailableTokens(1); + $token = current($tokens); + $publicHash = $token->getPublicHash(); + + $query = <<graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword)); + + $this->assertTrue($response['deletePaymentToken']['result']); + $this->assertEquals(1, count($response['deletePaymentToken']['customerPaymentTokens']['items'])); + + $token = $response['deletePaymentToken']['customerPaymentTokens']['items'][0]; + $this->assertArrayHasKey('public_hash', $token); + $this->assertArrayHasKey('details', $token); + $this->assertArrayHasKey('payment_method_code', $token); + $this->assertArrayHasKey('type', $token); + // Validate gateway token is NOT returned + $this->assertArrayNotHasKey('gateway_token', $token); + + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage GraphQL response contains errors: The current customer isn't authorized. + */ + public function testDeletePaymentTokenIfUserIsNotAuthorized() + { + $query = <<graphQlQuery($query, [], ''); + } + + /** + * @magentoApiDataFixture Magento/Vault/_files/payment_tokens.php + * @expectedException \Exception + * @expectedExceptionMessage GraphQL response contains errors: Token could not be found by public hash: ksdfk392ks + */ + public function testDeletePaymentTokenInvalidPublicHash() + { + $currentEmail = 'customer@example.com'; + $currentPassword = 'password'; + + $query = <<graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword)); + } + + /** + * @param string $email + * @param string $password + * @return array + */ + private function getCustomerAuthHeaders(string $email, string $password): array + { + $customerToken = $this->customerTokenService->createCustomerAccessToken($email, $password); + return ['Authorization' => 'Bearer ' . $customerToken]; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Vault/_files/payment_tokens.php b/dev/tests/integration/testsuite/Magento/Vault/_files/payment_tokens.php index 2af563b35a399..f23a8fcd1bcfb 100644 --- a/dev/tests/integration/testsuite/Magento/Vault/_files/payment_tokens.php +++ b/dev/tests/integration/testsuite/Magento/Vault/_files/payment_tokens.php @@ -43,6 +43,22 @@ 'expires_at' => '2016-12-04 10:18:15', 'is_active' => 0 ], + [ + 'customer_id' => 1, + 'public_hash' => '34567', + 'payment_method_code' => 'fifth', + 'type' => 'card', + 'expires_at' => date('Y-m-d h:i:s', strtotime('+1 month')), + 'is_active' => 1 + ], + [ + 'customer_id' => 1, + 'public_hash' => '345678', + 'payment_method_code' => 'sixth', + 'type' => 'account', + 'expires_at' => date('Y-m-d h:i:s', strtotime('+1 month')), + 'is_active' => 1 + ], ]; /** @var array $tokenData */ foreach ($paymentTokens as $tokenData) { From 0f17e028fbe391bc3ee26e92b34140a8ab644724 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Tue, 8 Jan 2019 17:19:50 -0600 Subject: [PATCH 048/238] MQE-1352: bug fix in dev/tests/functional/utils/command.php etc --- .../Mtf/Util/Command/File/Export/Reader.php | 38 ++++++++++++---- .../Command/File/Export/ReaderInterface.php | 2 +- .../lib/Magento/Mtf/Util/Command/File/Log.php | 38 +++++++++++----- .../lib/Magento/Mtf/Util/Command/Locales.php | 42 ++++++++++++++---- .../Magento/Mtf/Util/Command/PathChecker.php | 43 +++++++++++++++---- .../lib/Magento/Mtf/Util/Command/Website.php | 40 +++++++++++------ dev/tests/functional/utils/authenticate.php | 28 ++++++++++++ dev/tests/functional/utils/command.php | 20 +++------ dev/tests/functional/utils/export.php | 39 +++++++++-------- dev/tests/functional/utils/locales.php | 26 +++++++---- dev/tests/functional/utils/log.php | 25 ++++++----- dev/tests/functional/utils/pathChecker.php | 17 +++++--- dev/tests/functional/utils/website.php | 39 +++++++++-------- 13 files changed, 275 insertions(+), 122 deletions(-) create mode 100644 dev/tests/functional/utils/authenticate.php diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Export/Reader.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Export/Reader.php index 1c05fbaebf625..69df78a5cad64 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Export/Reader.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Export/Reader.php @@ -3,12 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Mtf\Util\Command\File\Export; use Magento\Mtf\ObjectManagerInterface; use Magento\Mtf\Util\Protocol\CurlTransport; use Magento\Mtf\Util\Protocol\CurlInterface; +use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator; /** * File reader for Magento export files. @@ -36,16 +36,29 @@ class Reader implements ReaderInterface */ private $transport; + /** + * Webapi handler. + * + * @var WebapiDecorator + */ + private $webapiHandler; + /** * @param ObjectManagerInterface $objectManager * @param CurlTransport $transport + * @param WebapiDecorator $webapiHandler * @param string $template */ - public function __construct(ObjectManagerInterface $objectManager, CurlTransport $transport, $template) - { + public function __construct( + ObjectManagerInterface $objectManager, + CurlTransport $transport, + WebapiDecorator $webapiHandler, + $template + ) { $this->objectManager = $objectManager; $this->template = $template; $this->transport = $transport; + $this->webapiHandler = $webapiHandler; } /** @@ -70,20 +83,27 @@ public function getData() */ private function getFiles() { - $this->transport->write($this->prepareUrl(), [], CurlInterface::GET); + $this->transport->write( + rtrim(str_replace('index.php', '', $_ENV['app_frontend_url']), '/') . self::URL, + $this->prepareParamArray(), + CurlInterface::POST, + [] + ); $serializedFiles = $this->transport->read(); $this->transport->close(); - return unserialize($serializedFiles); } /** - * Prepare url. + * Prepare parameter array. * - * @return string + * @return array */ - private function prepareUrl() + private function prepareParamArray() { - return $_ENV['app_frontend_url'] . self::URL . '?template=' . urlencode($this->template); + return [ + 'token' => urlencode($this->webapiHandler->getWebapiToken()), + 'template' => urlencode($this->template) + ]; } } diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Export/ReaderInterface.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Export/ReaderInterface.php index 93f7cf1ce9764..3666e8643efa3 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Export/ReaderInterface.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Export/ReaderInterface.php @@ -14,7 +14,7 @@ interface ReaderInterface /** * Url to export.php. */ - const URL = 'dev/tests/functional/utils/export.php'; + const URL = '/dev/tests/functional/utils/export.php'; /** * Exporting files as Data object from Magento. diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Log.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Log.php index 8b41924fe0a90..820a5b0a82228 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Log.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Log.php @@ -7,6 +7,7 @@ namespace Magento\Mtf\Util\Command\File; use Magento\Mtf\Util\Protocol\CurlTransport; +use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator; /** * Get content of log file in var/log folder. @@ -16,7 +17,7 @@ class Log /** * Url to log.php. */ - const URL = 'dev/tests/functional/utils/log.php'; + const URL = '/dev/tests/functional/utils/log.php'; /** * Curl transport protocol. @@ -25,12 +26,21 @@ class Log */ private $transport; + /** + * Webapi handler. + * + * @var WebapiDecorator + */ + private $webapiHandler; + /** * @param CurlTransport $transport + * @param WebapiDecorator $webapiHandler */ - public function __construct(CurlTransport $transport) + public function __construct(CurlTransport $transport, WebapiDecorator $webapiHandler) { $this->transport = $transport; + $this->webapiHandler = $webapiHandler; } /** @@ -41,22 +51,28 @@ public function __construct(CurlTransport $transport) */ public function getFileContent($name) { - $curl = $this->transport; - $curl->write($this->prepareUrl($name), [], CurlTransport::GET); - $data = $curl->read(); - $curl->close(); - + $this->transport->write( + rtrim(str_replace('index.php', '', $_ENV['app_frontend_url']), '/') . self::URL, + $this->prepareParamArray($name), + CurlInterface::POST, + [] + ); + $data = $this->transport->read(); + $this->transport->close(); return unserialize($data); } /** - * Prepare url. + * Prepare parameter array. * * @param string $name - * @return string + * @return array */ - private function prepareUrl($name) + private function prepareParamArray($name) { - return $_ENV['app_frontend_url'] . self::URL . '?name=' . urlencode($name); + return [ + 'token' => urlencode($this->webapiHandler->getWebapiToken()), + 'name' => urlencode($name) + ]; } } diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Locales.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Locales.php index f669d91f2f2e5..a55d803f43087 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Locales.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Locales.php @@ -7,6 +7,7 @@ use Magento\Mtf\Util\Protocol\CurlInterface; use Magento\Mtf\Util\Protocol\CurlTransport; +use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator; /** * Returns array of locales depends on fetching type. @@ -26,7 +27,7 @@ class Locales /** * Url to locales.php. */ - const URL = 'dev/tests/functional/utils/locales.php'; + const URL = '/dev/tests/functional/utils/locales.php'; /** * Curl transport protocol. @@ -35,12 +36,21 @@ class Locales */ private $transport; + /** + * Webapi handler. + * + * @var WebapiDecorator + */ + private $webapiHandler; + /** * @param CurlTransport $transport Curl transport protocol + * @param WebapiDecorator $webapiHandler */ - public function __construct(CurlTransport $transport) + public function __construct(CurlTransport $transport, WebapiDecorator $webapiHandler) { $this->transport = $transport; + $this->webapiHandler = $webapiHandler; } /** @@ -51,12 +61,28 @@ public function __construct(CurlTransport $transport) */ public function getList($type = self::TYPE_ALL) { - $url = $_ENV['app_frontend_url'] . self::URL . '?type=' . $type; - $curl = $this->transport; - $curl->write($url, [], CurlInterface::GET); - $result = $curl->read(); - $curl->close(); - + $this->transport->write( + rtrim(str_replace('index.php', '', $_ENV['app_frontend_url']), '/') . self::URL, + $this->prepareParamArray($type), + CurlInterface::POST, + [] + ); + $result = $this->transport->read(); + $this->transport->close(); return explode('|', $result); } + + /** + * Prepare parameter array. + * + * @param string $type + * @return array + */ + private function prepareParamArray($type) + { + return [ + 'token' => urlencode($this->webapiHandler->getWebapiToken()), + 'type' => urlencode($type) + ]; + } } diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/PathChecker.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/PathChecker.php index fd1f746a6f09c..4b12f6eec87aa 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/PathChecker.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/PathChecker.php @@ -7,6 +7,7 @@ use Magento\Mtf\Util\Protocol\CurlInterface; use Magento\Mtf\Util\Protocol\CurlTransport; +use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator; /** * PathChecker checks that path to file or directory exists. @@ -16,7 +17,7 @@ class PathChecker /** * Url to checkPath.php. */ - const URL = 'dev/tests/functional/utils/pathChecker.php'; + const URL = '/dev/tests/functional/utils/pathChecker.php'; /** * Curl transport protocol. @@ -26,11 +27,21 @@ class PathChecker private $transport; /** + * Webapi handler. + * + * @var WebapiDecorator + */ + private $webapiHandler; + + /** + * @constructor * @param CurlTransport $transport + * @param WebapiDecorator $webapiHandler */ - public function __construct(CurlTransport $transport) + public function __construct(CurlTransport $transport, WebapiDecorator $webapiHandler) { $this->transport = $transport; + $this->webapiHandler = $webapiHandler; } /** @@ -41,12 +52,28 @@ public function __construct(CurlTransport $transport) */ public function pathExists($path) { - $url = $_ENV['app_frontend_url'] . self::URL . '?path=' . urlencode($path); - $curl = $this->transport; - $curl->write($url, [], CurlInterface::GET); - $result = $curl->read(); - $curl->close(); - + $this->transport->write( + rtrim(str_replace('index.php', '', $_ENV['app_frontend_url']), '/') . self::URL, + $this->prepareParamArray($path), + CurlInterface::POST, + [] + ); + $result = $this->transport->read(); + $this->transport->close(); return strpos($result, 'path exists: true') !== false; } + + /** + * Prepare parameter array. + * + * @param string $path + * @return array + */ + private function prepareParamArray($path) + { + return [ + 'token' => urlencode($this->webapiHandler->getWebapiToken()), + 'path' => urlencode($path) + ]; + } } diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Website.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Website.php index 7d73634c0360d..fec20bb2a8715 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Website.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Website.php @@ -3,11 +3,11 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Mtf\Util\Command; use Magento\Mtf\Util\Protocol\CurlInterface; use Magento\Mtf\Util\Protocol\CurlTransport; +use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator; /** * Perform Website folder creation for functional tests executions. @@ -17,7 +17,7 @@ class Website /** * Url to website.php. */ - const URL = 'dev/tests/functional/utils/website.php'; + const URL = '/dev/tests/functional/utils/website.php'; /** * Curl transport protocol. @@ -26,13 +26,22 @@ class Website */ private $transport; + /** + * Webapi handler. + * + * @var WebapiDecorator + */ + private $webapiHandler; + /** * @constructor * @param CurlTransport $transport + * @param WebapiDecorator $webapiHandler */ - public function __construct(CurlTransport $transport) + public function __construct(CurlTransport $transport, WebapiDecorator $webapiHandler) { $this->transport = $transport; + $this->webapiHandler = $webapiHandler; } /** @@ -43,21 +52,28 @@ public function __construct(CurlTransport $transport) */ public function create($websiteCode) { - $curl = $this->transport; - $curl->addOption(CURLOPT_HEADER, 1); - $curl->write($this->prepareUrl($websiteCode), [], CurlInterface::GET); - $curl->read(); - $curl->close(); + $this->transport->addOption(CURLOPT_HEADER, 1); + $this->transport->write( + rtrim(str_replace('index.php', '', $_ENV['app_frontend_url']), '/') . self::URL, + $this->prepareParamArray($websiteCode), + CurlInterface::POST, + [] + ); + $this->transport->read(); + $this->transport->close(); } /** - * Prepare url. + * Prepare parameter array. * * @param string $websiteCode - * @return string + * @return array */ - private function prepareUrl($websiteCode) + private function prepareParamArray($websiteCode) { - return $_ENV['app_frontend_url'] . self::URL . '?website_code=' . urlencode($websiteCode); + return [ + 'token' => urlencode($this->webapiHandler->getWebapiToken()), + 'website_code' => urlencode($websiteCode) + ]; } } diff --git a/dev/tests/functional/utils/authenticate.php b/dev/tests/functional/utils/authenticate.php new file mode 100644 index 0000000000000..4764e64eaffc0 --- /dev/null +++ b/dev/tests/functional/utils/authenticate.php @@ -0,0 +1,28 @@ +create($_SERVER); + $tokenModel = $magentoObjectManager->get(\Magento\Integration\Model\Oauth\Token::class); + + $tokenPassedIn = $token; + // Token returned will be null if the token we passed in is invalid + $tokenFromMagento = $tokenModel->loadByToken($tokenPassedIn)->getToken(); + if (!empty($tokenFromMagento) && ($tokenFromMagento == $tokenPassedIn)) { + return true; + } else { + return false; + } +} diff --git a/dev/tests/functional/utils/command.php b/dev/tests/functional/utils/command.php index 92710356db0ce..4e18598a935ad 100644 --- a/dev/tests/functional/utils/command.php +++ b/dev/tests/functional/utils/command.php @@ -3,31 +3,25 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - +include __DIR__ . '/authenticate.php'; require_once __DIR__ . '/../../../../app/bootstrap.php'; use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Output\NullOutput; if (!empty($_POST['token']) && !empty($_POST['command'])) { - $magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER); - $magentoObjectManager = $magentoObjectManagerFactory->create($_SERVER); - $tokenModel = $magentoObjectManager->get(\Magento\Integration\Model\Oauth\Token::class); - - $tokenPassedIn = urldecode($_POST['token']); - $command = urldecode($_POST['command']); - - // Token returned will be null if the token we passed in is invalid - $tokenFromMagento = $tokenModel->loadByToken($tokenPassedIn)->getToken(); - if (!empty($tokenFromMagento) && ($tokenFromMagento == $tokenPassedIn)) { + if (authenticate(urldecode($_POST['token']))) { + $command = urldecode($_POST['command']); + $magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER); + $magentoObjectManager = $magentoObjectManagerFactory->create($_SERVER); $cli = $magentoObjectManager->create(\Magento\Framework\Console\Cli::class); $input = new StringInput(escapeshellcmd($command)); $input->setInteractive(false); $output = new NullOutput(); $cli->doRun($input, $output); } else { - throw new \Exception("Command not unauthorized."); + echo "Command not unauthorized."; } } else { - throw new \InvalidArgumentException("Command POST parameters are not set."); + echo "'token' or 'command' parameter is not set."; } diff --git a/dev/tests/functional/utils/export.php b/dev/tests/functional/utils/export.php index 343dcc557c832..9357bfa459be0 100644 --- a/dev/tests/functional/utils/export.php +++ b/dev/tests/functional/utils/export.php @@ -3,25 +3,30 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +include __DIR__ . '/authenticate.php'; -if (!isset($_GET['template'])) { - throw new \InvalidArgumentException('Argument "template" must be set.'); -} +if (!empty($_POST['token']) && !empty($_POST['template'])) { + if (authenticate(urldecode($_POST['token']))) { + $varDir = '../../../../var/'; + $template = urldecode($_POST['template']); + $fileList = scandir($varDir, SCANDIR_SORT_NONE); + $files = []; -$varDir = '../../../../var/'; -$template = urldecode($_GET['template']); -$fileList = scandir($varDir, SCANDIR_SORT_NONE); -$files = []; + foreach ($fileList as $fileName) { + if (preg_match("`$template`", $fileName) === 1) { + $filePath = $varDir . $fileName; + $files[] = [ + 'content' => file_get_contents($filePath), + 'name' => $fileName, + 'date' => filectime($filePath), + ]; + } + } -foreach ($fileList as $fileName) { - if (preg_match("`$template`", $fileName) === 1) { - $filePath = $varDir . $fileName; - $files[] = [ - 'content' => file_get_contents($filePath), - 'name' => $fileName, - 'date' => filectime($filePath), - ]; + echo serialize($files); + } else { + echo "Command not unauthorized."; } +} else { + echo "'token' or 'template' parameter is not set."; } - -echo serialize($files); diff --git a/dev/tests/functional/utils/locales.php b/dev/tests/functional/utils/locales.php index 827b8b1b89448..a3b4ec05eed65 100644 --- a/dev/tests/functional/utils/locales.php +++ b/dev/tests/functional/utils/locales.php @@ -3,15 +3,23 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +include __DIR__ . '/authenticate.php'; -if (isset($_GET['type']) && $_GET['type'] == 'deployed') { - $themePath = isset($_GET['theme_path']) ? $_GET['theme_path'] : 'adminhtml/Magento/backend'; - $directory = __DIR__ . '/../../../../pub/static/' . $themePath; - $locales = array_diff(scandir($directory), ['..', '.']); +if (!empty($_POST['token'])) { + if (authenticate(urldecode($_POST['token']))) { + if ($_POST['type'] == 'deployed') { + $themePath = isset($_POST['theme_path']) ? $_POST['theme_path'] : 'adminhtml/Magento/backend'; + $directory = __DIR__ . '/../../../../pub/static/' . $themePath; + $locales = array_diff(scandir($directory), ['..', '.']); + } else { + require_once __DIR__ . DIRECTORY_SEPARATOR . 'bootstrap.php'; + $localeConfig = $magentoObjectManager->create(\Magento\Framework\Locale\Config::class); + $locales = $localeConfig->getAllowedLocales(); + } + echo implode('|', $locales); + } else { + echo "Command not unauthorized."; + } } else { - require_once __DIR__ . DIRECTORY_SEPARATOR . 'bootstrap.php'; - $localeConfig = $magentoObjectManager->create(\Magento\Framework\Locale\Config::class); - $locales = $localeConfig->getAllowedLocales(); + echo "'token' parameter is not set."; } - -echo implode('|', $locales); diff --git a/dev/tests/functional/utils/log.php b/dev/tests/functional/utils/log.php index 68a68d4bad648..889056bfbdd63 100644 --- a/dev/tests/functional/utils/log.php +++ b/dev/tests/functional/utils/log.php @@ -3,17 +3,20 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - declare(strict_types=1); +include __DIR__ . '/authenticate.php'; -if (!isset($_GET['name'])) { - throw new \InvalidArgumentException( - 'The name of log file is required for getting logs.' - ); -} -$name = urldecode($_GET['name']); -if (preg_match('/\.\.(\\\|\/)/', $name)) { - throw new \InvalidArgumentException('Invalid log file name'); -} +if (!empty($_POST['token']) && !empty($_POST['name'])) { + if (authenticate(urldecode($_POST['token']))) { + $name = urldecode($_POST['name']); + if (preg_match('/\.\.(\\\|\/)/', $name)) { + throw new \InvalidArgumentException('Invalid log file name'); + } -echo serialize(file_get_contents('../../../../var/log' .'/' .$name)); + echo serialize(file_get_contents('../../../../var/log' . '/' . $name)); + } else { + echo "Command not unauthorized."; + } +} else { + echo "'token' or 'name' parameter is not set."; +} diff --git a/dev/tests/functional/utils/pathChecker.php b/dev/tests/functional/utils/pathChecker.php index 11f8229bce56f..b5a2ddb405bde 100644 --- a/dev/tests/functional/utils/pathChecker.php +++ b/dev/tests/functional/utils/pathChecker.php @@ -3,15 +3,20 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +include __DIR__ . '/authenticate.php'; -if (isset($_GET['path'])) { - $path = urldecode($_GET['path']); +if (!empty($_POST['token']) && !empty($_POST['path'])) { + if (authenticate(urldecode($_POST['token']))) { + $path = urldecode($_POST['path']); - if (file_exists('../../../../' . $path)) { - echo 'path exists: true'; + if (file_exists('../../../../' . $path)) { + echo 'path exists: true'; + } else { + echo 'path exists: false'; + } } else { - echo 'path exists: false'; + echo "Command not unauthorized."; } } else { - throw new \InvalidArgumentException("GET parameter 'path' is not set."); + echo "'token' or 'path' parameter is not set."; } diff --git a/dev/tests/functional/utils/website.php b/dev/tests/functional/utils/website.php index 625f5c6b483f8..ab8e3742f55ae 100644 --- a/dev/tests/functional/utils/website.php +++ b/dev/tests/functional/utils/website.php @@ -3,30 +3,35 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +include __DIR__ . '/authenticate.php'; -if (!isset($_GET['website_code'])) { - throw new \Exception("website_code GET parameter is not set."); -} - -$websiteCode = urldecode($_GET['website_code']); -$rootDir = '../../../../'; -$websiteDir = $rootDir . 'websites/' . $websiteCode . '/'; -$contents = file_get_contents($rootDir . 'index.php'); +if (!empty($_POST['token']) && !empty($_POST['website_code'])) { + if (authenticate(urldecode($_POST['token']))) { + $websiteCode = urldecode($_POST['website_code']); + $rootDir = '../../../../'; + $websiteDir = $rootDir . 'websites/' . $websiteCode . '/'; + $contents = file_get_contents($rootDir . 'index.php'); -$websiteParam = << Date: Wed, 9 Jan 2019 10:07:17 -0600 Subject: [PATCH 049/238] MQE-1352: bug fix in dev/tests/functional/utils/command.php etc --- .../Mtf/Util/Command/GeneratedCode.php | 39 +++++++++++++++---- .../utils/deleteMagentoGeneratedCode.php | 11 +++++- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/GeneratedCode.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/GeneratedCode.php index dde3409ed1562..a9fefa25ffa24 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/GeneratedCode.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/GeneratedCode.php @@ -7,6 +7,7 @@ use Magento\Mtf\Util\Protocol\CurlInterface; use Magento\Mtf\Util\Protocol\CurlTransport; +use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator; /** * GeneratedCode removes generated code of Magento (like generated/code and generated/metadata). @@ -16,7 +17,7 @@ class GeneratedCode /** * Url to deleteMagentoGeneratedCode.php. */ - const URL = 'dev/tests/functional/utils/deleteMagentoGeneratedCode.php'; + const URL = '/dev/tests/functional/utils/deleteMagentoGeneratedCode.php'; /** * Curl transport protocol. @@ -25,12 +26,21 @@ class GeneratedCode */ private $transport; + /** + * Webapi handler. + * + * @var WebapiDecorator + */ + private $webapiHandler; + /** * @param CurlTransport $transport + * @param WebapiDecorator $webapiHandler */ - public function __construct(CurlTransport $transport) + public function __construct(CurlTransport $transport, WebapiDecorator $webapiHandler) { $this->transport = $transport; + $this->webapiHandler = $webapiHandler; } /** @@ -40,10 +50,25 @@ public function __construct(CurlTransport $transport) */ public function delete() { - $url = $_ENV['app_frontend_url'] . self::URL; - $curl = $this->transport; - $curl->write($url, [], CurlInterface::GET); - $curl->read(); - $curl->close(); + $this->transport->write( + rtrim(str_replace('index.php', '', $_ENV['app_frontend_url']), '/') . self::URL, + $this->prepareParamArray(), + CurlInterface::POST, + [] + ); + $this->transport->read(); + $this->transport->close(); + } + + /** + * Prepare parameter array. + * + * @return array + */ + private function prepareParamArray() + { + return [ + 'token' => urlencode($this->webapiHandler->getWebapiToken()) + ]; } } diff --git a/dev/tests/functional/utils/deleteMagentoGeneratedCode.php b/dev/tests/functional/utils/deleteMagentoGeneratedCode.php index 99aa9af06e92a..17e3575c87686 100644 --- a/dev/tests/functional/utils/deleteMagentoGeneratedCode.php +++ b/dev/tests/functional/utils/deleteMagentoGeneratedCode.php @@ -3,5 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +include __DIR__ . '/authenticate.php'; -exec('rm -rf ../../../../generated/*'); +if (!empty($_POST['token']) && !empty($_POST['path'])) { + if (authenticate(urldecode($_POST['token']))) { + exec('rm -rf ../../../../generated/*'); + } else { + echo "Command not unauthorized."; + } +} else { + echo "'token' parameter is not set."; +} From d9062dc17ba54f1190bc280e2f451e47fd6710fe Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Wed, 9 Jan 2019 13:24:52 -0600 Subject: [PATCH 050/238] MQE-1352: bug fix in dev/tests/functional/utils/command.php etc --- dev/tests/functional/utils/authenticate.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/functional/utils/authenticate.php b/dev/tests/functional/utils/authenticate.php index 4764e64eaffc0..15851f6e8000a 100644 --- a/dev/tests/functional/utils/authenticate.php +++ b/dev/tests/functional/utils/authenticate.php @@ -10,7 +10,8 @@ * @param string $token * @return bool */ -function authenticate($token) { +function authenticate($token) +{ require_once __DIR__ . '/../../../../app/bootstrap.php'; $magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER); From 51f1261497bd4fff2ba5221180e66457950632b5 Mon Sep 17 00:00:00 2001 From: Arvinda kumar Date: Thu, 10 Jan 2019 16:40:37 +0530 Subject: [PATCH 051/238] issue fixed #20163 On iPhone5 device newsletter subscription input box not contain complete text (placeholder) issue fixed #20163 On iPhone5 device newsletter subscription input box not contain complete text (placeholder) --- .../Magento/luma/Magento_Newsletter/web/css/source/_module.less | 1 + 1 file changed, 1 insertion(+) diff --git a/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less index 9ccd6c190ec0e..555a8d6b59f04 100644 --- a/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less @@ -47,6 +47,7 @@ input { padding-left: 35px; + font-size: 12px; } .title { From 645617a7978c2eed2b4b483f8cfc9d120764c6aa Mon Sep 17 00:00:00 2001 From: Nainesh Date: Thu, 10 Jan 2019 19:06:14 +0530 Subject: [PATCH 052/238] 'customer-login-page-input-field-are-short-width-on-tablet-view' :: add changes for On customer login page input field are short width on tablet view --- .../Magento/blank/Magento_Customer/web/css/source/_module.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/blank/Magento_Customer/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Customer/web/css/source/_module.less index 9df59ca5dac92..a94fedbcbbd14 100644 --- a/app/design/frontend/Magento/blank/Magento_Customer/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Customer/web/css/source/_module.less @@ -421,7 +421,7 @@ > .field { > .control { - width: 55%; + width: 80%; } } } From c8d4c53d4a2a3b6d0d942453e34fc6161c63097d Mon Sep 17 00:00:00 2001 From: Arvinda kumar Date: Fri, 11 Jan 2019 14:55:53 +0530 Subject: [PATCH 053/238] _module.less file updated for issue fixed #20163 On iPhone5 device newsletter subscription input box not contain complete text _module.less file updated for issue fixed #20163 On iPhone5 device newsletter subscription input box not contain complete text --- .../web/css/source/_module.less | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less index 555a8d6b59f04..b39b1d3ddf5c3 100644 --- a/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less @@ -47,7 +47,6 @@ input { padding-left: 35px; - font-size: 12px; } .title { @@ -82,3 +81,24 @@ width: 34%; } } + +// +// Mobile +// _____________________________________________ + +.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) { + .block{ + &.newsletter { + input { + font-size: 12px; + padding-left: 30px; + } + + .field { + .control:before{ + font-size: 13px; + } + } + } + } +} From 3f6c2c84db3ae61231c646361c6876d000cb8ec9 Mon Sep 17 00:00:00 2001 From: Nainesh Date: Thu, 17 Jan 2019 17:15:51 +0530 Subject: [PATCH 054/238] 'customer-login-page-input-field-are-short-width-on-tablet-view' :: On customer login page input field are short width on tablet view --- .../Magento/luma/Magento_Customer/web/css/source/_module.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/luma/Magento_Customer/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Customer/web/css/source/_module.less index 5418d836fc262..73000531f6b39 100755 --- a/app/design/frontend/Magento/luma/Magento_Customer/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Customer/web/css/source/_module.less @@ -371,7 +371,7 @@ .fieldset { > .field { > .control { - width: 55%; + width: 80%; } } } From 1ccdb718961d980bf59d0ed68414ca04c49b3e2f Mon Sep 17 00:00:00 2001 From: Kavitha Date: Thu, 17 Jan 2019 10:23:18 -0600 Subject: [PATCH 055/238] MC-4397: Convert NavigateUpSellProductsTest to MFTF --- .../Mftf/Section/AdminProductFormSection.xml | 4 +- .../Mftf/Section/AdminProductGridSection.xml | 1 + ...StorefrontProductUpSellProductsSection.xml | 15 ++ ...dminNavigateMultipleUpSellProductsTest.xml | 161 ++++++++++++++++++ ...rableProductAttributeNameDesignSection.xml | 2 +- 5 files changed, 181 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductUpSellProductsSection.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index 5791d0bfedab9..310cf5d90fc05 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -60,10 +60,12 @@
+ +
- +
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml index fe87c81ad6ac8..30d1088303214 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml @@ -9,6 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
+ diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductUpSellProductsSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductUpSellProductsSection.xml new file mode 100644 index 0000000000000..f00abbe3c58c5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductUpSellProductsSection.xml @@ -0,0 +1,15 @@ + + + + +
+ + +
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml new file mode 100644 index 0000000000000..c6f17a4f9f49b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml @@ -0,0 +1,161 @@ + + + + + + + + + <description value="Login as admin and add simple and configurable Products as Up-Sell products"/> + <testCaseId value="MC-8902"/> + <severity value="CRITICAL"/> + <group value="mtf_migrated"/> + <features value="Catalog"/> + </annotations> + <before> + <!--Login as admin--> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <!--Create Simple Products--> + <createData entity="SimpleSubCategory" stepKey="createCategory1"/> + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleSubCategory" stepKey="createCategory2"/> + <createData entity="SimpleProduct" stepKey="createSimpleProduct1"> + <requiredEntity createDataKey="createCategory2"/> + </createData> + <!-- Create the configurable product with product Attribute options--> + <createData entity="ApiCategory" stepKey="createCategory"/> + <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <createData entity="AddToDefaultSet" stepKey="delete"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + </createData> + <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + </createData> + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct1"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct2"/> + </createData> + </before> + <after> + <!--Delete created data--> + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> + <deleteData createDataKey="createSimpleProduct1" stepKey="deleteSimpleProduct1"/> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createCategory1" stepKey="deleteSubCategory1"/> + <deleteData createDataKey="createCategory2" stepKey="deleteCategory2"/> + <deleteData createDataKey="createConfigChildProduct2" stepKey="deletecreateConfigChildProduct2"/> + <deleteData createDataKey="createConfigChildProduct1" stepKey="deletecreateConfigChildProduct1"/> + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Open Product Index Page--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <!--Select SimpleProduct --> + <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> + <waitForPageLoad stepKey="waitForProductToLoad"/> + <!--Add SimpleProduct1 and ConfigProduct as Up sell products--> + <click stepKey="clickOnRelatedProducts" selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedProductsHeader}}"/> + <click stepKey="clickOnAddUpSellProducts" selector="{{AdminProductFormRelatedUpSellCrossSellSection.addUpSellProduct}}"/> + <actionGroup ref="filterProductGridBySku2" stepKey="filterProduct"> + <argument name="sku" value="$$createSimpleProduct1.sku$$"/> + </actionGroup> + <waitForPageLoad stepKey="waitForTheProductToLoad"/> + <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="selectTheSimpleProduct2"/> + <click stepKey="addSelectedProduct" selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}"/> + <waitForPageLoad stepKey="waitForProductToBeAdded"/> + <click stepKey="clickOnAddUpSellProductsButton" selector="{{AdminProductFormRelatedUpSellCrossSellSection.addUpSellProduct}}"/> + <actionGroup ref="filterProductGridBySku2" stepKey="filterConfigurableProduct"> + <argument name="sku" value="$$createConfigProduct.sku$$"/> + </actionGroup> + <waitForPageLoad stepKey="waitForTheConfigProductToLoad"/> + <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="selectTheConfigProduct"/> + <click stepKey="addSelectedProductButton" selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}"/> + <waitForPageLoad stepKey="waitForConfigProductToBeAdded"/> + <click stepKey="clickOnRelatedProducts1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedProductsHeader}}"/> + <click stepKey="clickOnSaveButton" selector="{{AdminProductFormActionSection.saveButton}}"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> + <!--Go to Product Index Page --> + <click stepKey="clickOnBackButton" selector="{{AdminGridMainControls.back}}"/> + <waitForPageLoad stepKey="waitForProductsToBeLoaded"/> + <!--Select Configurable Product--> + <click stepKey="openConfigProduct" selector="{{AdminProductGridSection.productRowBySku($$createConfigProduct.sku$$)}}"/> + <waitForPageLoad stepKey="waitForConfigProductToLoad"/> + <!--Add SimpleProduct1 as Up Sell Product--> + <click stepKey="clickOnRelatedProductsHeader" selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedProductsHeader}}"/> + <click stepKey="clickOnAddUpSellProductsButton1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.addUpSellProduct}}"/> + <actionGroup ref="filterProductGridBySku2" stepKey="filterSimpleProduct2"> + <argument name="sku" value="$$createSimpleProduct1.sku$$"/> + </actionGroup> + <waitForPageLoad stepKey="waitForTheSimpleProduct2ToBeLoaded"/> + <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="selectSimpleProduct1"/> + <click stepKey="addSimpleProduct2" selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}"/> + <waitForPageLoad stepKey="waitForSimpleProductToBeAdded"/> + <scrollTo selector="{{AdminProductFormActionSection.saveButton}}" stepKey="scrollToTheSaveButton"/> + <click stepKey="clickOnSaveButton1" selector="{{AdminProductFormActionSection.saveButton}}"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading1"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown1"/> + <waitForPageLoad stepKey="waitForUpdatesTobeSaved1"/> + <!--Go to SimpleProduct store front page--> + <amOnPage url="$$createSimpleProduct.sku$$.html" stepKey="goToSimpleProductFrontPage"/> + <waitForPageLoad stepKey="waitForProduct"/> + <see stepKey="seeProductName" userInput="$$createSimpleProduct.sku$$" selector="{{StorefrontProductInfoMainSection.productName}}"/> + <scrollTo stepKey="scrollToTheUpSellHeading" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}"/> + <!--Verify Up Sell Products displayed in SimpleProduct page--> + <see stepKey="seeTheUpSellHeading" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}" userInput="We found other products you might like!"/> + <see stepKey="seeSimpleProduct1" selector="{{StorefrontProductUpSellProductsSection.upSellProducts}}" userInput="$$createSimpleProduct1.name$$"/> + <see stepKey="seeConfigProduct" selector="{{StorefrontProductUpSellProductsSection.upSellProducts}}" userInput="$$createConfigProduct.name$$"/> + <!--Go to Config Product store front page--> + <amOnPage url="$$createConfigProduct.sku$$.html" stepKey="goToConfigProductFrontPage"/> + <waitForPageLoad stepKey="waitForConfigProductToBeLoaded"/> + <scrollTo stepKey="scrollToTheUpSellHeading1" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}"/> + <!--Verify Up Sell Products displayed in ConfigProduct page--> + <see stepKey="seeTheUpSellHeading1" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}" userInput="We found other products you might like!"/> + <see stepKey="seeSimpleProduct2" selector="{{StorefrontProductUpSellProductsSection.upSellProducts}}" userInput="$$createSimpleProduct1.name$$"/> + <!--Go to SimpleProduct1 store front page--> + <amOnPage url="$$createSimpleProduct1.sku$$.html" stepKey="goToSimpleProduct1FrontPage"/> + <waitForPageLoad stepKey="waitForSimpleProduct1ToBeLoaded"/> + <!--Verify No Up Sell Products displayed in SimplProduct1 page--> + <dontSee stepKey="dontSeeTheUpSellHeading1" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}" userInput="We found other products you might like!"/> + </test> +</tests> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/ConfigurableProductAttributeNameDesignSection.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/ConfigurableProductAttributeNameDesignSection.xml index b3077d9d5d566..3511c2549214a 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/ConfigurableProductAttributeNameDesignSection.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/ConfigurableProductAttributeNameDesignSection.xml @@ -7,7 +7,7 @@ --> <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="CatalogProductsSection"> <element name="catalogItem" type="button" selector="//*[@id='menu-magento-catalog-catalog']/a/span"/> <element name="productItem" type="button" selector="//*[@data-ui-id='menu-magento-catalog-catalog-products']/a"/> From 82b1707b9b5c3dab9c74ab6a9a11a93f98880515 Mon Sep 17 00:00:00 2001 From: Mahesh Singh <mahesh721@webkul.com> Date: Thu, 17 Jan 2019 23:24:17 +0530 Subject: [PATCH 056/238] getShippingMethod as object for downloadable and virtual product, undefined index issue fixed --- app/code/Magento/Sales/Model/Order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index a9c14be8675ab..88f52420d080b 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -1284,7 +1284,7 @@ public function getTrackingNumbers() public function getShippingMethod($asObject = false) { $shippingMethod = parent::getShippingMethod(); - if (!$asObject) { + if (!$asObject || !$shippingMethod) { return $shippingMethod; } else { list($carrierCode, $method) = explode('_', $shippingMethod, 2); From ccd301441585b21f23f8ae942ca4a2b0c05b06d1 Mon Sep 17 00:00:00 2001 From: Mahesh Singh <mahesh721@webkul.com> Date: Thu, 17 Jan 2019 23:43:15 +0530 Subject: [PATCH 057/238] return type added in function doc --- app/code/Magento/Sales/Model/Order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index 88f52420d080b..fc371802b7fc6 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -1279,7 +1279,7 @@ public function getTrackingNumbers() * Retrieve shipping method * * @param bool $asObject return carrier code and shipping method data as object - * @return string|\Magento\Framework\DataObject + * @return string|null|\Magento\Framework\DataObject */ public function getShippingMethod($asObject = false) { From e9f5427133fb037fb2c2418e33a668bfe2c951f4 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@adobe.com> Date: Fri, 18 Jan 2019 09:30:54 -0600 Subject: [PATCH 058/238] MQE-1145: Update FrontendExecutor::authorize() method. --- .../Mftf/Test/StorefrontDeletePersistedWishlistTest.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeletePersistedWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeletePersistedWishlistTest.xml index 0001bd9d6db75..0bb4ca843726e 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeletePersistedWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeletePersistedWishlistTest.xml @@ -16,9 +16,6 @@ <severity value="AVERAGE"/> <group value="wishlist"/> <testCaseId value="MC-4110"/> - <skip> - <issueId value="MQE-1145"/> - </skip> </annotations> <before> <createData stepKey="category" entity="SimpleSubCategory"/> @@ -39,6 +36,7 @@ </after> <amOnPage stepKey="amOnSignInPage" url="{{StorefrontCustomerSignInPage.url}}"/> + <waitForPageLoad stepKey="waitForLoginPage"/> <fillField stepKey="fillEmail" userInput="$$customer.email$$" selector="{{StorefrontCustomerSignInFormSection.emailField}}"/> <fillField stepKey="fillPassword" userInput="$$customer.password$$" selector="{{StorefrontCustomerSignInFormSection.passwordField}}"/> <waitForElementVisible stepKey="waitForButton" selector="{{StorefrontCustomerSignInFormSection.signInAccountButton}}"/> @@ -46,8 +44,8 @@ <see stepKey="seeFirstName" userInput="$$customer.firstname$$" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" /> <see stepKey="seeLastName" userInput="$$customer.lastname$$" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" /> <see stepKey="seeEmail" userInput="$$customer.email$$" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" /> - <waitForPageLoad stepKey="15"/> <amOnPage stepKey="amOnWishlist" url="{{StorefrontCustomerWishlistPage.url}}"/> + <waitForPageLoad stepKey="waitForWishlist"/> <see stepKey="seeWishlist" userInput="$$product.name$$" selector="{{StorefrontCustomerWishlistSection.productItemNameText}}"/> <moveMouseOver stepKey="mouseOver" selector="{{StorefrontCustomerWishlistSection.productItemNameText}}"/> <waitForElementVisible stepKey="waitForRemoveButton" selector="{{StorefrontCustomerWishlistSection.removeWishlistButton}}"/> From f1867c9a83b4ae7b5da69c5923105a2e29334406 Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Tue, 22 Jan 2019 00:23:36 +0530 Subject: [PATCH 059/238] updated Download.php --- app/code/Magento/Downloadable/Helper/Download.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index d9c95757c700a..f034b1fb79c94 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -253,10 +253,19 @@ public function setResource($resourceFile, $linkType = self::LINK_TYPE_FILE) ); } } + + /** + * check header + */ $this->_resourceFile = $resourceFile; + $headers = array_change_key_case(get_headers($this->_resourceFile, 1), CASE_LOWER); + if(isset($headers['location'])){ + $this->_resourceFile = is_array($headers['location']) ? current($headers['location']): + $headers['location']; + } + $this->_linkType = $linkType; - return $this; } From dd9e8cf217b78baf12da5120fdfc76d869043bfa Mon Sep 17 00:00:00 2001 From: Serhiy Zhovnir <s.zhovnir@atwix.com> Date: Tue, 22 Jan 2019 12:08:07 +0200 Subject: [PATCH 060/238] #20376 Fix issue with file uploading if an upload field is disabled --- .../Ui/view/base/web/js/form/element/file-uploader.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js index 357571350a268..a871857abfaa9 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js @@ -344,6 +344,12 @@ define([ * @param {Object} data - File data that will be uploaded. */ onBeforeFileUpload: function (e, data) { + if (this.disabled()) { + this.notifyError($t('was not uploaded')); + + return; + } + var file = data.files[0], allowed = this.isFileAllowed(file), target = $(e.target); From 4b04aed0dbc2708eb66973b3a67dc80c56983c43 Mon Sep 17 00:00:00 2001 From: priti <priti@2jcommerce.in> Date: Tue, 22 Jan 2019 16:59:10 +0530 Subject: [PATCH 061/238] view-order-price-subtotal-alignment-not-proper-mobile --- .../Magento/luma/Magento_Sales/web/css/source/_module.less | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less index 1e4a92fa0701f..c8bdc56621f7b 100644 --- a/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less @@ -503,6 +503,11 @@ } } } + .order-items.table-wrapper { + .col.price, .col.qty, .col.subtotal, .col.msrp { + text-align: left; + } + } } .media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) { From 3475a1f309305fb08123ba495b83ecf8553e3468 Mon Sep 17 00:00:00 2001 From: priti <priti@2jcommerce.in> Date: Tue, 22 Jan 2019 19:50:13 +0530 Subject: [PATCH 062/238] view-order-price-subtotal-alignment-not-proper-mobile --- .../Magento/blank/Magento_Sales/web/css/source/_module.less | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less index 3847393a2f046..e9511d8d14426 100644 --- a/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less @@ -294,6 +294,11 @@ } } } + .order-items.table-wrapper { + .col.price, .col.qty, .col.subtotal, .col.msrp { + text-align: left; + } + } } .media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) { From 85c4e92c8e2f60a71ab3745ef3056deb6a4d795e Mon Sep 17 00:00:00 2001 From: Serhiy Zhovnir <s.zhovnir@atwix.com> Date: Tue, 22 Jan 2019 22:08:01 +0200 Subject: [PATCH 063/238] #20376 Fixed issue with variables declarations and adjusted the notification message --- app/code/Magento/Ui/i18n/en_US.csv | 3 ++- .../Ui/view/base/web/js/form/element/file-uploader.js | 11 +++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Ui/i18n/en_US.csv b/app/code/Magento/Ui/i18n/en_US.csv index d51ff98108376..039e28f318176 100644 --- a/app/code/Magento/Ui/i18n/en_US.csv +++ b/app/code/Magento/Ui/i18n/en_US.csv @@ -190,4 +190,5 @@ CSV,CSV "Please enter at least {0} characters.","Please enter at least {0} characters." "Please enter a value between {0} and {1} characters long.","Please enter a value between {0} and {1} characters long." "Please enter a value between {0} and {1}.","Please enter a value between {0} and {1}." -"was not uploaded","was not uploaded" \ No newline at end of file +"was not uploaded","was not uploaded" +"The file upload field is disabled.","The file upload field is disabled." diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js index a871857abfaa9..ea1cb10fd9eda 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js @@ -344,16 +344,15 @@ define([ * @param {Object} data - File data that will be uploaded. */ onBeforeFileUpload: function (e, data) { - if (this.disabled()) { - this.notifyError($t('was not uploaded')); - - return; - } - var file = data.files[0], allowed = this.isFileAllowed(file), target = $(e.target); + if (this.disabled()) { + this.notifyError($t('The file upload field is disabled.')); + return; + } + if (allowed.passed) { target.on('fileuploadsend', function (event, postData) { postData.data.append('param_name', this.paramName); From 53e465c63e00c0a0ffc15342aeb81cf11e5a9875 Mon Sep 17 00:00:00 2001 From: Patrick McLain <pat@pmclain.com> Date: Tue, 22 Jan 2019 13:15:47 -0500 Subject: [PATCH 064/238] Update strings --- .../VaultGraphQl/Model/Resolver/DeletePaymentToken.php | 2 +- app/code/Magento/VaultGraphQl/README.md | 2 +- app/code/Magento/VaultGraphQl/etc/schema.graphqls | 10 +++++----- .../GraphQl/Vault/CustomerPaymentTokensTest.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php b/app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php index 5acd059fdc525..696dbf166fc38 100644 --- a/app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php +++ b/app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php @@ -73,7 +73,7 @@ public function resolve( $token = $this->paymentTokenManagement->getByPublicHash($args['public_hash'], $currentUserId); if (!$token) { throw new GraphQlNoSuchEntityException( - __('Token could not be found by public hash: %1', $args['public_hash']) + __('Could not find a token using public hash: %1', $args['public_hash']) ); } diff --git a/app/code/Magento/VaultGraphQl/README.md b/app/code/Magento/VaultGraphQl/README.md index f5261d980d9d1..afcb1d83f2771 100644 --- a/app/code/Magento/VaultGraphQl/README.md +++ b/app/code/Magento/VaultGraphQl/README.md @@ -1,5 +1,5 @@ # VaultGraphQl **VaultGraphQl** provides type and resolver information for the GraphQl module -to generate Vault (stored payment information) information endpoints. Also +to generate Vault (stored payment information) information endpoints. This module also provides mutations for modifying a payment token. diff --git a/app/code/Magento/VaultGraphQl/etc/schema.graphqls b/app/code/Magento/VaultGraphQl/etc/schema.graphqls index f269f8d3557f3..cdaeced027f6f 100644 --- a/app/code/Magento/VaultGraphQl/etc/schema.graphqls +++ b/app/code/Magento/VaultGraphQl/etc/schema.graphqls @@ -2,7 +2,7 @@ # See COPYING.txt for license details. type Mutation { - deletePaymentToken(public_hash: String!): DeletePaymentTokenOutput @resolver(class: "\\Magento\\VaultGraphQl\\Model\\Resolver\\DeletePaymentToken") @doc(description:"Delete customer Payment Token") + deletePaymentToken(public_hash: String!): DeletePaymentTokenOutput @resolver(class: "\\Magento\\VaultGraphQl\\Model\\Resolver\\DeletePaymentToken") @doc(description:"Delete a customer payment token") } type DeletePaymentTokenOutput { @@ -11,16 +11,16 @@ type DeletePaymentTokenOutput { } type Query { - customerPaymentTokens: CustomerPaymentTokens @doc(description: "List of customer payment tokens") @resolver(class: "\\Magento\\VaultGraphQl\\Model\\Resolver\\PaymentTokens") + customerPaymentTokens: CustomerPaymentTokens @doc(description: "Return a list of customer payment tokens") @resolver(class: "\\Magento\\VaultGraphQl\\Model\\Resolver\\PaymentTokens") } type CustomerPaymentTokens @resolver(class: "\\Magento\\VaultGraphQl\\Model\\Resolver\\PaymentTokens") { items: [PaymentToken]! @doc(description: "An array of payment tokens") } -type PaymentToken @doc(description: "Stored payment method available to customer") { - public_hash: String! @doc(description: "Token public hash") - payment_method_code: String! @doc(description: "Payment method code associated with token") +type PaymentToken @doc(description: "The stored payment method available to the customer") { + public_hash: String! @doc(description: "The public hash of the token") + payment_method_code: String! @doc(description: "The payment method code associated with the token") type: PaymentTokenTypeEnum! details: String @doc(description: "Stored account details") } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Vault/CustomerPaymentTokensTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Vault/CustomerPaymentTokensTest.php index be6a87e225c49..268c5663251f0 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Vault/CustomerPaymentTokensTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Vault/CustomerPaymentTokensTest.php @@ -175,7 +175,7 @@ public function testDeletePaymentTokenIfUserIsNotAuthorized() /** * @magentoApiDataFixture Magento/Vault/_files/payment_tokens.php * @expectedException \Exception - * @expectedExceptionMessage GraphQL response contains errors: Token could not be found by public hash: ksdfk392ks + * @expectedExceptionMessage GraphQL response contains errors: Could not find a token using public hash: ksdfk392ks */ public function testDeletePaymentTokenInvalidPublicHash() { From 5c27f4337dcc1cd55aad5837d8648cf8e991d89f Mon Sep 17 00:00:00 2001 From: Mila Lesechko <l.lesechko@gmail.com> Date: Tue, 22 Jan 2019 21:05:34 -0600 Subject: [PATCH 065/238] Convert ShareWishlistEntityTest to MFTF --- .../StorefrontCustomerWishlistActionGroup.xml | 21 ++- .../Wishlist/Test/Mftf/Data/WishlistData.xml | 2 + .../StorefrontCustomerWishlistSharePage.xml | 15 +++ ...orefrontCustomerWishlistProductSection.xml | 2 + ...StorefrontCustomerWishlistShareSection.xml | 17 +++ .../StorefrontShareWishlistEntityTest.xml | 51 +++++++ .../Test/TestCase/ShareWishlistEntityTest.php | 125 ------------------ .../Test/TestCase/ShareWishlistEntityTest.xml | 16 --- 8 files changed, 107 insertions(+), 142 deletions(-) create mode 100644 app/code/Magento/Wishlist/Test/Mftf/Page/StorefrontCustomerWishlistSharePage.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistShareSection.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml delete mode 100644 dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php delete mode 100644 dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.xml diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml index 7bb42e12d1451..8c7a0302aba20 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml @@ -28,7 +28,9 @@ <waitForElementVisible selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" stepKey="WaitForWishList"/> <click selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" stepKey="addProductToWishlistClickAddToWishlist" /> <waitForElement selector="{{StorefrontCustomerWishlistSection.successMsg}}" time="30" stepKey="addProductToWishlistWaitForSuccessMessage"/> - <see selector="{{StorefrontCustomerWishlistSection.successMsg}}" userInput="{{productVar.name}} has been added to your Wish List." stepKey="addProductToWishlistSeeProductNameAddedToWishlist"/> + <see selector="{{StorefrontCustomerWishlistSection.successMsg}}" + userInput="{{productVar.name}} has been added to your Wish List. Click here to continue shopping." + stepKey="addProductToWishlistSeeProductNameAddedToWishlist"/> <seeCurrentUrlMatches regex="~/wishlist_id/\d+/$~" stepKey="seeCurrentUrlMatches"/> </actionGroup> @@ -88,4 +90,21 @@ <click selector="{{StorefrontCustomerWishlistProductSection.ProductUpdateWishList}}" stepKey="submitUpdateWishlist"/> <see selector="{{StorefrontCustomerWishlistProductSection.ProductSuccessUpdateMessage}}" userInput="{{product.name}} has been updated in your Wish List." stepKey="successMessage"/> </actionGroup> + + <!-- Share wishlist --> + <actionGroup name="StorefrontCustomerShareWishlistActionGroup"> + <click selector="{{StorefrontCustomerWishlistProductSection.ProductShareWishList}}" + stepKey="clickMyWishListButton"/> + <amOnPage url="{{StorefrontCustomerWishlistSharePage.url}}" stepKey="amOnShareWishlist"/> + <fillField userInput="{{Wishlist.shareInfo_emails}}" + selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistEmail}}" + stepKey="fillEmailsForShare"/> + <fillField userInput="{{Wishlist.shareInfo_message}}" + selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistTextMessage}}" + stepKey="fillShareMessage"/> + <click selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistButton}}" + stepKey="sendWishlist"/> + <see selector="{{StorefrontCustomerWishlistProductSection.ProductSuccessShareMessage}}" + userInput="Your wish list has been shared." stepKey="successMessage"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Data/WishlistData.xml b/app/code/Magento/Wishlist/Test/Mftf/Data/WishlistData.xml index 811871bf685ae..c6a9704698b05 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Data/WishlistData.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Data/WishlistData.xml @@ -12,5 +12,7 @@ <var key="product" entityType="product" entityKey="id"/> <var key="customer_email" entityType="customer" entityKey="email"/> <var key="customer_password" entityType="customer" entityKey="password"/> + <data key="shareInfo_emails" entityType="customer" >JohnDoe123456789@example.com,JohnDoe987654321@example.com,JohnDoe123456abc@example.com</data> + <data key="shareInfo_message" entityType="customer">Sharing message.</data> </entity> </entities> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Page/StorefrontCustomerWishlistSharePage.xml b/app/code/Magento/Wishlist/Test/Mftf/Page/StorefrontCustomerWishlistSharePage.xml new file mode 100644 index 0000000000000..976031ae5d17f --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/Page/StorefrontCustomerWishlistSharePage.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="StorefrontCustomerWishlistSharePage" url="/wishlist/index/share/wishlist_id/{{var1}}/" + area="storefront" module="Magento_Wishlist"> + <section name="StorefrontCustomerWishlistShareSection"/> + </page> +</pages> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml index 7a767e42e82bf..4b94ce300f115 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml @@ -19,6 +19,8 @@ <element name="ProductQuantity" type="input" selector="//a[contains(text(), '{{productName}}')]/ancestor::div[@class='product-item-info']//input[@class='input-text qty']" parameterized="true"/> <element name="ProductUpdateWishList" type="button" selector=".column.main .actions-toolbar .action.update" timeout="30"/> <element name="ProductAddAllToCart" type="button" selector=".column.main .actions-toolbar .action.tocart" timeout="30"/> + <element name="ProductShareWishList" type="button" selector=".column.main .actions-toolbar .action.share" timeout="30" /> <element name="ProductSuccessUpdateMessage" type="text" selector="//div[1]/div[2]/div/div/div"/> + <element name="ProductSuccessShareMessage" type="text" selector="//main/div[1]/div[2]/div/div/div"/> </section> </sections> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistShareSection.xml b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistShareSection.xml new file mode 100644 index 0000000000000..97048ed35b798 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistShareSection.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="StorefrontCustomerWishlistShareSection"> + <element name="ProductShareWishlistEmail" type="input" selector="#email_address"/> + <element name="ProductShareWishlistTextMessage" type="input" selector="#message"/> + <element name="ProductShareWishlistButton" type="button" + selector="//*[@class='action submit primary']" timeout="30"/> + </section> +</sections> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml new file mode 100644 index 0000000000000..17d27e910b6f7 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontShareWishlistEntityTest"> + <annotations> + <features value="Wishlist"/> + <stories value="Customer should be able to share a persistent wishlist"/> + <title value="Customer should be able to share a persistent wishlist"/> + <description value="Customer should be able to share a persistent wishlist"/> + <severity value="AVERAGE"/> + <group value="wishlist"/> + <testCaseId value="MAGETWO-23394"/> + </annotations> + <before> + <createData entity="SimpleSubCategory" stepKey="category"/> + <createData entity="SimpleProduct" stepKey="product"> + <requiredEntity createDataKey="category"/> + </createData> + <createData entity="Simple_US_Customer" stepKey="customer"/> + </before> + <after> + <deleteData createDataKey="category" stepKey="deleteCategory"/> + <deleteData createDataKey="product" stepKey="deleteProduct"/> + <deleteData createDataKey="customer" stepKey="deleteCustomer"/> + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + </after> + + <!-- Sign in as customer --> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount"> + <argument name="Customer" value="$$customer$$"/> + </actionGroup> + + <actionGroup ref="OpenProductFromCategoryPageActionGroup" stepKey="openProductFromCategory"> + <argument name="category" value="$$category$$"/> + <argument name="product" value="$$product$$"/> + </actionGroup> + + <actionGroup ref="StorefrontCustomerAddProductToWishlistActionGroup" stepKey="addToWishlistProduct"> + <argument name="productVar" value="$$product$$"/> + </actionGroup> + + <actionGroup ref="StorefrontCustomerShareWishlistActionGroup" stepKey="shareWishlist"/> + </test> +</tests> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php deleted file mode 100644 index 0163727cebab8..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php +++ /dev/null @@ -1,125 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Wishlist\Test\TestCase; - -use Magento\Catalog\Test\Fixture\CatalogProductSimple; -use Magento\Cms\Test\Page\CmsIndex; -use Magento\Customer\Test\Fixture\Customer; -use Magento\Wishlist\Test\Page\WishlistIndex; -use Magento\Wishlist\Test\Page\WishlistShare; -use Magento\Mtf\TestCase\Injectable; - -/** - * Preconditions: - * 1. Create Customer Account. - * 2. Create product. - * - * Steps: - * 1. Login to frontend as a Customer. - * 2. Add product to Wish List. - * 3. Click "Share Wish List" button. - * 4. Fill in all data according to data set. - * 5. Click "Share Wishlist" button. - * 6. Perform all assertions. - * - * @group Wishlist - * @ZephyrId MAGETWO-23394 - * - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - */ -class ShareWishlistEntityTest extends Injectable -{ - /* tags */ - const MVP = 'no'; - /* end tags */ - - /** - * Cms index page. - * - * @var CmsIndex - */ - protected $cmsIndex; - - /** - * Wishlist index page. - * - * @var WishlistIndex - */ - protected $wishlistIndex; - - /** - * Wishlist share page. - * - * @var WishlistShare - */ - protected $wishlistShare; - - /** - * Prepare data. - * - * @param Customer $customer - * @param CatalogProductSimple $product - * @return array - */ - public function __prepare(Customer $customer, CatalogProductSimple $product) - { - $customer->persist(); - $product->persist(); - - return [ - 'customer' => $customer, - 'product' => $product - ]; - } - - /** - * Inject pages. - * - * @param CmsIndex $cmsIndex - * @param WishlistIndex $wishlistIndex - * @param WishlistShare $wishlistShare - * @return void - */ - public function __inject( - CmsIndex $cmsIndex, - WishlistIndex $wishlistIndex, - WishlistShare $wishlistShare - ) { - $this->cmsIndex = $cmsIndex; - $this->wishlistIndex = $wishlistIndex; - $this->wishlistShare = $wishlistShare; - } - - /** - * Share wish list. - * - * @param Customer $customer - * @param CatalogProductSimple $product - * @param array $sharingInfo - * @return void - */ - public function test( - Customer $customer, - CatalogProductSimple $product, - array $sharingInfo - ) { - //Steps - $this->objectManager->create( - \Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class, - ['customer' => $customer] - )->run(); - $this->objectManager->create( - \Magento\Wishlist\Test\TestStep\AddProductsToWishlistStep::class, - ['products' => [$product]] - )->run(); - $this->wishlistIndex->getMessagesBlock()->waitSuccessMessage(); - $this->wishlistIndex->getWishlistBlock()->clickShareWishList(); - $this->cmsIndex->getCmsPageBlock()->waitPageInit(); - $this->wishlistShare->getSharingInfoForm()->fillForm($sharingInfo); - $this->wishlistShare->getSharingInfoForm()->shareWishlist(); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.xml deleted file mode 100644 index ec01f57202b26..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Wishlist\Test\TestCase\ShareWishlistEntityTest" summary="Share wishlist" ticketId="MAGETWO-23394"> - <variation name="ShareWishlistEntityTestVariation1"> - <data name="sharingInfo/emails" xsi:type="string">JohnDoe123456789@example.com,JohnDoe987654321@example.com,JohnDoe123456abc@example.com</data> - <data name="sharingInfo/message" xsi:type="string">Sharing message.</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistShareMessage" /> - </variation> - </testCase> -</config> From 20721002df8d8f52583874a401a06ff9b66dd1c6 Mon Sep 17 00:00:00 2001 From: Prince Patel <mail.mageprince@gmail.com> Date: Wed, 23 Jan 2019 12:25:44 +0530 Subject: [PATCH 066/238] Update Download.php --- app/code/Magento/Downloadable/Helper/Download.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index f034b1fb79c94..1afd7ab0ccf55 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -183,7 +183,7 @@ public function getFileSize() * * @return string */ - public function getContentType() + public function getContentType() { $this->_getHandle(); if ($this->_linkType === self::LINK_TYPE_FILE) { From 57f6957df12c1d9997f88e10f1262087e6d0a66a Mon Sep 17 00:00:00 2001 From: Vasilii <v.burlacu@atwix.com> Date: Wed, 23 Jan 2019 11:38:32 +0200 Subject: [PATCH 067/238] magento/magento2#18347 - Element 'css', attribute 'as': The attribute 'as' is not allowed. (CSS preloading) - Added as attribute to linkType with 3 possible options: style, script and font --- lib/internal/Magento/Framework/View/Layout/etc/head.xsd | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/internal/Magento/Framework/View/Layout/etc/head.xsd b/lib/internal/Magento/Framework/View/Layout/etc/head.xsd index a913507ae17b3..15762dc2f0ae6 100644 --- a/lib/internal/Magento/Framework/View/Layout/etc/head.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/head.xsd @@ -20,6 +20,15 @@ <xs:attribute name="type" type="xs:string"/> <xs:attribute name="order" type="xs:integer"/> <xs:attribute name="src_type" type="xs:string"/> + <xs:attribute name="as"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="font" /> + <xs:enumeration value="script" /> + <xs:enumeration value="style" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> </xs:complexType> <xs:complexType name="metaType"> From a3b1d345527fe718fcf3ab3964041930c6aad03b Mon Sep 17 00:00:00 2001 From: Sjaak van den Brom <12882171+sjaakvdbrom@users.noreply.github.com> Date: Wed, 23 Jan 2019 11:32:50 +0100 Subject: [PATCH 068/238] Fix typo in _resets.less Change Resetes to Resets --- lib/web/css/source/lib/_resets.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/css/source/lib/_resets.less b/lib/web/css/source/lib/_resets.less index 8228a07ef92ab..08d16842b849c 100644 --- a/lib/web/css/source/lib/_resets.less +++ b/lib/web/css/source/lib/_resets.less @@ -4,7 +4,7 @@ // */ // -// Resetes +// Resets // _____________________________________________ // From d91d0ed3c9d59a412b7131cec8e3601cd87b2fb1 Mon Sep 17 00:00:00 2001 From: Serhiy Zhovnir <s.zhovnir@atwix.com> Date: Wed, 23 Jan 2019 14:05:24 +0200 Subject: [PATCH 069/238] #20376 Fixed code style issue & added empty line before the return --- .../Magento/Ui/view/base/web/js/form/element/file-uploader.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js index ea1cb10fd9eda..abf732b8bf7e7 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js @@ -350,6 +350,7 @@ define([ if (this.disabled()) { this.notifyError($t('The file upload field is disabled.')); + return; } From 291bc0b3c41d275d6e4c05b53a5b74b52e7a1739 Mon Sep 17 00:00:00 2001 From: Yaroslav Rogoza <enarc@atwix.com> Date: Wed, 23 Jan 2019 14:06:03 +0100 Subject: [PATCH 070/238] Add virtual products to cart --- .../Model/Cart/ExtractDataFromCart.php | 20 ++++- .../Resolver/AddVirtualProductsToCart.php | 90 +++++++++++++++++++ .../Magento/QuoteGraphQl/etc/schema.graphqls | 15 ++++ 3 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/QuoteGraphQl/Model/Resolver/AddVirtualProductsToCart.php diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/ExtractDataFromCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/ExtractDataFromCart.php index faefa686606e2..a06d662da2865 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/ExtractDataFromCart.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/ExtractDataFromCart.php @@ -7,19 +7,36 @@ namespace Magento\QuoteGraphQl\Model\Cart; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Quote\Model\Quote; use Magento\Quote\Model\Quote\Item as QuoteItem; +use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface; /** * Extract data from cart */ class ExtractDataFromCart { + /** + * @var QuoteIdToMaskedQuoteIdInterface + */ + private $quoteIdToMaskedQuoteId; + + /** + * @param QuoteIdToMaskedQuoteIdInterface $quoteIdToMaskedQuoteId + */ + public function __construct( + QuoteIdToMaskedQuoteIdInterface $quoteIdToMaskedQuoteId + ) { + $this->quoteIdToMaskedQuoteId = $quoteIdToMaskedQuoteId; + } + /** * Extract data from cart * * @param Quote $cart * @return array + * @throws NoSuchEntityException */ public function execute(Quote $cart): array { @@ -41,7 +58,8 @@ public function execute(Quote $cart): array } return [ - 'items' => $items, + 'cart_id' => $this->quoteIdToMaskedQuoteId->execute((int)$cart->getId()), + 'items' => $items ]; } } diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/AddVirtualProductsToCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/AddVirtualProductsToCart.php new file mode 100644 index 0000000000000..54221e3d79bd5 --- /dev/null +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/AddVirtualProductsToCart.php @@ -0,0 +1,90 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\QuoteGraphQl\Model\Resolver; + +use Magento\Framework\GraphQl\Config\Element\Field; +use Magento\Framework\GraphQl\Exception\GraphQlInputException; +use Magento\Framework\GraphQl\Query\ResolverInterface; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\Framework\Stdlib\ArrayManager; +use Magento\QuoteGraphQl\Model\Cart\AddProductsToCart; +use Magento\QuoteGraphQl\Model\Cart\ExtractDataFromCart; +use Magento\QuoteGraphQl\Model\Cart\GetCartForUser; + +/** + * Add virtual products to cart GraphQl resolver + * + * {@inheritdoc} + */ +class AddVirtualProductsToCart implements ResolverInterface +{ + /** + * @var ArrayManager + */ + private $arrayManager; + + /** + * @var GetCartForUser + */ + private $getCartForUser; + + /** + * @var AddProductsToCart + */ + private $addProductsToCart; + + /** + * @var ExtractDataFromCart + */ + private $extractDataFromCart; + + /** + * @param ArrayManager $arrayManager + * @param GetCartForUser $getCartForUser + * @param AddProductsToCart $addProductsToCart + * @param ExtractDataFromCart $extractDataFromCart + */ + public function __construct( + ArrayManager $arrayManager, + GetCartForUser $getCartForUser, + AddProductsToCart $addProductsToCart, + ExtractDataFromCart $extractDataFromCart + ) { + $this->arrayManager = $arrayManager; + $this->getCartForUser = $getCartForUser; + $this->addProductsToCart = $addProductsToCart; + $this->extractDataFromCart = $extractDataFromCart; + } + + /** + * @inheritdoc + */ + public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) + { + $cartHash = $this->arrayManager->get('input/cart_id', $args); + $cartItems = $this->arrayManager->get('input/cartItems', $args); + + if (!isset($cartHash)) { + throw new GraphQlInputException(__('Missing key "cart_id" in cart data')); + } + + if (!isset($cartItems) || !is_array($cartItems) || empty($cartItems)) { + throw new GraphQlInputException(__('Missing key "cartItems" in cart data')); + } + + $currentUserId = $context->getUserId(); + $cart = $this->getCartForUser->execute((string)$cartHash, $currentUserId); + + $this->addProductsToCart->execute($cart, $cartItems); + $cartData = $this->extractDataFromCart->execute($cart); + + return [ + 'cart' => $cartData, + ]; + } +} diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index edc643973ce77..8db797a7cc897 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -15,6 +15,7 @@ type Mutation { setBillingAddressOnCart(input: SetBillingAddressOnCartInput): SetBillingAddressOnCartOutput setShippingMethodsOnCart(input: SetShippingMethodsOnCartInput): SetShippingMethodsOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetShippingMethodsOnCart") addSimpleProductsToCart(input: AddSimpleProductsToCartInput): AddSimpleProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart") + addVirtualProductsToCart(input: AddVirtualProductsToCartInput): AddVirtualProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddVirtualProductsToCart") } input SetShippingAddressesOnCartInput { @@ -167,11 +168,21 @@ input AddSimpleProductsToCartInput { cartItems: [SimpleProductCartItemInput!]! } +input AddVirtualProductsToCartInput { + cart_id: String! + cartItems: [VirtualProductCartItemInput!]! +} + input SimpleProductCartItemInput { data: CartItemInput! customizable_options:[CustomizableOptionInput!] } +input VirtualProductCartItemInput { + data: CartItemInput! + customizable_options:[CustomizableOptionInput!] +} + input CustomizableOptionInput { id: Int! value: String! @@ -181,6 +192,10 @@ type AddSimpleProductsToCartOutput { cart: Cart! } +type AddVirtualProductsToCartOutput { + cart: Cart! +} + type SimpleCartItem implements CartItemInterface @doc(description: "Simple Cart Item") { customizable_options: [SelectedCustomizableOption] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\CustomizableOptions") } From 5c810ccb99de1627186377433a3cea7e8ba118ca Mon Sep 17 00:00:00 2001 From: Yaroslav Rogoza <enarc@atwix.com> Date: Wed, 23 Jan 2019 14:17:55 +0100 Subject: [PATCH 071/238] VirtualCartItem declaration added --- app/code/Magento/QuoteGraphQl/etc/di.xml | 1 + app/code/Magento/QuoteGraphQl/etc/schema.graphqls | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/code/Magento/QuoteGraphQl/etc/di.xml b/app/code/Magento/QuoteGraphQl/etc/di.xml index 63ad9e193b955..ab9cd9da8d629 100644 --- a/app/code/Magento/QuoteGraphQl/etc/di.xml +++ b/app/code/Magento/QuoteGraphQl/etc/di.xml @@ -11,6 +11,7 @@ <arguments> <argument name="supportedTypes" xsi:type="array"> <item name="simple" xsi:type="string">SimpleCartItem</item> + <item name="virtual" xsi:type="string">VirtualCartItem</item> </argument> </arguments> </type> diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index 8db797a7cc897..242b01b87b434 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -200,6 +200,10 @@ type SimpleCartItem implements CartItemInterface @doc(description: "Simple Cart customizable_options: [SelectedCustomizableOption] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\CustomizableOptions") } +type VirtualCartItem implements CartItemInterface @doc(description: "Virtual Cart Item") { + customizable_options: [SelectedCustomizableOption] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\CustomizableOptions") +} + input CartItemInput { sku: String! qty: Float! From 685434d5952a55df00cfcbc749a9ec7d98222e24 Mon Sep 17 00:00:00 2001 From: John S <john00ivy@gmail.com> Date: Wed, 23 Jan 2019 14:17:57 -0600 Subject: [PATCH 072/238] MC-4397: Convert NavigateUpSellProductsTest to MFTF - Updating selector to make it more stable. NEVER use indexes unless they are ABSOLUTELY necessary. - Removing excess "features" annotation from the Test. --- .../Mftf/Section/AdminProductFormSection.xml | 2 +- ...AdminNavigateMultipleUpSellProductsTest.xml | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index 310cf5d90fc05..b874e59acd633 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -65,7 +65,7 @@ <element name="addUpSellProduct" type="button" selector="button[data-index='button_upsell']" timeout="30"/> </section> <section name="AdminAddRelatedProductsModalSection"> - <element name="AddSelectedProductsButton" type="button" selector=" //aside[12]//button[2]/span[contains(text(),'Add Selected Products')]" timeout="30"/> + <element name="AddSelectedProductsButton" type="button" selector=".product_form_product_form_related_upsell_modal .page-actions-buttons .action-primary" timeout="30"/> </section> <section name="ProductWYSIWYGSection"> <element name="Switcher" type="button" selector="//select[@id='dropdown-switcher']"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml index c6f17a4f9f49b..99a050618a912 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml @@ -16,11 +16,12 @@ <testCaseId value="MC-8902"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> - <features value="Catalog"/> </annotations> + <before> <!--Login as admin--> <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <!--Create Simple Products--> <createData entity="SimpleSubCategory" stepKey="createCategory1"/> <createData entity="SimpleProduct" stepKey="createSimpleProduct"> @@ -30,6 +31,7 @@ <createData entity="SimpleProduct" stepKey="createSimpleProduct1"> <requiredEntity createDataKey="createCategory2"/> </createData> + <!-- Create the configurable product with product Attribute options--> <createData entity="ApiCategory" stepKey="createCategory"/> <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> @@ -85,14 +87,17 @@ <deleteData createDataKey="createConfigChildProduct2" stepKey="deletecreateConfigChildProduct2"/> <deleteData createDataKey="createConfigChildProduct1" stepKey="deletecreateConfigChildProduct1"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> + <actionGroup ref="logout" stepKey="logout"/> </after> <!--Open Product Index Page--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <!--Select SimpleProduct --> <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForProductToLoad"/> + <!--Add SimpleProduct1 and ConfigProduct as Up sell products--> <click stepKey="clickOnRelatedProducts" selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedProductsHeader}}"/> <click stepKey="clickOnAddUpSellProducts" selector="{{AdminProductFormRelatedUpSellCrossSellSection.addUpSellProduct}}"/> @@ -101,6 +106,8 @@ </actionGroup> <waitForPageLoad stepKey="waitForTheProductToLoad"/> <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="selectTheSimpleProduct2"/> + <comment userInput="PROBLEM HERE!" stepKey="problem1"/> + <!--<pauseExecution stepKey="pause1"/>--> <click stepKey="addSelectedProduct" selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}"/> <waitForPageLoad stepKey="waitForProductToBeAdded"/> <click stepKey="clickOnAddUpSellProductsButton" selector="{{AdminProductFormRelatedUpSellCrossSellSection.addUpSellProduct}}"/> @@ -115,12 +122,15 @@ <click stepKey="clickOnSaveButton" selector="{{AdminProductFormActionSection.saveButton}}"/> <waitForLoadingMaskToDisappear stepKey="waitForLoading"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> + <!--Go to Product Index Page --> <click stepKey="clickOnBackButton" selector="{{AdminGridMainControls.back}}"/> <waitForPageLoad stepKey="waitForProductsToBeLoaded"/> + <!--Select Configurable Product--> <click stepKey="openConfigProduct" selector="{{AdminProductGridSection.productRowBySku($$createConfigProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForConfigProductToLoad"/> + <!--Add SimpleProduct1 as Up Sell Product--> <click stepKey="clickOnRelatedProductsHeader" selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedProductsHeader}}"/> <click stepKey="clickOnAddUpSellProductsButton1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.addUpSellProduct}}"/> @@ -136,25 +146,31 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoading1"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown1"/> <waitForPageLoad stepKey="waitForUpdatesTobeSaved1"/> + <!--Go to SimpleProduct store front page--> <amOnPage url="$$createSimpleProduct.sku$$.html" stepKey="goToSimpleProductFrontPage"/> <waitForPageLoad stepKey="waitForProduct"/> <see stepKey="seeProductName" userInput="$$createSimpleProduct.sku$$" selector="{{StorefrontProductInfoMainSection.productName}}"/> <scrollTo stepKey="scrollToTheUpSellHeading" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}"/> + <!--Verify Up Sell Products displayed in SimpleProduct page--> <see stepKey="seeTheUpSellHeading" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}" userInput="We found other products you might like!"/> <see stepKey="seeSimpleProduct1" selector="{{StorefrontProductUpSellProductsSection.upSellProducts}}" userInput="$$createSimpleProduct1.name$$"/> <see stepKey="seeConfigProduct" selector="{{StorefrontProductUpSellProductsSection.upSellProducts}}" userInput="$$createConfigProduct.name$$"/> + <!--Go to Config Product store front page--> <amOnPage url="$$createConfigProduct.sku$$.html" stepKey="goToConfigProductFrontPage"/> <waitForPageLoad stepKey="waitForConfigProductToBeLoaded"/> <scrollTo stepKey="scrollToTheUpSellHeading1" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}"/> + <!--Verify Up Sell Products displayed in ConfigProduct page--> <see stepKey="seeTheUpSellHeading1" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}" userInput="We found other products you might like!"/> <see stepKey="seeSimpleProduct2" selector="{{StorefrontProductUpSellProductsSection.upSellProducts}}" userInput="$$createSimpleProduct1.name$$"/> + <!--Go to SimpleProduct1 store front page--> <amOnPage url="$$createSimpleProduct1.sku$$.html" stepKey="goToSimpleProduct1FrontPage"/> <waitForPageLoad stepKey="waitForSimpleProduct1ToBeLoaded"/> + <!--Verify No Up Sell Products displayed in SimplProduct1 page--> <dontSee stepKey="dontSeeTheUpSellHeading1" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}" userInput="We found other products you might like!"/> </test> From 4134ca5ea9d615fb5aa3ccc7b73ac6e17b5b1038 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Wed, 23 Jan 2019 14:43:05 -0600 Subject: [PATCH 073/238] MC-4397: Convert NavigateUpSellProductsTest to MFTF - Remove accidentally left in comment section --- .../Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml index 99a050618a912..97e3898ea1b66 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml @@ -106,8 +106,6 @@ </actionGroup> <waitForPageLoad stepKey="waitForTheProductToLoad"/> <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="selectTheSimpleProduct2"/> - <comment userInput="PROBLEM HERE!" stepKey="problem1"/> - <!--<pauseExecution stepKey="pause1"/>--> <click stepKey="addSelectedProduct" selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}"/> <waitForPageLoad stepKey="waitForProductToBeAdded"/> <click stepKey="clickOnAddUpSellProductsButton" selector="{{AdminProductFormRelatedUpSellCrossSellSection.addUpSellProduct}}"/> From a5dfa0dcf58e2a95dd0aa953b890154922efb74a Mon Sep 17 00:00:00 2001 From: Amit Vishvakarma <amitvishwakarma@cedcoss.com> Date: Thu, 24 Jan 2019 11:26:24 +0530 Subject: [PATCH 074/238] Fixed issue related to Meta Keywords/Description Fixed issue related to Meta Keywords/Description --- .../Ui/DataProvider/Product/Form/Modifier/General.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php index 6ec1cc6c46d9d..26044eb91a309 100755 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php @@ -355,8 +355,10 @@ protected function customizeNameListeners(array $meta) 'allowImport' => !$this->locator->getProduct()->getId(), ]; - if (!in_array($listener, $textListeners)) { - $importsConfig['elementTmpl'] = 'ui/form/element/input'; + if (in_array($listener, $textListeners)) { + $importsConfig['cols'] = 15; + $importsConfig['rows'] = 2; + $importsConfig['elementTmpl'] = 'ui/form/element/textarea'; } $meta = $this->arrayManager->merge($listenerPath . static::META_CONFIG_PATH, $meta, $importsConfig); From 3671bbe7ac374e9bdb7c1957479a06369d0f0952 Mon Sep 17 00:00:00 2001 From: Serhiy Zhovnir <s.zhovnir@atwix.com> Date: Thu, 24 Jan 2019 15:53:06 +0200 Subject: [PATCH 075/238] #20376 Fix code style issue --- .../Magento/Ui/view/base/web/js/form/element/file-uploader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js index abf732b8bf7e7..2c5bc1159dd3a 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js @@ -350,7 +350,7 @@ define([ if (this.disabled()) { this.notifyError($t('The file upload field is disabled.')); - + return; } From d6d373cc819e483922cb89f05e0d44293b92c3c8 Mon Sep 17 00:00:00 2001 From: sathakur <sathakur@adobe.com> Date: Thu, 24 Jan 2019 13:14:53 -0600 Subject: [PATCH 076/238] MC-4406: Convert CreateSimpleProductEntityByAttributeMaskSkuTest to MFTF --- .../Catalog/Test/Mftf/Data/ProductData.xml | 12 ++++ .../Mftf/Section/AdminProductFormSection.xml | 1 + ...untryOfManufactureAttributeSKUMaskTest.xml | 61 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml index 94fcff39fbd20..c4ab52114f4a7 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml @@ -579,4 +579,16 @@ <data key="filename">magento3</data> <data key="file_extension">jpg</data> </entity> + <entity name="nameAndAttributeSkuMaskSimpleProduct" type="product"> + <data key="urlKey" unique="suffix">simple-product</data> + <data key="name" unique="suffix">SimpleProduct</data> + <data key="price">10000.00</data> + <data key="quantity">657</data> + <data key="weight">50</data> + <data key="country_of_manufacture">UA</data> + <data key="country_of_manufacture_label">Ukraine</data> + <data key="type_id">simple</data> + <data key="status">1</data> + <requiredEntity type="product_extension_attribute">EavStock100</requiredEntity> + </entity> </entities> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index 89f904c26e090..9195f7f2ebd60 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -56,6 +56,7 @@ <element name="selectCategory" type="input" selector="//*[@data-index='category_ids']//label[contains(., '{{categoryName}}')]" parameterized="true"/> <element name="done" type="button" selector="//*[@data-index='category_ids']//button[@data-action='close-advanced-select']" timeout="30"/> <element name="selectMultipleCategories" type="input" selector="//*[@data-index='container_category_ids']//*[contains(@class, '_selected')]"/> + <element name="countryOfManufacture" type="select" selector="product[country_of_manufacture]"/> </section> <section name="ProductInWebsitesSection"> <element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml new file mode 100644 index 0000000000000..b3143be9b0e11 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest"> + <annotations> + <stories value="Create simple product"/> + <title value="Create simple product with (Country of Manufacture) Attribute SKU Mask"/> + <description value="Test log in to Create simple product and Create simple product with (Country of Manufacture) Attribute SKU Mask"/> + <testCaseId value="MC-11024"/> + <severity value="CRITICAL"/> + <group value="catalog"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <magentoCLI stepKey="setCountryOfManufacture" command="config:set catalog/fields_masks/sku" arguments="'{{name}} {{country_of_manufacture}}'"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <argument name="sku" value="{{nameAndAttributeSkuMaskSimpleProduct.name}} {{nameAndAttributeSkuMaskSimpleProduct.country_of_manufacture_label}}" /> + </actionGroup> + <magentoCLI stepKey="setName" command="config:set catalog/fields_masks/sku '{{name}}'"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <amOnPage url="{{ProductCatalogPage.url}}" stepKey="openProductCatalogPage"/> + <waitForPageLoad stepKey="waitForProductCatalogPage"/> + <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductToggle"/> + <waitForPageLoad stepKey="waitForProductToggleToSelectSimpleProduct"/> + <click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickSimpleProductFromDropDownList"/> + + <!-- Create simple product with country of manufacture attribute --> + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.name}}" stepKey="fillSimpleProductName"/> + <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.price}}" stepKey="fillSimpleProductPrice"/> + <fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.weight}}" stepKey="fillSimpleProductWeight"/> + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.quantity}}" stepKey="fillSimpleProductQuantity"/> + <selectOption selector="{{AdminProductFormSection.countryOfManufacture}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.country_of_manufacture_label}}" stepKey="selectCountryOfManufacture"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="clickSaveButton"/> + <waitForPageLoad stepKey="waitForSimpleProductToSave"/> + <!-- Verify customer see success message --> + <see selector="{{AdminProductFormSection.successMessage}}" userInput="You saved the product." stepKey="seeAssertSimpleProductSaveSuccessMessage"/> + + <!-- Search created simple product(from above step) in the grid page to verify sku masked as name and country of manufacture --> + <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPageToSearchCreatedSimpleProduct"/> + <waitForPageLoad stepKey="waitForProductCatalogPageToLoad"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearAll}}" dependentSelector="{{AdminProductGridFilterSection.clearAll}}" visible="true" stepKey="clickClearAll"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="clickFiltersButton"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.name}} {{nameAndAttributeSkuMaskSimpleProduct.country_of_manufacture_label}}" stepKey="fillSkuFilterFieldWithNameAndCountryOfManufactureInput" /> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFiltersButton"/> + <waitForPageLoad stepKey="waitForProductSearchAfterApplyingFilters"/> + <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{nameAndAttributeSkuMaskSimpleProduct.name}} {{nameAndAttributeSkuMaskSimpleProduct.country_of_manufacture_label}}" stepKey="seeSimpleProductSkuMaskedAsNameAndCountryOfManufacture"/> + </test> +</tests> From b7f9bf069bfcda90d6637d95ee577c6d87e0a455 Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Fri, 25 Jan 2019 12:51:26 -0600 Subject: [PATCH 077/238] MC-4384: Convert UpdateCategoryEntityFlatDataTest to MFTF --- .../Catalog/Test/Mftf/Data/CategoryData.xml | 6 ++ ...inUpdateFlatCategoryAndAddProductsTest.xml | 100 ++++++++++++++++++ ...ateFlatCategoryIncludeInNavigationTest.xml | 89 ++++++++++++++++ ...dateFlatCategoryNameAndDescriptionTest.xml | 99 +++++++++++++++++ .../Section/AdminIndexManagementSection.xml | 3 + .../CreateCustomStoreViewActionGroup.xml | 19 ++++ .../Mftf/Section/StorefrontHeaderSection.xml | 1 + 7 files changed, 317 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryAndAddProductsTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryIncludeInNavigationTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml index 042393266e923..590120f01bd54 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml @@ -78,4 +78,10 @@ <data key="include_in_menu">true</data> <var key="parent_id" entityType="category" entityKey="id" /> </entity> + <entity name="CatNotIncludeInMenu" type="category"> + <data key="name" unique="suffix">NotInclMenu</data> + <data key="name_lwr" unique="suffix">notinclemenu</data> + <data key="is_active">true</data> + <data key="include_in_menu">false</data> + </entity> </entities> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryAndAddProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryAndAddProductsTest.xml new file mode 100644 index 0000000000000..6b88ba20ab7e2 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryAndAddProductsTest.xml @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminUpdateFlatCategoryAndAddProductsTest"> + <annotations> + <stories value="Update category"/> + <title value="Flat Catalog - Assign Simple Product to Category"/> + <description value="Login as admin, update flat category by adding a simple product"/> + <testCaseId value="MC-11012"/> + <severity value="CRITICAL"/> + <group value="Catalog"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <!-- Create Simple Product --> + <createData entity="SimpleSubCategory" stepKey="category"/> + <!-- Create category --> + <createData entity="defaultSimpleProduct" stepKey="createSimpleProduct"/> + <!-- Create First StoreView --> + <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewEn"> + <argument name="storeView" value="customStoreEN"/> + </actionGroup> + <!-- Create Second StoreView --> + <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <argument name="storeView" value="customStoreFR"/> + </actionGroup> + <!--Run full reindex and clear caches --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + <!--Enable Flat Catalog Category --> + <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/> + <!--Open Index Management Page and Select Index mode "Update by Schedule" --> + <magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" /> + <!-- Run cron twice --> + <magentoCLI command="cron:run" stepKey="runCron1"/> + <magentoCLI command="cron:run" stepKey="runCron2"/> + </before> + <after> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewEn"> + <argument name="customStore" value="customStoreEN"/> + </actionGroup> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewFr"> + <argument name="customStore" value="customStoreFR"/> + </actionGroup> + <deleteData createDataKey="category" stepKey="deleteCategory"/> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Select Created Category--> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(SimpleSubCategory.name)}}" stepKey="selectCreatedCategory"/> + <waitForPageLoad stepKey="waitForTheCategoryPageToLoaded"/> + <!--Add Products in Category--> + <scrollTo selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/> + <click selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" stepKey="clickOnProductInCategory"/> + <scrollToTopOfPage stepKey="scrollOnTopOfPage"/> + <click selector="{{CatalogProductsSection.resetFilter}}" stepKey="clickOnResetFilter"/> + <waitForPageLoad stepKey="waitForProductsToLoad"/> + <fillField selector="{{AdminCategoryContentSection.productTableColumnName}}" userInput="$$createSimpleProduct.name$$" stepKey="selectProduct"/> + <click selector="{{AdminCategoryContentSection.productSearch}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitFroPageToLoad1"/> + <scrollTo selector="{{AdminCategoryContentSection.productTableRow}}" stepKey="scrollToTableRow"/> + <click selector="{{AdminCategoryContentSection.productTableRow}}" stepKey="selectProductFromTableRow"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory"/> + <waitForPageLoad stepKey="waitForSecondCategoryToSave"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/> + <!--Open Index Management Page and verify flat categoryIndex status--> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + <!--Open Index Management Page --> + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="openIndexManagementPage"/> + <waitForPageLoad stepKey="waitForIndexPageToLoad"/> + <see stepKey="seeCategoryIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="Ready"/> + <!--Verify Product In Store Front--> + <amOnPage url="$$createSimpleProduct.name$$.html" stepKey="goToStorefrontPage"/> + <waitForPageLoad stepKey="waitForPageToBeLoaded"/> + <!--Verify product and category is visible in First Store View --> + <click stepKey="selectStoreSwitcher" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/> + <click stepKey="selectFirstStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreEN.name)}}"/> + <waitForPageLoad stepKey="waitForFirstStoreView"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$category.name$$)}}" stepKey="seeCategoryOnNavigation"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="assertProductName"/> + <!--Verify product and category is visible in Second Store View --> + <click stepKey="selectStoreSwitcher1" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/> + <click stepKey="selectSecondStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreFR.name)}}"/> + <waitForPageLoad stepKey="waitForSecondStoreView"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$category.name$$)}}" stepKey="seeCategoryOnNavigation1"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="seeProductName"/> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryIncludeInNavigationTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryIncludeInNavigationTest.xml new file mode 100644 index 0000000000000..8ecd860dfa082 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryIncludeInNavigationTest.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminUpdateFlatCategoryAndIncludeInMenuTest"> + <annotations> + <stories value="Update category"/> + <title value="Flat Catalog - Update Category, Include in Navigation Menu"/> + <description value="Login as admin and update flat category by enabling Include in Menu"/> + <testCaseId value="MC-11011"/> + <severity value="CRITICAL"/> + <group value="Catalog"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <!--Create category--> + <createData entity="CatNotIncludeInMenu" stepKey="createCategory"/> + <!-- Create First StoreView --> + <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewEn"> + <argument name="storeView" value="customStoreEN"/> + </actionGroup> + <!-- Create Second StoreView --> + <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <argument name="storeView" value="customStoreFR"/> + </actionGroup> + <!--Run full reindex and clear caches --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + <!--Enable Flat Catalog Category --> + <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/> + <!--Open Index Management Page and Select Index mode "Update by Schedule" --> + <magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" /> + <!-- Run cron twice --> + <magentoCLI command="cron:run" stepKey="runCron1"/> + <magentoCLI command="cron:run" stepKey="runCron2"/> + </before> + <after> + <deleteData stepKey="deleteCategory" createDataKey="createCategory"/> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewEn"> + <argument name="customStore" value="customStoreEN"/> + </actionGroup> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewFr"> + <argument name="customStore" value="customStoreFR"/> + </actionGroup> + <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Verify Category is not listed in navigation menu--> + <amOnPage url="/{{CatNotIncludeInMenu.name_lwr}}.html" stepKey="openCategoryPage"/> + <waitForPageLoad time="60" stepKey="waitForPageToBeLoaded"/> + <dontSee selector="{{StorefrontHeaderSection.NavigationCategoryByName(CatNotIncludeInMenu.name)}}" stepKey="dontSeeCategoryOnNavigation"/> + <!-- Select created category and enable Include In Menu option--> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(CatNotIncludeInMenu.name)}}" stepKey="selectCreatedCategory"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <click selector="{{AdminCategoryBasicFieldSection.includeInMenuLabel}}" stepKey="enableIncludeInMenuOption"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory"/> + <waitForPageLoad stepKey="waitForSecondCategoryToSave"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/> + <!--Run full reindex and clear caches --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + <!--Open Index Management Page --> + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="openIndexManagementPage"/> + <waitForPageLoad stepKey="waitForIndexPageToBeLoaded"/> + <see stepKey="seeIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="Ready"/> + <!--Verify Category In Store Front--> + <amOnPage url="/$$createCategory.name$$.html" stepKey="openCategoryPage1"/> + <waitForPageLoad stepKey="waitForCategoryStoreFrontPageToLoad"/> + <!--Verify category is visible in First Store View --> + <click stepKey="selectStoreSwitcher" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/> + <click stepKey="selectForstStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreEN.name)}}"/> + <waitForPageLoad stepKey="waitForFirstStoreView"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryOnNavigation"/> + <!--Verify category is visible in Second Store View --> + <click stepKey="selectStoreSwitcher1" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/> + <click stepKey="selectSecondStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreFR.name)}}"/> + <waitForPageLoad stepKey="waitForSecondstoreView"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryOnNavigation1"/> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml new file mode 100644 index 0000000000000..93ca23e2afc9f --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminUpdateFlatCategoryNameAndDescriptionTest"> + <annotations> + <stories value="Update category"/> + <title value="Flat Catalog - Update Category Name and Description"/> + <description value="Login as admin and update flat category name and description"/> + <testCaseId value="MC-11010"/> + <severity value="CRITICAL"/> + <group value="Catalog"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <!--Create category--> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <!-- Create First StoreView --> + <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewEn"> + <argument name="storeView" value="customStoreEN"/> + </actionGroup> + <!-- Create Second StoreView --> + <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <argument name="storeView" value="customStoreFR"/> + </actionGroup> + <!--Run full reindex and clear caches --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + <!--Enable Flat Catalog Category --> + <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/> + <!--Open Index Management Page and Select Index mode "Update by Schedule" --> + <magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" /> + <!-- Run cron twice --> + <magentoCLI command="cron:run" stepKey="runCron1"/> + <magentoCLI command="cron:run" stepKey="runCron2"/> + </before> + <after> + <deleteData stepKey="deleteCategory" createDataKey="createCategory" /> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewEn"> + <argument name="customStore" value="customStoreEN"/> + </actionGroup> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewFr"> + <argument name="customStore" value="customStoreFR"/> + </actionGroup> + <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Select Created Category--> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(_defaultCategory.name)}}" stepKey="selectCreatedCategory"/> + <waitForPageLoad stepKey="waitForPageToLoaded"/> + <!--Update Category Name and Description --> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="addSubCategoryName"/> + <scrollTo selector="{{AdminCategoryContentSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToContent"/> + <click selector="{{AdminCategoryContentSection.sectionHeader}}" stepKey="selectContent"/> + <fillField selector="{{AdminCategoryContentSection.description}}" userInput="Updated category Description Fields" stepKey="fillUpdatedDescription"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory"/> + <waitForPageLoad stepKey="waitForSecondCategoryToSave"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/> + <!--Run full reindex and clear caches --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + <!--Open Index Management Page --> + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="openIndexManagementPage"/> + <waitForPageLoad stepKey="waitForIndexPageToLoad"/> + <see stepKey="seeIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="READY"/> + <!--Verify Category In Store Front--> + <amOnPage url="{{SimpleSubCategory.name}}.html" stepKey="goToStorefrontPage"/> + <waitForPageLoad stepKey="waitForPageToBeLoaded"/> + <!--Verify category is visible in First Store View --> + <click stepKey="selectStoreSwitcher" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/> + <click stepKey="selectFirstStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreEN.name)}}"/> + <waitForPageLoad stepKey="waitForFirstStoreView"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="seeCategoryOnNavigation"/> + <!--Verify category is visible in Second Store View --> + <click stepKey="selectStoreSwitcher1" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/> + <click stepKey="selectSecondStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreFR.name)}}"/> + <waitForPageLoad stepKey="waitForSecondStoreView"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="seeCategoryOnNavigation1"/> + <!-- Verify Updated Category Name and description on Category Page--> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage1"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree1"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(SimpleSubCategory.name)}}" stepKey="selectUpdatedCategory"/> + <waitForPageLoad stepKey="waitForUpdatedCategoryPageToLoad"/> + <seeInField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="seeUpdatedSubCategoryName"/> + <scrollTo selector="{{AdminCategoryContentSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToContent1"/> + <click selector="{{AdminCategoryContentSection.sectionHeader}}" stepKey="selectContent1"/> + <seeInField selector="{{AdminCategoryContentSection.description}}" userInput="Updated category Description Fields" stepKey="seeUpdatedDescription"/> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml b/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml index db98116c224dd..99d1fb840e691 100644 --- a/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml +++ b/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml @@ -13,5 +13,8 @@ <element name="indexerCheckbox" type="checkbox" selector="input[value='{{var1}}']" parameterized="true"/> <element name="massActionSelect" type="select" selector="#gridIndexer_massaction-select"/> <element name="massActionSubmit" type="button" selector="#gridIndexer_massaction-form button"/> + <element name="indexerSelect" type="select" selector="//select[@class='action-select-multiselect']"/> + <element name="indexerStatus" type="text" selector="//tr[descendant::td[contains(., '{{status}}')]]//*[contains(@class, 'col-indexer_status')]/span" parameterized="true"/> + <element name="successMessage" type="text" selector="//*[@data-ui-id='messages-message-success']"/> </section> </sections> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml index 31bbe7550e5a1..0ee3887f6b4d9 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml @@ -21,4 +21,23 @@ <waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton" /> <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/> </actionGroup> + <actionGroup name="CreateStoreView"> + <arguments> + <argument name="storeView" defaultValue="customStore"/> + </arguments> + <amOnPage url="{{AdminSystemStoreViewPage.url}}" stepKey="amOnAdminSystemStoreViewPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <selectOption userInput="Main Website Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/> + <fillField userInput="{{storeView.name}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/> + <fillField userInput="{{storeView.code}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/> + <selectOption userInput="Enabled" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/> + <click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/> + <waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton" /> + <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/> + <see userInput="You saved the store view." stepKey="seeSavedMessage"/> + </actionGroup> </actionGroups> + + + + diff --git a/app/code/Magento/Store/Test/Mftf/Section/StorefrontHeaderSection.xml b/app/code/Magento/Store/Test/Mftf/Section/StorefrontHeaderSection.xml index af18e858e1057..c63bd5f48f9d1 100644 --- a/app/code/Magento/Store/Test/Mftf/Section/StorefrontHeaderSection.xml +++ b/app/code/Magento/Store/Test/Mftf/Section/StorefrontHeaderSection.xml @@ -11,5 +11,6 @@ <element name="storeViewSwitcher" type="button" selector="#switcher-language-trigger"/> <element name="storeViewDropdown" type="button" selector="ul.switcher-dropdown"/> <element name="storeViewOption" type="button" selector="li.view-{{var1}}>a" parameterized="true"/> + <element name="storeViewList" type="button" selector="//li[contains(.,'{{storeViewName}}')]/a" parameterized="true"/> </section> </sections> From c9689fbca1f319c4f56073ba006902f4b10dbdfd Mon Sep 17 00:00:00 2001 From: sathakur <sathakur@adobe.com> Date: Fri, 25 Jan 2019 15:46:38 -0600 Subject: [PATCH 078/238] MC-4383: Convert AdvancedMoveCategoryEntityTest to MFTF --- .../Catalog/Test/Mftf/Data/CategoryData.xml | 4 +- ...oryToAnotherPositionInCategoryTreeTest.xml | 116 ++++++++++++++++++ 2 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml index 3a44148d24a31..efb6947e7417c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml @@ -52,11 +52,11 @@ </entity> <entity name="FirstLevelSubCat" type="category"> <data key="name" unique="suffix">FirstLevelSubCategory</data> - <data key="name_lwr" unique="suffix">subcategory</data> + <data key="name_lwr" unique="suffix">firstlevelsubcategory</data> </entity> <entity name="SecondLevelSubCat" type="category"> <data key="name" unique="suffix">SecondLevelSubCategory</data> - <data key="name_lwr" unique="suffix">subcategory</data> + <data key="name_lwr" unique="suffix">secondlevelsubcategory</data> </entity> <entity name="ThirdLevelSubCat" type="category"> <data key="name" unique="suffix">ThirdLevelSubCategory</data> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml new file mode 100644 index 0000000000000..c5cdd228d579b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="UTF-8"?> + <!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + --> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminMoveCategoryToAnotherPositionInCategoryTreeTest"> + <annotations> + <stories value="Move categories"/> + <title value="Move Category to Another Position in Category Tree"/> + <description value="Test log in to Move Category and Move Category to Another Position in Category Tree"/> + <testCaseId value="MC-13612"/> + <severity value="CRITICAL"/> + <group value="catalog"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <createData entity="_defaultCategory" stepKey="createDefaultCategory"/> + </before> + <after> + <deleteData createDataKey="createDefaultCategory" stepKey="deleteDefaultCategory"/> + <actionGroup ref="DeleteCategory" stepKey="SecondLevelSubCat"> + <argument name="categoryEntity" value="SecondLevelSubCat"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- Open Category Page --> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForPageToLoaded"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickExpandTree"/> + <waitForPageLoad stepKey="waitForCategoryToLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(_defaultCategory.name)}}" stepKey="selectCategory"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <!-- Create three level deep sub Category --> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickAddSubCategoryButton"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{FirstLevelSubCat.name}}" stepKey="fillSubCategoryName"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveFirstLevelSubCategory"/> + <waitForPageLoad stepKey="waitForFirstLevelCategoryToSave"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButtonAgain"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SecondLevelSubCat.name}}" stepKey="fillSecondLevelSubCategoryName"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSecondLevelSubCategory"/> + <waitForPageLoad stepKey="waitForSecondLevelCategoryToSave"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSaveSuccessMessage"/> + <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#" /> + + <!-- Move Category to another position in category tree, but click cancel button --> + <dragAndDrop selector1="{{AdminCategorySidebarTreeSection.categoryInTree(SecondLevelSubCat.name)}}" selector2="{{AdminCategorySidebarTreeSection.categoryInTree('Default Category')}}" stepKey="moveCategory"/> + <see selector="{{AdminCategoryModalSection.message}}" userInput="This operation can take a long time" stepKey="seeWarningMessage"/> + <click selector="{{AdminCategoryModalSection.cancel}}" stepKey="clickCancelButtonOnWarningPopup"/> + <!-- Verify Category in store front page after clicking cancel button --> + <amOnPage url="/$$createDefaultCategory.name$$/{{FirstLevelSubCat.name}}/{{SecondLevelSubCat.name}}.html" stepKey="seeTheCategoryInStoreFrontPage"/> + <waitForPageLoad stepKey="waitForStoreFrontPageLoad"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(_defaultCategory.name)}}" stepKey="seeDefaultCategoryOnStoreNavigationBar"/> + <dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="dontSeeSubCategoryOnStoreNavigationBar"/> + <!-- Verify breadcrumbs in store front page after clicking cancel button --> + <grabMultiple selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="breadcrumbs"/> + <assertEquals stepKey="verifyTheCategoryInStoreFrontPage"> + <expectedResult type="array">['Home', $$createDefaultCategory.name$$,{{FirstLevelSubCat.name}},{{SecondLevelSubCat.name}}]</expectedResult> + <actualResult type="variable">breadcrumbs</actualResult> + </assertEquals> + + <!-- Move Category to another position in category tree and click ok button--> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openTheAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitTillPageLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <dragAndDrop selector1="{{AdminCategorySidebarTreeSection.categoryInTree(SecondLevelSubCat.name)}}" selector2="{{AdminCategorySidebarTreeSection.categoryInTree('Default Category')}}" stepKey="DragCategory"/> + <see selector="{{AdminCategoryModalSection.message}}" userInput="This operation can take a long time" stepKey="seeWarningMessageForOneMoreTime"/> + <click selector="{{AdminCategoryModalSection.ok}}" stepKey="clickOkButtonOnWarningPopup"/> + <waitForPageLoad stepKey="waitTheForPageToLoad"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You moved the category." stepKey="seeSuccessMoveMessage"/> + <amOnPage url="/{{SimpleSubCategory.name}}.html" stepKey="seeCategoryNameInStoreFrontPage"/> + <waitForPageLoad stepKey="waitForStoreFrontPageToLoad"/> + <!-- Verify Category in store front after moving category to another position in category tree --> + <amOnPage url="{{StorefrontCategoryPage.url(SecondLevelSubCat.name)}}" stepKey="amOnCategoryPage"/> + <waitForPageLoad stepKey="waitForPageToBeLoaded"/> + <seeElement selector="{{StorefrontCategoryMainSection.CategoryTitle(SecondLevelSubCat.name)}}" stepKey="seeCategoryInTitle"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SecondLevelSubCat.name)}}" stepKey="seeCategoryOnStoreNavigationBarAfterMove"/> + <!-- Verify breadcrumbs in store front page after moving category to another position in category tree --> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SecondLevelSubCat.name)}}" stepKey="clickCategoryOnNavigation"/> + <waitForPageLoad stepKey="waitForCategoryLoad"/> + <grabMultiple selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="breadcrumbsAfterMove"/> + <assertEquals stepKey="verifyBreadcrumbsInFrontPageAfterMove"> + <expectedResult type="array">['Home',{{SecondLevelSubCat.name}}]</expectedResult> + <actualResult type="variable">breadcrumbsAfterMove</actualResult> + </assertEquals> + + <!-- Open Url Rewrite page and see the url rewrite for the moved category --> + <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteIndexPage"/> + <waitForPageLoad stepKey="waitForUrlRewritePageLoad"/> + <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{SecondLevelSubCat.name_lwr}}.html" stepKey="fillCategoryUrlKey"/> + <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> + <waitForPageLoad stepKey="waitForUrlPageToLoad"/> + <!-- Verify new Redirect Path after move --> + <see selector="{{AdminUrlRewriteIndexSection.requestPathColumn('2')}}" userInput="{{SecondLevelSubCat.name_lwr}}.html" stepKey="verifyTheRequestPathAfterMove"/> + <!-- Verify new Target Path after move --> + <see selector="{{AdminUrlRewriteIndexSection.targetPathColumn('2')}}" userInput="catalog/category/view/id/{$categoryId}" stepKey="verifyTheTargetPathAfterMove"/> + <!-- Verify new RedirectType after move --> + <see selector="{{AdminUrlRewriteIndexSection.redirectTypeColumn('2')}}" userInput="No" stepKey="verifyTheRedirectTypeAfterMove"/> + <!-- Verify before move Redirect Path displayed with associated Target Path and Redirect Type--> + <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{SecondLevelSubCat.name_lwr}}" stepKey="fillTheCategoryUrlKey"/> + <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton2"/> + <waitForPageLoad stepKey="waitForSearch"/> + <see selector="{{AdminUrlRewriteIndexSection.redirectTypeColumn('1')}}" userInput="Permanent (301)" stepKey="verifyTheRedirectTypeBeforeMove"/> + <see selector="{{AdminUrlRewriteIndexSection.requestPathColumn('1')}}" userInput="{{_defaultCategory.name_lwr}}2/{{FirstLevelSubCat.name_lwr}}/{{SecondLevelSubCat.name_lwr}}.html" stepKey="verifyTheRequestPathBeforeMove"/> + <see selector="{{AdminUrlRewriteIndexSection.targetPathColumn('1')}}" userInput="{{SecondLevelSubCat.name_lwr}}.html" stepKey="verifyTheTargetPathBeforeMove"/> + </test> +</tests> From 56064a2069aac2f3e8c5d27ba69e8e0b3f547f83 Mon Sep 17 00:00:00 2001 From: Patrick McLain <pat@pmclain.com> Date: Fri, 25 Jan 2019 20:09:21 -0500 Subject: [PATCH 079/238] Resolve Redundant dependencies found in static test There was 1 failure: 1) Magento\Test\Integrity\DependencyTest::testRedundant Redundant dependencies found! Module Magento\VaultGraphQl: hard [Magento\GraphQl] --- app/code/Magento/VaultGraphQl/composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/VaultGraphQl/composer.json b/app/code/Magento/VaultGraphQl/composer.json index 3c3fee2f6b033..455d24bfc11f8 100644 --- a/app/code/Magento/VaultGraphQl/composer.json +++ b/app/code/Magento/VaultGraphQl/composer.json @@ -5,7 +5,6 @@ "require": { "php": "~7.1.3||~7.2.0", "magento/framework": "*", - "magento/module-graph-ql": "*", "magento/module-vault": "*", "magento/module-customer-graph-ql": "*" }, From 938eaf39d5406f8327d7cb445b0a16686aa7d063 Mon Sep 17 00:00:00 2001 From: niravkrish <nirav.patel@krishtechnolabs.com> Date: Mon, 28 Jan 2019 09:46:40 +0530 Subject: [PATCH 080/238] fixed tax summary calculation issue --- .../web/js/view/checkout/summary/tax.js | 35 +++++++++++++++++-- .../template/checkout/cart/totals/tax.html | 22 ++++++------ .../web/template/checkout/summary/tax.html | 22 ++++++------ 3 files changed, 52 insertions(+), 27 deletions(-) diff --git a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js index b21be98531ba9..c66062adb7bb7 100644 --- a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js +++ b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js @@ -12,13 +12,17 @@ define([ 'Magento_Checkout/js/view/summary/abstract-total', 'Magento_Checkout/js/model/quote', 'Magento_Checkout/js/model/totals', - 'mage/translate' -], function (ko, Component, quote, totals, $t) { + 'mage/translate', + 'underscore' +], function (ko, Component, quote, totals, $t, _) { 'use strict'; var isTaxDisplayedInGrandTotal = window.checkoutConfig.includeTaxInGrandTotal, isFullTaxSummaryDisplayed = window.checkoutConfig.isFullTaxSummaryDisplayed, - isZeroTaxDisplayed = window.checkoutConfig.isZeroTaxDisplayed; + isZeroTaxDisplayed = window.checkoutConfig.isZeroTaxDisplayed, + totalPercentage = 0, + amount = '', + rates = ''; return Component.extend({ defaults: { @@ -98,6 +102,31 @@ define([ return this.getFormattedPrice(amount); }, + /** + * @param {*} parent + * @param {*} percentage + * @return {*|String} + */ + getTaxAmount: function (parent, percentage) { + amount = parent.amount; + rates = parent.rates; + totalPercentage = 0; + _.each(rates, function (rate) { + totalPercentage += parseFloat(rate.percent); + }); + return this.getFormattedPrice(this.getPercerntAmount(amount, totalPercentage, percentage)); + }, + + /** + * @param {*} amount + * @param {*} totalper + * @param {*} per + * @return {*|String} + */ + getPercerntAmount: function (amount, totalper, per) { + return parseFloat((amount * per) / totalper); + }, + /** * @return {Array} */ diff --git a/app/code/Magento/Tax/view/frontend/web/template/checkout/cart/totals/tax.html b/app/code/Magento/Tax/view/frontend/web/template/checkout/cart/totals/tax.html index 9c45e73db6fa4..45c468096abe1 100644 --- a/app/code/Magento/Tax/view/frontend/web/template/checkout/cart/totals/tax.html +++ b/app/code/Magento/Tax/view/frontend/web/template/checkout/cart/totals/tax.html @@ -32,18 +32,16 @@ <!-- ko if: !percent --> <th class="mark" scope="row" colspan="1" data-bind="text: title"></th> <!-- /ko --> - <!-- ko if: $index() == 0 --> - <td class="amount" rowspan="1"> - <!-- ko if: $parents[1].isCalculated() --> - <span class="price" - data-bind="text: $parents[1].formatPrice($parents[0].amount), attr: {'data-th': title, 'rowspan': $parents[0].rates.length }"></span> - <!-- /ko --> - <!-- ko ifnot: $parents[1].isCalculated() --> - <span class="not-calculated" - data-bind="text: $parents[1].formatPrice($parents[0].amount), attr: {'data-th': title, 'rowspan': $parents[0].rates.length }"></span> - <!-- /ko --> - </td> - <!-- /ko --> + <td class="amount" rowspan="1"> + <!-- ko if: $parents[1].isCalculated() --> + <span class="price" + data-bind="text: $parents[1].getTaxAmount($parents[0], percent), attr: {'data-th': title, 'rowspan': $parents[0].rates.length }"></span> + <!-- /ko --> + <!-- ko ifnot: $parents[1].isCalculated() --> + <span class="not-calculated" + data-bind="text: $parents[1].getTaxAmount($parents[0], percent), attr: {'data-th': title, 'rowspan': $parents[0].rates.length }"></span> + <!-- /ko --> + </td> </tr> <!-- /ko --> <!-- /ko --> diff --git a/app/code/Magento/Tax/view/frontend/web/template/checkout/summary/tax.html b/app/code/Magento/Tax/view/frontend/web/template/checkout/summary/tax.html index 0f2e3251bcfdb..5f1ac86e38ffd 100644 --- a/app/code/Magento/Tax/view/frontend/web/template/checkout/summary/tax.html +++ b/app/code/Magento/Tax/view/frontend/web/template/checkout/summary/tax.html @@ -43,18 +43,16 @@ <!-- ko if: !percent --> <th class="mark" scope="row" data-bind="text: title"></th> <!-- /ko --> - <!-- ko if: $index() == 0 --> - <td class="amount"> - <!-- ko if: $parents[1].isCalculated() --> - <span class="price" - data-bind="text: $parents[1].formatPrice($parents[0].amount), attr: {'data-th': title, 'rowspan': $parents[0].rates.length }"></span> - <!-- /ko --> - <!-- ko ifnot: $parents[1].isCalculated() --> - <span class="not-calculated" - data-bind="text: $parents[1].formatPrice($parents[0].amount), attr: {'data-th': title, 'rowspan': $parents[0].rates.length }"></span> - <!-- /ko --> - </td> - <!-- /ko --> + <td class="amount"> + <!-- ko if: $parents[1].isCalculated() --> + <span class="price" + data-bind="text: $parents[1].getTaxAmount($parents[0], percent), attr: {'data-th': title, 'rowspan': $parents[0].rates.length }"></span> + <!-- /ko --> + <!-- ko ifnot: $parents[1].isCalculated() --> + <span class="not-calculated" + data-bind="text: $parents[1].getTaxAmount($parents[0], percent), attr: {'data-th': title, 'rowspan': $parents[0].rates.length }"></span> + <!-- /ko --> + </td> </tr> <!-- /ko --> <!-- /ko --> From 1bb672c15cd34956342ad0e6cafd6b8452bbae76 Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Mon, 28 Jan 2019 23:22:46 +0530 Subject: [PATCH 081/238] updated Download.php --- .../Magento/Downloadable/Helper/Download.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index 1afd7ab0ccf55..ed71056acef23 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -254,15 +254,17 @@ public function setResource($resourceFile, $linkType = self::LINK_TYPE_FILE) } } - /** - * check header - */ - $this->_resourceFile = $resourceFile; - $headers = array_change_key_case(get_headers($this->_resourceFile, 1), CASE_LOWER); - if(isset($headers['location'])){ - $this->_resourceFile = is_array($headers['location']) ? current($headers['location']): - $headers['location']; + + /** + * check header for urls + */ + if ($this->_linkType === self::LINK_TYPE_URL) { + $headers = array_change_key_case(get_headers($this->_resourceFile, 1), CASE_LOWER); + if(isset($headers['location'])){ + $this->_resourceFile = is_array($headers['location']) ? current($headers['location']): + $headers['location']; + } } $this->_linkType = $linkType; From 5ba9c1b8beca3ff3d27fd76de66cd59e10cb5f1f Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Mon, 28 Jan 2019 23:46:54 +0530 Subject: [PATCH 082/238] Updated Download.php --- app/code/Magento/Downloadable/Helper/Download.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index ed71056acef23..2b257d03a6564 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -259,7 +259,7 @@ public function setResource($resourceFile, $linkType = self::LINK_TYPE_FILE) /** * check header for urls */ - if ($this->_linkType === self::LINK_TYPE_URL) { + if ($linkType === self::LINK_TYPE_URL) { $headers = array_change_key_case(get_headers($this->_resourceFile, 1), CASE_LOWER); if(isset($headers['location'])){ $this->_resourceFile = is_array($headers['location']) ? current($headers['location']): From 070441da669c2810e21a3c174d2357d67a2e7f3b Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Mon, 28 Jan 2019 14:06:08 -0600 Subject: [PATCH 083/238] MC-4380: Convert UpdateInactiveCategoryEntityFlatDataTest to MFTF --- .../Catalog/Test/Mftf/Data/CategoryData.xml | 12 +++ ...iveFlatCategoryAndUpdateAsInactiveTest.xml | 88 ++++++++++++++++++ .../AdminCreateInactiveFlatCategoryTest.xml | 90 +++++++++++++++++++ ...inCreateInactiveInMenuFlatCategoryTest.xml | 89 ++++++++++++++++++ .../Section/AdminIndexManagementSection.xml | 3 + .../CreateCustomStoreViewActionGroup.xml | 15 ++++ .../Mftf/Section/StorefrontHeaderSection.xml | 1 + 7 files changed, 298 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveInMenuFlatCategoryTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml index 3a44148d24a31..b9ad464ab5cf6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml @@ -100,4 +100,16 @@ <data key="include_in_menu">true</data> <var key="parent_id" entityType="category" entityKey="id" /> </entity> + <entity name="CatNotIncludeInMenu" type="category"> + <data key="name" unique="suffix">NotInclMenu</data> + <data key="name_lwr" unique="suffix">notinclemenu</data> + <data key="is_active">true</data> + <data key="include_in_menu">false</data> + </entity> + <entity name="CatNotActive" type="category"> + <data key="name" unique="suffix">NotActive</data> + <data key="name_lwr" unique="suffix">notactive</data> + <data key="is_active">false</data> + <data key="include_in_menu">true</data> + </entity> </entities> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml new file mode 100644 index 0000000000000..4ea41f7fea95b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest"> + <annotations> + <stories value="Create category"/> + <title value="Flat Catalog - Update Inactive Category as Inactive, Should Not be Visible on Storefront"/> + <description value="Login as admin and create inactive flat category and update category as inactive and verify category is not visible in store front"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11009"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!--Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <!--Create category--> + <createData entity="CatNotActive" stepKey="createCategory"/> + <!-- Create First StoreView --> + <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewEn"> + <argument name="storeView" value="customStoreEN"/> + </actionGroup> + <!-- Create Second StoreView --> + <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <argument name="storeView" value="customStoreFR"/> + </actionGroup> + <!--Run full reindex and clear caches --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + <!--Enable Flat Catalog Category --> + <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/> + <!--Open Index Management Page and Select Index mode "Update by Schedule" --> + <magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" /> + <!-- Run cron twice --> + <magentoCLI command="cron:run" stepKey="runCron1"/> + <magentoCLI command="cron:run" stepKey="runCron2"/> + </before> + <after> + <deleteData stepKey="deleteCategory" createDataKey="createCategory"/> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewEn"> + <argument name="customStore" value="customStoreEN"/> + </actionGroup> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewFr"> + <argument name="customStore" value="customStoreFR"/> + </actionGroup> + <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Select created category and make category inactive--> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(CatNotActive.name)}}" stepKey="selectCreatedCategory"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory"/> + <waitForPageLoad stepKey="waitForSecondCategoryToSave"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/> + <see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{CatNotActive.name}}" stepKey="seeUpdatedCategoryTitle"/> + <dontSeeCheckboxIsChecked selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}" stepKey="verifyInactiveCategory"/> + <!--Run full reindex and clear caches --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + <!--Open Index Management Page --> + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="openIndexManagementPage"/> + <waitForPageLoad stepKey="waitForIndexPageToBeLoaded"/> + <see stepKey="seeIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="Ready"/> + <!--Verify Category In Store Front--> + <amOnPage url="/$$createCategory.name$$.html" stepKey="openCategoryPage1"/> + <waitForPageLoad stepKey="waitForCategoryStoreFrontPageToLoad"/> + <seeElement selector="{{StorefrontBundledSection.pageNotFound}}" stepKey="seeWhoopsOurBadMessage"/> + <!--Verify category is not visible in First Store View --> + <click stepKey="selectStoreSwitcher" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/> + <click stepKey="selectForstStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreEN.name)}}"/> + <waitForPageLoad stepKey="waitForFirstStoreView"/> + <dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="dontSeeCategoryOnNavigation"/> + <!--Verify category is not visible in Second Store View --> + <click stepKey="selectStoreSwitcher1" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/> + <click stepKey="selectSecondStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreFR.name)}}"/> + <waitForPageLoad stepKey="waitForSecondStoreView"/> + <dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="dontSeeCategoryOnNavigation1"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryTest.xml new file mode 100644 index 0000000000000..22fb2034be562 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryTest.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateInactiveFlatCategoryTest"> + <annotations> + <stories value="Create category"/> + <title value="Flat Catalog - Create Category as Inactive, Should Not be Visible on Storefront"/> + <description value="Login as admin and create flat Inactive category and verify category is not visible in store front"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11007"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!--Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <!--Create category--> + <createData entity="SimpleSubCategory" stepKey="createCategory"/> + <!-- Create First StoreView --> + <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewEn"> + <argument name="storeView" value="customStoreEN"/> + </actionGroup> + <!-- Create Second StoreView --> + <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <argument name="storeView" value="customStoreFR"/> + </actionGroup> + <!--Run full reindex and clear caches --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + <!--Enable Flat Catalog Category --> + <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/> + <!--Open Index Management Page and Select Index mode "Update by Schedule" --> + <magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" /> + <!-- Run cron twice --> + <magentoCLI command="cron:run" stepKey="runCron1"/> + <magentoCLI command="cron:run" stepKey="runCron2"/> + </before> + <after> + <deleteData stepKey="deleteCategory" createDataKey="createCategory"/> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewEn"> + <argument name="customStore" value="customStoreEN"/> + </actionGroup> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewFr"> + <argument name="customStore" value="customStoreFR"/> + </actionGroup> + <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Select created category and make category inactive--> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(SimpleSubCategory.name)}}" stepKey="selectCreatedCategory"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <click selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}" stepKey="disableActiveCategory"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory"/> + <waitForPageLoad stepKey="waitForSecondCategoryToSave"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/> + <see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{SimpleSubCategory.name}}" stepKey="seeUpdatedCategoryTitle"/> + <dontSeeCheckboxIsChecked selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}" stepKey="verifyInactiveIncludeInMenu"/> + <!--Run full reindex and clear caches --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + <!--Open Index Management Page --> + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="openIndexManagementPage"/> + <waitForPageLoad stepKey="waitForIndexPageToBeLoaded"/> + <see stepKey="seeIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="Ready"/> + <!--Verify Category In Store Front--> + <amOnPage url="/$$createCategory.name$$.html" stepKey="openCategoryPage1"/> + <waitForPageLoad stepKey="waitForCategoryStoreFrontPageToLoad"/> + <!--Verify category is not visible in First Store View --> + <click stepKey="selectStoreSwitcher" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/> + <click stepKey="selectForstStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreEN.name)}}"/> + <waitForPageLoad stepKey="waitForFirstStoreView"/> + <dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="dontSeeCategoryOnNavigation"/> + <seeElement selector="{{StorefrontBundledSection.pageNotFound}}" stepKey="seeWhoopsOurBadMessage"/> + <!--Verify category is not visible in Second Store View --> + <click stepKey="selectStoreSwitcher1" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/> + <click stepKey="selectSecondStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreFR.name)}}"/> + <waitForPageLoad stepKey="waitForSecondstoreView"/> + <dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="dontSeeCategoryOnNavigation1"/> + <seeElement selector="{{StorefrontBundledSection.pageNotFound}}" stepKey="seeWhoopsOurBadMessage1"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveInMenuFlatCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveInMenuFlatCategoryTest.xml new file mode 100644 index 0000000000000..4046c81d32981 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveInMenuFlatCategoryTest.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateInactiveInMenuFlatCategoryTest"> + <annotations> + <stories value="Create category"/> + <title value="Flat Catalog - Exclude Category from Navigation Menu"/> + <description value="Login as admin and create inactive Include In Menu flat category and verify category is not displayed in Navigation Menu"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11008"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!--Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <!--Create category--> + <createData entity="SimpleSubCategory" stepKey="category"/> + <!-- Create First StoreView --> + <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewEn"> + <argument name="storeView" value="customStoreEN"/> + </actionGroup> + <!-- Create Second StoreView --> + <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <argument name="storeView" value="customStoreFR"/> + </actionGroup> + <!--Run full reindex and clear caches --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + <!--Enable Flat Catalog Category --> + <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/> + <!--Open Index Management Page and Select Index mode "Update by Schedule" --> + <magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" /> + <!-- Run cron twice --> + <magentoCLI command="cron:run" stepKey="runCron1"/> + <magentoCLI command="cron:run" stepKey="runCron2"/> + </before> + <after> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewEn"> + <argument name="customStore" value="customStoreEN"/> + </actionGroup> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewFr"> + <argument name="customStore" value="customStoreFR"/> + </actionGroup> + <deleteData createDataKey="category" stepKey="deleteCategory"/> + <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Select created category and disable Include In Menu option--> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(SimpleSubCategory.name)}}" stepKey="selectCreatedCategory"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <click selector="{{AdminCategoryBasicFieldSection.includeInMenuLabel}}" stepKey="disableIcludeInMenuOption"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory"/> + <waitForPageLoad stepKey="waitForSecondCategoryToSave"/> + <!--Verify category is saved and Include In Menu Option is disabled in Category Page --> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/> + <see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{SimpleSubCategory.name}}" stepKey="seeUpdatedCategoryTitle"/> + <dontSeeCheckboxIsChecked selector="{{AdminCategoryBasicFieldSection.includeInMenuLabel}}" stepKey="verifyInactiveIncludeInMenu"/> + <!--Run full reindex and clear caches --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + <!--Open Index Management Page --> + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="openIndexManagementPage"/> + <waitForPageLoad stepKey="waitForIndexPageToBeLoaded"/> + <see stepKey="seeIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="Ready"/> + <!--Verify Category In Store Front--> + <amOnPage url="/$$category.name$$.html" stepKey="openCategoryPage1"/> + <waitForPageLoad stepKey="waitForCategoryStoreFrontPageToLoad"/> + <!--Verify category is not displayed in navigation menu in First Store View --> + <click stepKey="selectStoreSwitcher" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/> + <click stepKey="selectForstStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreEN.name)}}"/> + <waitForPageLoad stepKey="waitForFirstStoreView"/> + <dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$category.name$$)}}" stepKey="seeCategoryOnNavigation"/> + <!--Verify category is not displayed in navigation menu in Second Store View --> + <click stepKey="selectStoreSwitcher1" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/> + <click stepKey="selectSecondStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreFR.name)}}"/> + <waitForPageLoad stepKey="waitForSecondstoreView"/> + <dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$category.name$$)}}" stepKey="seeCategoryOnNavigation1"/> + </test> +</tests> diff --git a/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml b/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml index db98116c224dd..99d1fb840e691 100644 --- a/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml +++ b/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml @@ -13,5 +13,8 @@ <element name="indexerCheckbox" type="checkbox" selector="input[value='{{var1}}']" parameterized="true"/> <element name="massActionSelect" type="select" selector="#gridIndexer_massaction-select"/> <element name="massActionSubmit" type="button" selector="#gridIndexer_massaction-form button"/> + <element name="indexerSelect" type="select" selector="//select[@class='action-select-multiselect']"/> + <element name="indexerStatus" type="text" selector="//tr[descendant::td[contains(., '{{status}}')]]//*[contains(@class, 'col-indexer_status')]/span" parameterized="true"/> + <element name="successMessage" type="text" selector="//*[@data-ui-id='messages-message-success']"/> </section> </sections> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml index 31bbe7550e5a1..9f80bec905b01 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml @@ -21,4 +21,19 @@ <waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton" /> <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/> </actionGroup> + <actionGroup name="CreateStoreView"> + <arguments> + <argument name="storeView" defaultValue="customStore"/> + </arguments> + <amOnPage url="{{AdminSystemStoreViewPage.url}}" stepKey="amOnAdminSystemStoreViewPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <selectOption userInput="Main Website Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/> + <fillField userInput="{{storeView.name}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/> + <fillField userInput="{{storeView.code}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/> + <selectOption userInput="Enabled" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/> + <click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/> + <waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton" /> + <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/> + <see userInput="You saved the store view." stepKey="seeSavedMessage"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/Section/StorefrontHeaderSection.xml b/app/code/Magento/Store/Test/Mftf/Section/StorefrontHeaderSection.xml index af18e858e1057..c63bd5f48f9d1 100644 --- a/app/code/Magento/Store/Test/Mftf/Section/StorefrontHeaderSection.xml +++ b/app/code/Magento/Store/Test/Mftf/Section/StorefrontHeaderSection.xml @@ -11,5 +11,6 @@ <element name="storeViewSwitcher" type="button" selector="#switcher-language-trigger"/> <element name="storeViewDropdown" type="button" selector="ul.switcher-dropdown"/> <element name="storeViewOption" type="button" selector="li.view-{{var1}}>a" parameterized="true"/> + <element name="storeViewList" type="button" selector="//li[contains(.,'{{storeViewName}}')]/a" parameterized="true"/> </section> </sections> From d6b100028f3c17a220015c44dde309c83557c4fa Mon Sep 17 00:00:00 2001 From: niravkrish <nirav.patel@krishtechnolabs.com> Date: Tue, 29 Jan 2019 09:56:40 +0530 Subject: [PATCH 084/238] Fixed travis changes --- .../Tax/view/frontend/web/js/view/checkout/summary/tax.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js index c66062adb7bb7..d72bfa0f4c8ac 100644 --- a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js +++ b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js @@ -112,8 +112,9 @@ define([ rates = parent.rates; totalPercentage = 0; _.each(rates, function (rate) { - totalPercentage += parseFloat(rate.percent); + totalPercentage += parseFloat(rate.percent); }); + return this.getFormattedPrice(this.getPercerntAmount(amount, totalPercentage, percentage)); }, From 8e4c9ad3ce91dad42d5d22a60438d97fdf7d0380 Mon Sep 17 00:00:00 2001 From: niravkrish <nirav.patel@krishtechnolabs.com> Date: Tue, 29 Jan 2019 10:00:08 +0530 Subject: [PATCH 085/238] changes suggested by reviewer --- .../Tax/view/frontend/web/js/view/checkout/summary/tax.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js index d72bfa0f4c8ac..4db32b685733d 100644 --- a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js +++ b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js @@ -120,12 +120,12 @@ define([ /** * @param {*} amount - * @param {*} totalper - * @param {*} per + * @param {*} totalPercentage + * @param {*} percentage * @return {*|String} */ - getPercerntAmount: function (amount, totalper, per) { - return parseFloat((amount * per) / totalper); + getPercerntAmount: function (amount, totalPercentage, percentage) { + return parseFloat((amount * percentage) / totalPercentage); }, /** From 11b9b442109f13db51e9da589f42c57f42793c0d Mon Sep 17 00:00:00 2001 From: David Verholen <david@verholen.com> Date: Tue, 29 Jan 2019 08:17:13 +0100 Subject: [PATCH 086/238] fix typo Percernt -> Percent --- .../Tax/view/frontend/web/js/view/checkout/summary/tax.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js index 4db32b685733d..94850423e5977 100644 --- a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js +++ b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js @@ -115,7 +115,7 @@ define([ totalPercentage += parseFloat(rate.percent); }); - return this.getFormattedPrice(this.getPercerntAmount(amount, totalPercentage, percentage)); + return this.getFormattedPrice(this.getPercentAmount(amount, totalPercentage, percentage)); }, /** @@ -124,7 +124,7 @@ define([ * @param {*} percentage * @return {*|String} */ - getPercerntAmount: function (amount, totalPercentage, percentage) { + getPercentAmount: function (amount, totalPercentage, percentage) { return parseFloat((amount * percentage) / totalPercentage); }, From 2a65cc64afcdfce509c26d64401a47b9b4724a62 Mon Sep 17 00:00:00 2001 From: Sergey Shvets <sshvets@magento.com> Date: Tue, 29 Jan 2019 18:41:17 +0200 Subject: [PATCH 087/238] =?UTF-8?q?MAGETWO-96983:=20M2.3=20=E2=80=93=20Sod?= =?UTF-8?q?ium=20crypto=20adapter=20errors=20on=20unexpected=20input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Encryption/Adapter/SodiumChachaIetf.php | 3 +- .../Unit/Adapter/SodiumChachaIetfTest.php | 29 ++++-- .../_files/_sodium_chachaieft_fixtures.php | 10 ++ .../Encryption/Test/Unit/EncryptorTest.php | 96 ++++++++++--------- 4 files changed, 83 insertions(+), 55 deletions(-) diff --git a/lib/internal/Magento/Framework/Encryption/Adapter/SodiumChachaIetf.php b/lib/internal/Magento/Framework/Encryption/Adapter/SodiumChachaIetf.php index 9f9facf98ff84..1ed95731db755 100644 --- a/lib/internal/Magento/Framework/Encryption/Adapter/SodiumChachaIetf.php +++ b/lib/internal/Magento/Framework/Encryption/Adapter/SodiumChachaIetf.php @@ -33,6 +33,7 @@ public function __construct( * * @param string $data * @return string string + * @throws \SodiumException */ public function encrypt(string $data): string { @@ -65,6 +66,6 @@ public function decrypt(string $data): string $this->key ); - return $plainText; + return $plainText !== false ? $plainText : ''; } } diff --git a/lib/internal/Magento/Framework/Encryption/Test/Unit/Adapter/SodiumChachaIetfTest.php b/lib/internal/Magento/Framework/Encryption/Test/Unit/Adapter/SodiumChachaIetfTest.php index 8092ce55b42c8..f90cd4eea5a82 100644 --- a/lib/internal/Magento/Framework/Encryption/Test/Unit/Adapter/SodiumChachaIetfTest.php +++ b/lib/internal/Magento/Framework/Encryption/Test/Unit/Adapter/SodiumChachaIetfTest.php @@ -11,13 +11,17 @@ */ namespace Magento\Framework\Encryption\Test\Unit\Adapter; -class SodiumChachaIetfTest extends \PHPUnit\Framework\TestCase +use Magento\Framework\Encryption\Adapter\SodiumChachaIetf; +use PHPUnit\Framework\TestCase; + +class SodiumChachaIetfTest extends TestCase { + /** + * @return array + */ public function getCryptData(): array { - $fixturesFilename = __DIR__ . '/../Crypt/_files/_sodium_chachaieft_fixtures.php'; - - $result = include $fixturesFilename; + $result = include __DIR__ . '/../Crypt/_files/_sodium_chachaieft_fixtures.php'; /* Restore encoded string back to binary */ foreach ($result as &$cryptParams) { $cryptParams['encrypted'] = base64_decode($cryptParams['encrypted']); @@ -29,10 +33,15 @@ public function getCryptData(): array /** * @dataProvider getCryptData + * + * @param string $key + * @param string $encrypted + * @param string $decrypted + * @throws \SodiumException */ - public function testEncrypt(string $key, string $encrypted, string $decrypted) + public function testEncrypt(string $key, string $encrypted, string $decrypted): void { - $crypt = new \Magento\Framework\Encryption\Adapter\SodiumChachaIetf($key); + $crypt = new SodiumChachaIetf($key); $result = $crypt->encrypt($decrypted); $this->assertNotEquals($encrypted, $result); @@ -40,10 +49,14 @@ public function testEncrypt(string $key, string $encrypted, string $decrypted) /** * @dataProvider getCryptData + * + * @param string $key + * @param string $encrypted + * @param string $decrypted */ - public function testDecrypt(string $key, string $encrypted, string $decrypted) + public function testDecrypt(string $key, string $encrypted, string $decrypted): void { - $crypt = new \Magento\Framework\Encryption\Adapter\SodiumChachaIetf($key); + $crypt = new SodiumChachaIetf($key); $result = $crypt->decrypt($encrypted); $this->assertEquals($decrypted, $result); diff --git a/lib/internal/Magento/Framework/Encryption/Test/Unit/Crypt/_files/_sodium_chachaieft_fixtures.php b/lib/internal/Magento/Framework/Encryption/Test/Unit/Crypt/_files/_sodium_chachaieft_fixtures.php index 7917bd9ba83e8..8498f9a1a873f 100644 --- a/lib/internal/Magento/Framework/Encryption/Test/Unit/Crypt/_files/_sodium_chachaieft_fixtures.php +++ b/lib/internal/Magento/Framework/Encryption/Test/Unit/Crypt/_files/_sodium_chachaieft_fixtures.php @@ -32,4 +32,14 @@ 'encrypted' => 'UglO9dEgslFpwPwejJmrK89PmBicv+I1pfdaXaEI69IrETD8LpdzOLF7', 'decrypted' => 'Hello World!!!', ], + 5 => [ + 'key' => '6wRADHwwCBGgdxbcHhovGB0upmg0mbsN', + 'encrypted' => '', + 'decrypted' => '', + ], + 6 => [ + 'key' => '6wRADHwwCBGgdxbcHhovGB0upmg0mbsN', + 'encrypted' => 'bWFsZm9ybWVkLWlucHV0', + 'decrypted' => '', + ], ]; diff --git a/lib/internal/Magento/Framework/Encryption/Test/Unit/EncryptorTest.php b/lib/internal/Magento/Framework/Encryption/Test/Unit/EncryptorTest.php index 98bb1c5676d6c..e3a0ac7a9394e 100644 --- a/lib/internal/Magento/Framework/Encryption/Test/Unit/EncryptorTest.php +++ b/lib/internal/Magento/Framework/Encryption/Test/Unit/EncryptorTest.php @@ -8,38 +8,42 @@ namespace Magento\Framework\Encryption\Test\Unit; -use Magento\Framework\Encryption\Adapter\Mcrypt; +use Magento\Framework\App\DeploymentConfig; use Magento\Framework\Encryption\Adapter\SodiumChachaIetf; -use Magento\Framework\Encryption\Encryptor; use Magento\Framework\Encryption\Crypt; +use Magento\Framework\Encryption\Encryptor; +use Magento\Framework\Math\Random; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -class EncryptorTest extends \PHPUnit\Framework\TestCase +class EncryptorTest extends TestCase { - const CRYPT_KEY_1 = 'g9mY9KLrcuAVJfsmVUSRkKFLDdUPVkaZ'; - const CRYPT_KEY_2 = '7wEjmrliuqZQ1NQsndSa8C8WHvddeEbN'; + private const CRYPT_KEY_1 = 'g9mY9KLrcuAVJfsmVUSRkKFLDdUPVkaZ'; + private const CRYPT_KEY_2 = '7wEjmrliuqZQ1NQsndSa8C8WHvddeEbN'; /** - * @var \Magento\Framework\Encryption\Encryptor + * @var Encryptor */ protected $_model; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Random | MockObject */ protected $_randomGenerator; protected function setUp() { - $this->_randomGenerator = $this->createMock(\Magento\Framework\Math\Random::class); - $deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class); - $deploymentConfigMock->expects($this->any()) + $this->_randomGenerator = $this->createMock(Random::class); + /** @var DeploymentConfig | MockObject $deploymentConfigMock */ + $deploymentConfigMock = $this->createMock(DeploymentConfig::class); + $deploymentConfigMock ->method('get') ->with(Encryptor::PARAM_CRYPT_KEY) - ->will($this->returnValue(self::CRYPT_KEY_1)); - $this->_model = new \Magento\Framework\Encryption\Encryptor($this->_randomGenerator, $deploymentConfigMock); + ->willReturn(self::CRYPT_KEY_1); + $this->_model = new Encryptor($this->_randomGenerator, $deploymentConfigMock); } - public function testGetHashNoSalt() + public function testGetHashNoSalt(): void { $this->_randomGenerator->expects($this->never())->method('getRandomString'); $expected = '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8'; @@ -47,7 +51,7 @@ public function testGetHashNoSalt() $this->assertEquals($expected, $actual); } - public function testGetHashSpecifiedSalt() + public function testGetHashSpecifiedSalt(): void { $this->_randomGenerator->expects($this->never())->method('getRandomString'); $expected = '13601bda4ea78e55a07b98866d2be6be0744e3866f13c00c811cab608a28f322:salt:1'; @@ -55,26 +59,26 @@ public function testGetHashSpecifiedSalt() $this->assertEquals($expected, $actual); } - public function testGetHashRandomSaltDefaultLength() + public function testGetHashRandomSaltDefaultLength(): void { $salt = '-----------random_salt----------'; $this->_randomGenerator ->expects($this->once()) ->method('getRandomString') ->with(32) - ->will($this->returnValue($salt)); + ->willReturn($salt); $expected = 'a1c7fc88037b70c9be84d3ad12522c7888f647915db78f42eb572008422ba2fa:' . $salt . ':1'; $actual = $this->_model->getHash('password', true); $this->assertEquals($expected, $actual); } - public function testGetHashRandomSaltSpecifiedLength() + public function testGetHashRandomSaltSpecifiedLength(): void { $this->_randomGenerator ->expects($this->once()) ->method('getRandomString') ->with(11) - ->will($this->returnValue('random_salt')); + ->willReturn('random_salt'); $expected = '4c5cab8dd00137d11258f8f87b93fd17bd94c5026fc52d3c5af911dd177a2611:random_salt:1'; $actual = $this->_model->getHash('password', 11); $this->assertEquals($expected, $actual); @@ -87,7 +91,7 @@ public function testGetHashRandomSaltSpecifiedLength() * * @dataProvider validateHashDataProvider */ - public function testValidateHash($password, $hash, $expected) + public function testValidateHash($password, $hash, $expected): void { $actual = $this->_model->validateHash($password, $hash); $this->assertEquals($expected, $actual); @@ -96,7 +100,7 @@ public function testValidateHash($password, $hash, $expected) /** * @return array */ - public function validateHashDataProvider() + public function validateHashDataProvider(): array { return [ ['password', 'hash:salt:1', false], @@ -111,13 +115,13 @@ public function validateHashDataProvider() * @dataProvider encryptWithEmptyKeyDataProvider * @expectedException \SodiumException */ - public function testEncryptWithEmptyKey($key) + public function testEncryptWithEmptyKey($key): void { - $deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class); + $deploymentConfigMock = $this->createMock(DeploymentConfig::class); $deploymentConfigMock->expects($this->any()) ->method('get') ->with(Encryptor::PARAM_CRYPT_KEY) - ->will($this->returnValue($key)); + ->willReturn($key); $model = new Encryptor($this->_randomGenerator, $deploymentConfigMock); $value = 'arbitrary_string'; $this->assertEquals($value, $model->encrypt($value)); @@ -136,13 +140,14 @@ public function encryptWithEmptyKeyDataProvider() * * @dataProvider decryptWithEmptyKeyDataProvider */ - public function testDecryptWithEmptyKey($key) + public function testDecryptWithEmptyKey($key): void { - $deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class); + /** @var DeploymentConfig | MockObject $deploymentConfigMock */ + $deploymentConfigMock = $this->createMock(DeploymentConfig::class); $deploymentConfigMock->expects($this->any()) ->method('get') ->with(Encryptor::PARAM_CRYPT_KEY) - ->will($this->returnValue($key)); + ->willReturn($key); $model = new Encryptor($this->_randomGenerator, $deploymentConfigMock); $value = 'arbitrary_string'; $this->assertEquals('', $model->decrypt($value)); @@ -151,12 +156,12 @@ public function testDecryptWithEmptyKey($key) /** * @return array */ - public function decryptWithEmptyKeyDataProvider() + public function decryptWithEmptyKeyDataProvider(): array { return [[null], [0], [''], ['0']]; } - public function testEncrypt() + public function testEncrypt(): void { // sample data to encrypt $data = 'Mares eat oats and does eat oats, but little lambs eat ivy.'; @@ -164,15 +169,14 @@ public function testEncrypt() $actual = $this->_model->encrypt($data); // Extract the initialization vector and encrypted data - $parts = explode(':', $actual, 3); - list(, , $encryptedData) = $parts; + [, , $encryptedData] = explode(':', $actual, 3); $crypt = new SodiumChachaIetf(self::CRYPT_KEY_1); // Verify decrypted matches original data $this->assertEquals($data, $crypt->decrypt(base64_decode((string)$encryptedData))); } - public function testDecrypt() + public function testDecrypt(): void { $message = 'Mares eat oats and does eat oats, but little lambs eat ivy.'; $encrypted = $this->_model->encrypt($message); @@ -180,7 +184,7 @@ public function testDecrypt() $this->assertEquals($message, $this->_model->decrypt($encrypted)); } - public function testLegacyDecrypt() + public function testLegacyDecrypt(): void { // sample data to encrypt $data = '0:2:z3a4ACpkU35W6pV692U4ueCVQP0m0v0p:' . @@ -189,8 +193,7 @@ public function testLegacyDecrypt() $actual = $this->_model->decrypt($data); // Extract the initialization vector and encrypted data - $parts = explode(':', $data, 4); - list(, , $iv, $encrypted) = $parts; + [, , $iv, $encrypted] = explode(':', $data, 4); // Decrypt returned data with RIJNDAEL_256 cipher, cbc mode $crypt = new Crypt(self::CRYPT_KEY_1, MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC, $iv); @@ -198,17 +201,18 @@ public function testLegacyDecrypt() $this->assertEquals($encrypted, base64_encode($crypt->encrypt($actual))); } - public function testEncryptDecryptNewKeyAdded() + public function testEncryptDecryptNewKeyAdded(): void { - $deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class); + /** @var DeploymentConfig | MockObject $deploymentConfigMock */ + $deploymentConfigMock = $this->createMock(DeploymentConfig::class); $deploymentConfigMock->expects($this->at(0)) ->method('get') ->with(Encryptor::PARAM_CRYPT_KEY) - ->will($this->returnValue(self::CRYPT_KEY_1)); + ->willReturn(self::CRYPT_KEY_1); $deploymentConfigMock->expects($this->at(1)) ->method('get') ->with(Encryptor::PARAM_CRYPT_KEY) - ->will($this->returnValue(self::CRYPT_KEY_1 . "\n" . self::CRYPT_KEY_2)); + ->willReturn(self::CRYPT_KEY_1 . "\n" . self::CRYPT_KEY_2); $model1 = new Encryptor($this->_randomGenerator, $deploymentConfigMock); // simulate an encryption key is being added $model2 = new Encryptor($this->_randomGenerator, $deploymentConfigMock); @@ -222,7 +226,7 @@ public function testEncryptDecryptNewKeyAdded() $this->assertSame($data, $decryptedData, 'Encryptor failed to decrypt data encrypted by old keys.'); } - public function testValidateKey() + public function testValidateKey(): void { $this->_model->validateKey(self::CRYPT_KEY_1); } @@ -230,7 +234,7 @@ public function testValidateKey() /** * @expectedException \Exception */ - public function testValidateKeyInvalid() + public function testValidateKeyInvalid(): void { $this->_model->validateKey('----- '); } @@ -238,17 +242,17 @@ public function testValidateKeyInvalid() /** * @return array */ - public function useSpecifiedHashingAlgoDataProvider() + public function useSpecifiedHashingAlgoDataProvider(): array { return [ ['password', 'salt', Encryptor::HASH_VERSION_MD5, - '67a1e09bb1f83f5007dc119c14d663aa:salt:0'], + '67a1e09bb1f83f5007dc119c14d663aa:salt:0'], ['password', 'salt', Encryptor::HASH_VERSION_SHA256, - '13601bda4ea78e55a07b98866d2be6be0744e3866f13c00c811cab608a28f322:salt:1'], + '13601bda4ea78e55a07b98866d2be6be0744e3866f13c00c811cab608a28f322:salt:1'], ['password', false, Encryptor::HASH_VERSION_MD5, - '5f4dcc3b5aa765d61d8327deb882cf99'], + '5f4dcc3b5aa765d61d8327deb882cf99'], ['password', false, Encryptor::HASH_VERSION_SHA256, - '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8'] + '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8'] ]; } @@ -260,7 +264,7 @@ public function useSpecifiedHashingAlgoDataProvider() * @param $hashAlgo * @param $expected */ - public function testGetHashMustUseSpecifiedHashingAlgo($password, $salt, $hashAlgo, $expected) + public function testGetHashMustUseSpecifiedHashingAlgo($password, $salt, $hashAlgo, $expected): void { $hash = $this->_model->getHash($password, $salt, $hashAlgo); $this->assertEquals($expected, $hash); From 47a53b5039027850902d14d34edcff8b1d6ad686 Mon Sep 17 00:00:00 2001 From: niravkrish <nirav.patel@krishtechnolabs.com> Date: Wed, 30 Jan 2019 16:32:02 +0530 Subject: [PATCH 088/238] Remove White Space --- .../Tax/view/frontend/web/js/view/checkout/summary/tax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js index 94850423e5977..a4ceec3819680 100644 --- a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js +++ b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js @@ -114,7 +114,7 @@ define([ _.each(rates, function (rate) { totalPercentage += parseFloat(rate.percent); }); - + return this.getFormattedPrice(this.getPercentAmount(amount, totalPercentage, percentage)); }, From 1c6138cf67cda426d6472560d3347eff62dac69e Mon Sep 17 00:00:00 2001 From: niravkrish <nirav.patel@krishtechnolabs.com> Date: Wed, 30 Jan 2019 18:57:29 +0530 Subject: [PATCH 089/238] change variable name --- .../web/js/view/checkout/summary/tax.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js index a4ceec3819680..d65c0ffbf499c 100644 --- a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js +++ b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js @@ -20,9 +20,8 @@ define([ var isTaxDisplayedInGrandTotal = window.checkoutConfig.includeTaxInGrandTotal, isFullTaxSummaryDisplayed = window.checkoutConfig.isFullTaxSummaryDisplayed, isZeroTaxDisplayed = window.checkoutConfig.isZeroTaxDisplayed, - totalPercentage = 0, - amount = '', - rates = ''; + taxAmount = 0, + rates = 0; return Component.extend({ defaults: { @@ -108,24 +107,24 @@ define([ * @return {*|String} */ getTaxAmount: function (parent, percentage) { - amount = parent.amount; + var totalPercentage = 0; + taxAmount = parent.amount; rates = parent.rates; - totalPercentage = 0; _.each(rates, function (rate) { totalPercentage += parseFloat(rate.percent); }); - return this.getFormattedPrice(this.getPercentAmount(amount, totalPercentage, percentage)); + return this.getFormattedPrice(this.getPercentAmount(taxAmount, totalPercentage, percentage)); }, /** - * @param {*} amount + * @param {*} taxAmount * @param {*} totalPercentage * @param {*} percentage * @return {*|String} */ - getPercentAmount: function (amount, totalPercentage, percentage) { - return parseFloat((amount * percentage) / totalPercentage); + getPercentAmount: function (taxAmount, totalPercentage, percentage) { + return parseFloat((taxAmount * percentage) / totalPercentage); }, /** From 3ed18ef9b707673896e1bfab8c26da349d9a26a6 Mon Sep 17 00:00:00 2001 From: John S <john00ivy@gmail.com> Date: Wed, 30 Jan 2019 10:22:51 -0600 Subject: [PATCH 090/238] MC-4397: Convert AdminNavigateMultipleUpSellProductsTest to MFTF - Fixing spacing/URN issues in Test files. - Replacing "waitForLoadingMaskToDisappear" with "waitForPageLoad". - Adjusting selector slightly to clean it up. --- .../Mftf/Section/AdminProductGridSection.xml | 4 ++-- .../AdminNavigateMultipleUpSellProductsTest.xml | 16 +++++++++------- .../Test/EndToEndB2CGuestUserTest.xml | 4 ++-- .../Test/EndToEndB2CLoggedInUserTest.xml | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml index 30d1088303214..02bdbac313076 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml @@ -8,8 +8,8 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminProductGridSection"> - <element name="productRowBySku" type="block" selector="//div[@id='container']//tr//td[count(../../..//th[./*[.='SKU']]/preceding-sibling::th) + 1][./*[.='{{sku}}']]" parameterized="true" /> - <element name="productRowCheckboxBySku" type="block" selector="//div[@id='container']//tr//td[count(../../..//th[./*[.='SKU']]/preceding-sibling::th) + 1][./*[.='{{sku}}']]/../td//input[@data-action='select-row']" parameterized="true" /> + <element name="productRowBySku" type="block" selector="//td[count(../../..//th[./*[.='SKU']]/preceding-sibling::th) + 1][./*[.='{{sku}}']]" parameterized="true" /> + <element name="productRowCheckboxBySku" type="block" selector="//td[count(../../..//th[./*[.='SKU']]/preceding-sibling::th) + 1][./*[.='{{sku}}']]/../td//input[@data-action='select-row']" parameterized="true" /> <element name="loadingMask" type="text" selector=".admin__data-grid-loading-mask[data-component*='product_listing']"/> <element name="columnHeader" type="button" selector="//div[@data-role='grid-wrapper']//table[contains(@class, 'data-grid')]/thead/tr/th[contains(@class, 'data-grid-th')]/span[text() = '{{label}}']" parameterized="true" timeout="30"/> <element name="column" type="text" selector="//tr//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., '{{column}}')]/preceding-sibling::th) +1 ]" parameterized="true"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml index 97e3898ea1b66..202787850db6c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml @@ -19,9 +19,6 @@ </annotations> <before> - <!--Login as admin--> - <actionGroup ref="LoginAsAdmin" stepKey="login"/> - <!--Create Simple Products--> <createData entity="SimpleSubCategory" stepKey="createCategory1"/> <createData entity="SimpleProduct" stepKey="createSimpleProduct"> @@ -75,8 +72,14 @@ <requiredEntity createDataKey="createConfigProduct"/> <requiredEntity createDataKey="createConfigChildProduct2"/> </createData> + + <!--Login as admin--> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> + <!--Logout as admin--> + <actionGroup ref="logout" stepKey="logout"/> + <!--Delete created data--> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> <deleteData createDataKey="createSimpleProduct1" stepKey="deleteSimpleProduct1"/> @@ -87,9 +90,8 @@ <deleteData createDataKey="createConfigChildProduct2" stepKey="deletecreateConfigChildProduct2"/> <deleteData createDataKey="createConfigChildProduct1" stepKey="deletecreateConfigChildProduct1"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> - - <actionGroup ref="logout" stepKey="logout"/> </after> + <!--Open Product Index Page--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> @@ -118,7 +120,7 @@ <waitForPageLoad stepKey="waitForConfigProductToBeAdded"/> <click stepKey="clickOnRelatedProducts1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedProductsHeader}}"/> <click stepKey="clickOnSaveButton" selector="{{AdminProductFormActionSection.saveButton}}"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoading"/> + <waitForPageLoad stepKey="waitForLoading1"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> <!--Go to Product Index Page --> @@ -141,7 +143,7 @@ <waitForPageLoad stepKey="waitForSimpleProductToBeAdded"/> <scrollTo selector="{{AdminProductFormActionSection.saveButton}}" stepKey="scrollToTheSaveButton"/> <click stepKey="clickOnSaveButton1" selector="{{AdminProductFormActionSection.saveButton}}"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoading1"/> + <waitForPageLoad stepKey="waitForLoading2"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown1"/> <waitForPageLoad stepKey="waitForUpdatesTobeSaved1"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CGuestUserTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CGuestUserTest.xml index f5cd41bda74d7..f0bfec543f281 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CGuestUserTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CGuestUserTest.xml @@ -7,7 +7,7 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="EndToEndB2CGuestUserTest"> <!-- Search configurable product --> <comment userInput="Search configurable product" stepKey="commentSearchConfigurableProduct" after="searchAssertSimpleProduct2ImageNotDefault" /> @@ -26,5 +26,5 @@ <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> <grabAttributeFrom selector="{{StorefrontProductInfoMainSection.productImage}}" userInput="src" stepKey="searchGrabConfigProductPageImageSrc" after="searchAssertConfigProductPage"/> <assertNotRegExp expected="'/placeholder\/image\.jpg/'" actual="$searchGrabConfigProductPageImageSrc" stepKey="searchAssertConfigProductPageImageNotDefault" after="searchGrabConfigProductPageImageSrc"/> - </test> + </test> </tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CLoggedInUserTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CLoggedInUserTest.xml index 3e386a034eecc..9fe70c8b4dd3b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CLoggedInUserTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CLoggedInUserTest.xml @@ -7,7 +7,7 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="EndToEndB2CLoggedInUserTest"> <!-- Search configurable product --> <comment userInput="Search configurable product" stepKey="commentSearchConfigurableProduct" after="searchAssertSimpleProduct2ImageNotDefault" /> From 1f2eba2411b230813a8911a21ca639c120e216c1 Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Wed, 30 Jan 2019 11:21:52 -0600 Subject: [PATCH 091/238] MC-4386: Convert ManageProductsStockTest to MFTF --- ...minProductFormAdvancedInventorySection.xml | 8 ++ .../Section/StorefrontCategoryMainSection.xml | 1 + .../AdminAddInStockProductToTheCartTest.xml | 84 +++++++++++++++++++ ...StockProductIsNotVisibleInCategoryTest.xml | 72 ++++++++++++++++ ...tOfStockProductIsVisibleInCategoryTest.xml | 70 ++++++++++++++++ 5 files changed, 235 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml index a1bb27bb45a29..0fdddc0331396 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml @@ -19,6 +19,14 @@ <element name="doneButton" type="button" selector="//aside[contains(@class,'product_form_product_form_advanced_inventory_modal')]//button[contains(@data-role,'action')]" timeout="5"/> <element name="useConfigSettings" type="checkbox" selector="//input[@name='product[stock_data][use_config_manage_stock]']"/> <element name="manageStock" type="select" selector="//*[@name='product[stock_data][manage_stock]']"/> + <element name="miniQtyConfigSetting" type="checkbox" selector="//*[@name='product[stock_data][use_config_min_sale_qty]']"/> + <element name="miniQtyAllowedInCart" type="input" selector="//*[@name='product[stock_data][min_sale_qty]']"/> + <element name="maxiQtyConfigSetting" type="checkbox" selector="//*[@name='product[stock_data][use_config_max_sale_qty]']"/> + <element name="maxiQtyAllowedInCart" type="input" selector="//*[@name='product[stock_data][max_sale_qty]']"/> + <element name="notifyBelowQtyConfigSetting" type="checkbox" selector="//*[@name='product[stock_data][use_config_notify_stock_qty]']"/> + <element name="notifyBelowQty" type="input" selector="//*[@name='product[stock_data][notify_stock_qty]']"/> + <element name="advancedInventoryQty" type="input" selector="//div[@class='modal-inner-wrap']//input[@name='product[quantity_and_stock_status][qty]']"/> + <element name="advancedInventoryStockStatus" type="select" selector="//div[@class='modal-inner-wrap']//select[@name='product[quantity_and_stock_status][is_in_stock]']"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml index 03566be55ad2f..a91e1cca37b87 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml @@ -29,5 +29,6 @@ <element name="categoryImage" type="text" selector=".category-image"/> <element name="emptyProductMessage" type="block" selector=".message.info.empty>div"/> <element name="lineProductName" type="text" selector=".products.list.items.product-items li:nth-of-type({{line}}) .product-item-link" timeout="30" parameterized="true"/> + <element name="productName" type="text" selector=".product.name.product-item-name"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml new file mode 100644 index 0000000000000..bc91e394f25c1 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminAddInStockProductToTheCartTest"> + <annotations> + <stories value="Manage products"/> + <title value="Add In Stock Product to Cart"/> + <description value="Login as admin and add In Stock product to the cart"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11065"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <!--Create Category--> + <createData entity="SimpleSubCategory" stepKey="createCategory"/> + <!--Create Simple Product--> + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <!--Delete created entity --> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Open Product Index Page--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <!-- Update product Advanced Inventory setting --> + <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> + <waitForPageLoad stepKey="waitForProductToLoad"/> + <click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/> + <waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/> + <uncheckOption selector="{{AdminProductFormAdvancedInventorySection.useConfigSettings}}" stepKey="uncheckConfigSetting"/> + <selectOption selector="{{AdminProductFormAdvancedInventorySection.manageStock}}" userInput="Yes" stepKey="clickOnManageStock"/> + <fillField selector="{{AdminProductFormAdvancedInventorySection.advancedInventoryQty}}" userInput="5" stepKey="fillProductQty"/> + <uncheckOption selector="{{AdminProductFormAdvancedInventorySection.miniQtyConfigSetting}}" stepKey="uncheckMiniQtyCheckBox"/> + <fillField selector="{{AdminProductFormAdvancedInventorySection.miniQtyAllowedInCart}}" userInput="1" stepKey="fillMiniAllowedQty"/> + <uncheckOption selector="{{AdminProductFormAdvancedInventorySection.maxiQtyConfigSetting}}" stepKey="uncheckMaxQtyCheckBox"/> + <fillField selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCart}}" userInput="10000" stepKey="fillMaxAllowedQty"/> + <selectOption selector="{{AdminProductFormAdvancedInventorySection.qtyUsesDecimals}}" userInput="Yes" stepKey="selectQuatityUsesDecimal"/> + <uncheckOption selector="{{AdminProductFormAdvancedInventorySection.notifyBelowQtyConfigSetting}}" stepKey="uncheckNotifyBelowQtyheckBox"/> + <fillField selector="{{AdminProductFormAdvancedInventorySection.notifyBelowQty}}" userInput="1" stepKey="fillNotifyBelowQty"/> + <selectOption selector="{{AdminProductFormAdvancedInventorySection.advancedInventoryStockStatus}}" userInput="In Stock" stepKey="selectOutOfStock"/> + <click stepKey="clickOnDoneButton" selector="{{AdminProductFormAdvancedInventorySection.doneButton}}"/> + <waitForPageLoad stepKey="waitForProductPageToLoad"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> + <!--Verify product is visible in category front page --> + <amOnPage url="$$createCategory.name$$.html" stepKey="openCategoryStoreFrontPage"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="seeCategoryInFrontPage"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="clickOnCategory"/> + <see selector="{{StorefrontCategoryMainSection.productName}}" userInput="{{SimpleProduct.name}}" stepKey="seeProductNameInCategoryPage"/> + <!--Verify Product In Store Front--> + <amOnPage url="$$createSimpleProduct.name$$.html" stepKey="goToStorefrontPage"/> + <waitForPageLoad stepKey="waitForProductFrontPageToLoad"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{SimpleProduct.name}}" stepKey="seeProductNameInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="{{SimpleProduct.price}}" stepKey="seeProductPriceInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="{{SimpleProduct.sku}}" stepKey="seeProductSkuInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="In Stock" stepKey="seeProductStatusInStoreFront"/> + <!--Add Product to the cart--> + <fillField selector="{{StorefrontProductPageSection.qtyInput}}" userInput="1" stepKey="fillProductQuantity"/> + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="clickOnAddToCartButton"/> + <waitForPageLoad stepKey="waitForProductToAddInCart"/> + <seeElement selector="{{StorefrontProductPageSection.successMsg}}" stepKey="seeSuccessSaveMessage"/> + <seeElement selector="{{StorefrontMinicartSection.quantity(1)}}" stepKey="seeAddedProductQuantityInCart"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickOnMiniCart"/> + <see selector="{{StorefrontMinicartSection.miniCartItemsText}}" userInput="{{SimpleProduct.name}}" stepKey="seeProductNameInMiniCart"/> + <see selector="{{StorefrontMinicartSection.miniCartItemsText}}" userInput="{{SimpleProduct.price}}" stepKey="seeProductPriceInMiniCart"/> + <seeElement selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="seeCheckOutButtonInMiniCart"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml new file mode 100644 index 0000000000000..6a9135aa81631 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCheckOutOfStockProductIsNotVisibleInCategoryTest"> + <annotations> + <stories value="Manage products"/> + <title value="Out of Stock Product is Not Visible in Category"/> + <description value="Login as admin and check out of stock product is not visible in category"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11064"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <!--Create Category--> + <createData entity="SimpleSubCategory" stepKey="createCategory"/> + <!--Create Simple Product--> + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <!-- Delete created entity --> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Open Product Index Page--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <!-- Update product Advanced Inventory Setting --> + <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> + <waitForPageLoad stepKey="waitForProductToLoad"/> + <click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/> + <waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/> + <uncheckOption selector="{{AdminProductFormAdvancedInventorySection.useConfigSettings}}" stepKey="uncheckConfigSetting"/> + <selectOption selector="{{AdminProductFormAdvancedInventorySection.manageStock}}" userInput="Yes" stepKey="clickOnManageStock"/> + <fillField selector="{{AdminProductFormAdvancedInventorySection.advancedInventoryQty}}" userInput="5" stepKey="fillProductQty"/> + <uncheckOption selector="{{AdminProductFormAdvancedInventorySection.miniQtyConfigSetting}}" stepKey="uncheckMiniQtyCheckBox"/> + <fillField selector="{{AdminProductFormAdvancedInventorySection.miniQtyAllowedInCart}}" userInput="1" stepKey="fillMiniAllowedQty"/> + <uncheckOption selector="{{AdminProductFormAdvancedInventorySection.maxiQtyConfigSetting}}" stepKey="uncheckMaxQtyCheckBox"/> + <fillField selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCart}}" userInput="10000" stepKey="fillMaxAllowedQty"/> + <selectOption selector="{{AdminProductFormAdvancedInventorySection.qtyUsesDecimals}}" userInput="Yes" stepKey="selectQuatityUsesDecimal"/> + <uncheckOption selector="{{AdminProductFormAdvancedInventorySection.notifyBelowQtyConfigSetting}}" stepKey="uncheckNotifyBelowQtyheckBox"/> + <fillField selector="{{AdminProductFormAdvancedInventorySection.notifyBelowQty}}" userInput="1" stepKey="fillNotifyBelowQty"/> + <selectOption selector="{{AdminProductFormAdvancedInventorySection.advancedInventoryStockStatus}}" userInput="Out of Stock" stepKey="selectOutOfStock"/> + <click selector="{{AdminProductFormAdvancedInventorySection.doneButton}}" stepKey="clickOnDoneButton"/> + <waitForPageLoad stepKey="waitForProductPageToSave"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> + <!--Verify product is not visible in category store front page --> + <amOnPage url="$$createCategory.name$$.html" stepKey="openCategoryStoreFrontPage"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="seeCategoryInFrontPage"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="clickOnCategory"/> + <dontSee selector="{{StorefrontCategoryMainSection.productName}}" userInput="{{SimpleProduct.name}}" stepKey="dontSeeProductInCategoryPage"/> + <!--Verify Product In Store Front--> + <amOnPage url="$$createSimpleProduct.name$$.html" stepKey="goToProductStorefrontPage"/> + <waitForPageLoad stepKey="waitForProductPageTobeLoaded"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{SimpleProduct.name}}" stepKey="seeProductNameInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="Out of stock" stepKey="seeProductStatusIsOutOfStock"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml new file mode 100644 index 0000000000000..6bb4bbec6c1bb --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCheckOutOfStockProductIsVisibleInCategoryTest"> + <annotations> + <stories value="Manage products"/> + <title value="Out of Stock Product is Visible in Category"/> + <description value="Login as admin and check out of stock product is visible in category"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11067"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!--Set Display out of stock product--> + <magentoCLI stepKey="setDisplayOutOfStockProduct" command="config:set cataloginventory/options/show_out_of_stock 1" /> + <!-- Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <!--Create Category--> + <createData entity="SimpleSubCategory" stepKey="createCategory"/> + <!--Create Simple Product--> + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <!-- Delete created entity --> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <actionGroup ref="logout" stepKey="logout"/> + <magentoCLI stepKey="setDisplayOutOfStockProduct" command="config:set cataloginventory/options/show_out_of_stock 0" /> + </after> + <!--Open Product Index Page--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <!-- Update product Advanced Inventory Setting --> + <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> + <waitForPageLoad stepKey="waitForProductToLoad"/> + <click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/> + <waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/> + <uncheckOption selector="{{AdminProductFormAdvancedInventorySection.useConfigSettings}}" stepKey="uncheckConfigSetting"/> + <selectOption selector="{{AdminProductFormAdvancedInventorySection.manageStock}}" userInput="Yes" stepKey="clickOnManageStock"/> + <fillField selector="{{AdminProductFormAdvancedInventorySection.advancedInventoryQty}}" userInput="5" stepKey="fillProductQty"/> + <uncheckOption selector="{{AdminProductFormAdvancedInventorySection.miniQtyConfigSetting}}" stepKey="uncheckMiniQtyCheckBox"/> + <fillField selector="{{AdminProductFormAdvancedInventorySection.miniQtyAllowedInCart}}" userInput="1" stepKey="fillMiniAllowedQty"/> + <uncheckOption selector="{{AdminProductFormAdvancedInventorySection.maxiQtyConfigSetting}}" stepKey="uncheckMaxQtyCheckBox"/> + <fillField selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCart}}" userInput="10000" stepKey="fillMaxAllowedQty"/> + <selectOption selector="{{AdminProductFormAdvancedInventorySection.qtyUsesDecimals}}" userInput="Yes" stepKey="selectQuantityUsesDecimal"/> + <uncheckOption selector="{{AdminProductFormAdvancedInventorySection.notifyBelowQtyConfigSetting}}" stepKey="uncheckNotifyBelowQtyCheckBox"/> + <fillField selector="{{AdminProductFormAdvancedInventorySection.notifyBelowQty}}" userInput="1" stepKey="fillNotifyBelowQty"/> + <selectOption selector="{{AdminProductFormAdvancedInventorySection.advancedInventoryStockStatus}}" userInput="Out of Stock" stepKey="selectOutOfStock"/> + <click stepKey="clickOnDoneButton" selector="{{AdminProductFormAdvancedInventorySection.doneButton}}"/> + <waitForPageLoad stepKey="waitForProductPageToLoad"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> + <!--Verify product is visible in category front page --> + <amOnPage url="$$createCategory.name$$.html" stepKey="openCategoryStoreFrontPage"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="seeCategoryInFrontPage"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="clickOnCategory"/> + <see selector="{{StorefrontCategoryMainSection.productName}}" userInput="{{SimpleProduct.name}}" stepKey="seeProductNameInCategoryPage"/> + </test> +</tests> From ac4c48815ef963d3c257977411b294d2df56f695 Mon Sep 17 00:00:00 2001 From: Alex Calandra <calandra.aj@gmail.com> Date: Wed, 30 Jan 2019 16:47:02 -0600 Subject: [PATCH 092/238] MC:4405: Convert ProductTypeSwitchingOnCreationTest to MFTF - Adding AdminCreateVirtualProductSwitchToSimpleTest - Adding AdminCreateSimpleProductSwitchToVirtualTest --- .../Test/Mftf/Page/AdminProductDeletePage.xml | 14 ++++ ...CreateSimpleProductSwitchToVirtualTest.xml | 68 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Page/AdminProductDeletePage.xml create mode 100755 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductSwitchToVirtualTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductDeletePage.xml b/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductDeletePage.xml new file mode 100644 index 0000000000000..1ce53a0ebd54b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductDeletePage.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminProductDeletePage" url="catalog/product/delete/id/{{productId}}/" area="admin" module="Magento_Catalog" parameterized="true"> + <!-- This page object only exists for the url. Use the AdminProductCreatePage for selectors. --> + </page> +</pages> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductSwitchToVirtualTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductSwitchToVirtualTest.xml new file mode 100755 index 0000000000000..221961c57a004 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductSwitchToVirtualTest.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateSimpleProductSwitchToVirtualTest"> + <annotations> + <features value="Catalog"/> + <stories value="Product Type Switching"/> + <title value="Admin should be able to switch a new product from simple to virtual"/> + <description value="Admin should be able to switch a new product from simple to virtual at the time the product is created"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-10925"/> + <group value="testMe"/> + </annotations> + <before> + <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> + </before> + <after> + <actionGroup ref="resetProductGridToDefaultView" stepKey="resetSearch"/> + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> + </after> + + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> + <!-- Open Dropdown and select simple product option --> + <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <argument name="productType" value="simple"/> + </actionGroup> + + <!-- Fill form for Virtual Product Type --> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillProductForm"> + <argument name="product" value="_defaultProduct"/> + </actionGroup> + <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <!-- Check that product was added with implicit type change --> + <actionGroup ref="GoToProductCatalogPage" stepKey="goToProductCatalogPage"/> + <actionGroup ref="resetProductGridToDefaultView" stepKey="resetSearch"/> + <actionGroup ref="filterProductGridByName" stepKey="searchForProduct"> + <argument name="product" value="_defaultProduct"/> + </actionGroup> + <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Virtual Product" stepKey="seeProductTypeInGrid"/> + </test> + <test name="AdminCreateVirtualProductSwitchToSimpleTest" extends="AdminCreateSimpleProductSwitchToVirtualTest"> + <annotations> + <features value="Catalog"/> + <stories value="Product Type Switching"/> + <title value="Admin should be able to switch a new product from virtual to simple"/> + <description value="Admin should be able to switch a new product from virtual to simple at the time the product is created"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-10925"/> + <group value="testMe"/> + </annotations> + <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <argument name="productType" value="virtual"/> + </actionGroup> + <!-- Fill form for Virtual Product Type --> + <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <argument name="product" value="_defaultProduct"/> + </actionGroup> + <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Simple Product" stepKey="seeProductTypeInGrid"/> + </test> +</tests> From c1a99589de4f5c41968bbda5853a697f4c41999f Mon Sep 17 00:00:00 2001 From: priti <priti@2jcommerce.in> Date: Thu, 31 Jan 2019 12:31:40 +0530 Subject: [PATCH 093/238] view-order-price-subtotal-alignment-not-proper-mobile --- .../Magento/luma/Magento_Sales/web/css/source/_module.less | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less index c8bdc56621f7b..1e4a92fa0701f 100644 --- a/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less @@ -503,11 +503,6 @@ } } } - .order-items.table-wrapper { - .col.price, .col.qty, .col.subtotal, .col.msrp { - text-align: left; - } - } } .media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) { From 969408f9a69da9f2c141a2fdc01ed61033e78577 Mon Sep 17 00:00:00 2001 From: Evgenii Levinskii <el@ideal-code.ru> Date: Wed, 30 Jan 2019 19:09:21 +0300 Subject: [PATCH 094/238] Fixed validation strategy label in import form --- .../Block/Adminhtml/Import/Edit/Form.php | 69 ++++++++++--------- app/code/Magento/ImportExport/i18n/en_US.csv | 1 + 2 files changed, 37 insertions(+), 33 deletions(-) diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php index 68b4d849099c1..d6b96a28afcc9 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php @@ -18,7 +18,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Basic import model * - * @var \Magento\ImportExport\Model\Import + * @var Import */ protected $_importModel; @@ -77,8 +77,10 @@ protected function _prepareForm() ); // base fieldset - $fieldsets['base'] = $form->addFieldset('base_fieldset', ['legend' => __('Import Settings')]); - $fieldsets['base']->addField( + $fieldsets['base'] = $form->addFieldset( + 'base_fieldset', + ['legend' => __('Import Settings')] + )->addField( 'entity', 'select', [ @@ -95,12 +97,11 @@ protected function _prepareForm() // add behaviour fieldsets $uniqueBehaviors = $this->_importModel->getUniqueEntityBehaviors(); foreach ($uniqueBehaviors as $behaviorCode => $behaviorClass) { - $fieldsets[$behaviorCode] = $form->addFieldset( + $fieldset = $form->addFieldset( $behaviorCode . '_fieldset', ['legend' => __('Import Behavior'), 'class' => 'no-display'] ); - /** @var $behaviorSource \Magento\ImportExport\Model\Source\Import\AbstractBehavior */ - $fieldsets[$behaviorCode]->addField( + $fieldset->addField( $behaviorCode, 'select', [ @@ -116,13 +117,13 @@ protected function _prepareForm() 'after_element_html' => $this->getImportBehaviorTooltip(), ] ); - $fieldsets[$behaviorCode]->addField( - $behaviorCode . \Magento\ImportExport\Model\Import::FIELD_NAME_VALIDATION_STRATEGY, + $fieldset->addField( + $behaviorCode . Import::FIELD_NAME_VALIDATION_STRATEGY, 'select', [ - 'name' => \Magento\ImportExport\Model\Import::FIELD_NAME_VALIDATION_STRATEGY, - 'title' => __(' '), - 'label' => __(' '), + 'name' => Import::FIELD_NAME_VALIDATION_STRATEGY, + 'title' => __('Validation Strategy'), + 'label' => __('Validation Strategy'), 'required' => true, 'class' => $behaviorCode, 'disabled' => true, @@ -133,11 +134,11 @@ protected function _prepareForm() 'after_element_html' => $this->getDownloadSampleFileHtml(), ] ); - $fieldsets[$behaviorCode]->addField( - $behaviorCode . '_' . \Magento\ImportExport\Model\Import::FIELD_NAME_ALLOWED_ERROR_COUNT, + $fieldset->addField( + $behaviorCode . '_' . Import::FIELD_NAME_ALLOWED_ERROR_COUNT, 'text', [ - 'name' => \Magento\ImportExport\Model\Import::FIELD_NAME_ALLOWED_ERROR_COUNT, + 'name' => Import::FIELD_NAME_ALLOWED_ERROR_COUNT, 'label' => __('Allowed Errors Count'), 'title' => __('Allowed Errors Count'), 'required' => true, @@ -149,11 +150,11 @@ protected function _prepareForm() ), ] ); - $fieldsets[$behaviorCode]->addField( - $behaviorCode . '_' . \Magento\ImportExport\Model\Import::FIELD_FIELD_SEPARATOR, + $fieldset->addField( + $behaviorCode . '_' . Import::FIELD_FIELD_SEPARATOR, 'text', [ - 'name' => \Magento\ImportExport\Model\Import::FIELD_FIELD_SEPARATOR, + 'name' => Import::FIELD_FIELD_SEPARATOR, 'label' => __('Field separator'), 'title' => __('Field separator'), 'required' => true, @@ -162,11 +163,11 @@ protected function _prepareForm() 'value' => ',', ] ); - $fieldsets[$behaviorCode]->addField( - $behaviorCode . \Magento\ImportExport\Model\Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR, + $fieldset->addField( + $behaviorCode . Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR, 'text', [ - 'name' => \Magento\ImportExport\Model\Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR, + 'name' => Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR, 'label' => __('Multiple value separator'), 'title' => __('Multiple value separator'), 'required' => true, @@ -175,11 +176,11 @@ protected function _prepareForm() 'value' => Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR, ] ); - $fieldsets[$behaviorCode]->addField( - $behaviorCode . \Magento\ImportExport\Model\Import::FIELD_EMPTY_ATTRIBUTE_VALUE_CONSTANT, + $fieldset->addField( + $behaviorCode . Import::FIELD_EMPTY_ATTRIBUTE_VALUE_CONSTANT, 'text', [ - 'name' => \Magento\ImportExport\Model\Import::FIELD_EMPTY_ATTRIBUTE_VALUE_CONSTANT, + 'name' => Import::FIELD_EMPTY_ATTRIBUTE_VALUE_CONSTANT, 'label' => __('Empty attribute value constant'), 'title' => __('Empty attribute value constant'), 'required' => true, @@ -188,28 +189,29 @@ protected function _prepareForm() 'value' => Import::DEFAULT_EMPTY_ATTRIBUTE_VALUE_CONSTANT, ] ); - $fieldsets[$behaviorCode]->addField( - $behaviorCode . \Magento\ImportExport\Model\Import::FIELDS_ENCLOSURE, + $fieldset->addField( + $behaviorCode . Import::FIELDS_ENCLOSURE, 'checkbox', [ - 'name' => \Magento\ImportExport\Model\Import::FIELDS_ENCLOSURE, + 'name' => Import::FIELDS_ENCLOSURE, 'label' => __('Fields enclosure'), 'title' => __('Fields enclosure'), 'value' => 1, ] ); + $fieldsets[$behaviorCode] = $fieldset; } // fieldset for file uploading - $fieldsets['upload'] = $form->addFieldset( + $fieldset = $form->addFieldset( 'upload_file_fieldset', ['legend' => __('File to Import'), 'class' => 'no-display'] ); - $fieldsets['upload']->addField( - \Magento\ImportExport\Model\Import::FIELD_NAME_SOURCE_FILE, + $fieldset->addField( + Import::FIELD_NAME_SOURCE_FILE, 'file', [ - 'name' => \Magento\ImportExport\Model\Import::FIELD_NAME_SOURCE_FILE, + 'name' => Import::FIELD_NAME_SOURCE_FILE, 'label' => __('Select File to Import'), 'title' => __('Select File to Import'), 'required' => true, @@ -219,11 +221,11 @@ protected function _prepareForm() ), ] ); - $fieldsets['upload']->addField( - \Magento\ImportExport\Model\Import::FIELD_NAME_IMG_FILE_DIR, + $fieldset->addField( + Import::FIELD_NAME_IMG_FILE_DIR, 'text', [ - 'name' => \Magento\ImportExport\Model\Import::FIELD_NAME_IMG_FILE_DIR, + 'name' => Import::FIELD_NAME_IMG_FILE_DIR, 'label' => __('Images File Directory'), 'title' => __('Images File Directory'), 'required' => false, @@ -234,6 +236,7 @@ protected function _prepareForm() ), ] ); + $fieldsets['upload'] = $fieldset; $form->setUseContainer(true); $this->setForm($form); diff --git a/app/code/Magento/ImportExport/i18n/en_US.csv b/app/code/Magento/ImportExport/i18n/en_US.csv index cae4d6e19868d..d7680a71ac5f7 100644 --- a/app/code/Magento/ImportExport/i18n/en_US.csv +++ b/app/code/Magento/ImportExport/i18n/en_US.csv @@ -18,6 +18,7 @@ Import,Import "Import Settings","Import Settings" "Import Behavior","Import Behavior" " "," " +"Validation Strategy","Validation Strategy" "Stop on Error","Stop on Error" "Skip error entries","Skip error entries" "Allowed Errors Count","Allowed Errors Count" From 50538c697279cd2d87e3a7c9128ba0174cd735c0 Mon Sep 17 00:00:00 2001 From: Sergey Shvets <sshvets@magento.com> Date: Thu, 31 Jan 2019 13:25:53 +0200 Subject: [PATCH 095/238] =?UTF-8?q?MAGETWO-96983:=20M2.3=20=E2=80=93=20Sod?= =?UTF-8?q?ium=20crypto=20adapter=20errors=20on=20unexpected=20input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Encryption/Adapter/SodiumChachaIetf.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Encryption/Adapter/SodiumChachaIetf.php b/lib/internal/Magento/Framework/Encryption/Adapter/SodiumChachaIetf.php index 1ed95731db755..0c56c2217669f 100644 --- a/lib/internal/Magento/Framework/Encryption/Adapter/SodiumChachaIetf.php +++ b/lib/internal/Magento/Framework/Encryption/Adapter/SodiumChachaIetf.php @@ -59,12 +59,16 @@ public function decrypt(string $data): string $nonce = mb_substr($data, 0, SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES, '8bit'); $payload = mb_substr($data, SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES, null, '8bit'); - $plainText = sodium_crypto_aead_chacha20poly1305_ietf_decrypt( - $payload, - $nonce, - $nonce, - $this->key - ); + try { + $plainText = sodium_crypto_aead_chacha20poly1305_ietf_decrypt( + $payload, + $nonce, + $nonce, + $this->key + ); + } catch (\SodiumException $e) { + $plainText = ''; + } return $plainText !== false ? $plainText : ''; } From f14e1a8235eb0510f86c09ae7c0739ce8869b90c Mon Sep 17 00:00:00 2001 From: Alex Calandra <calandra.aj@gmail.com> Date: Thu, 31 Jan 2019 08:25:05 -0600 Subject: [PATCH 096/238] MC-4405: Convert ProductTypeSwitchingOnCreationTest to MFTF - Adding cleanup for both tests - Adding general navigation action group --- .../ActionGroup/AdminProductActionGroup.xml | 17 +++++++++++++++++ ....xml => AdminCreateAndSwitchProductType.xml} | 7 +++++-- 2 files changed, 22 insertions(+), 2 deletions(-) rename app/code/Magento/Catalog/Test/Mftf/Test/{AdminCreateSimpleProductSwitchToVirtualTest.xml => AdminCreateAndSwitchProductType.xml} (88%) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml index b74746035878b..0c4557f9e11e9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml @@ -328,4 +328,21 @@ </assertEquals> </actionGroup> + <!-- This action group goes to the product index page, opens the drop down and clicks the specified product type for adding a product --> + <actionGroup name="GoToSpecifiedCreateProductPage"> + <arguments> + <argument type="string" name="productType" defaultValue="simple"/> + </arguments> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/> + <click selector="{{AdminProductGridActionSection.addTypeProduct(productType)}}" stepKey="clickAddProduct"/> + <waitForPageLoad stepKey="waitForFormToLoad"/> + </actionGroup> + + <!-- This action group simply navigates to the product catalog page --> + <actionGroup name="GoToProductCatalogPage"> + <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage"/> + <waitForPageLoad stepKey="WaitForPageToLoad"/> + </actionGroup> + </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductSwitchToVirtualTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml similarity index 88% rename from app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductSwitchToVirtualTest.xml rename to app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index 221961c57a004..0cc34c92901cc 100755 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductSwitchToVirtualTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -13,7 +13,7 @@ <features value="Catalog"/> <stories value="Product Type Switching"/> <title value="Admin should be able to switch a new product from simple to virtual"/> - <description value="Admin should be able to switch a new product from simple to virtual at the time the product is created"/> + <description value="After selecting a simple product when adding Admin should be switch to virtual implicitly"/> <severity value="CRITICAL"/> <testCaseId value="MC-10925"/> <group value="testMe"/> @@ -22,6 +22,9 @@ <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> </before> <after> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteSimpleProduct"> + <argument name="product" value="_defaultProduct"/> + </actionGroup> <actionGroup ref="resetProductGridToDefaultView" stepKey="resetSearch"/> <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> @@ -51,7 +54,7 @@ <features value="Catalog"/> <stories value="Product Type Switching"/> <title value="Admin should be able to switch a new product from virtual to simple"/> - <description value="Admin should be able to switch a new product from virtual to simple at the time the product is created"/> + <description value="After selecting a virtual product when adding Admin should be switch to simple implicitly"/> <severity value="CRITICAL"/> <testCaseId value="MC-10925"/> <group value="testMe"/> From 67836de429d3065e5845d8c91fec50db019eac05 Mon Sep 17 00:00:00 2001 From: Alex Calandra <calandra.aj@gmail.com> Date: Thu, 31 Jan 2019 08:50:57 -0600 Subject: [PATCH 097/238] MC-4405: Convert ProductTypeSwitchingOnCreationTest to MFTF - Fixing group tags --- .../Test/Mftf/Test/AdminCreateAndSwitchProductType.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index 0cc34c92901cc..f67965db3b660 100755 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -16,7 +16,8 @@ <description value="After selecting a simple product when adding Admin should be switch to virtual implicitly"/> <severity value="CRITICAL"/> <testCaseId value="MC-10925"/> - <group value="testMe"/> + <group value="catalog"/> + <group value="mtf_migrated"/> </annotations> <before> <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> @@ -57,7 +58,8 @@ <description value="After selecting a virtual product when adding Admin should be switch to simple implicitly"/> <severity value="CRITICAL"/> <testCaseId value="MC-10925"/> - <group value="testMe"/> + <group value="catalog"/> + <group value="mtf_migrated"/> </annotations> <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> <argument name="productType" value="virtual"/> From 8ec5a958acd4d867786ba80c1164045649fb8233 Mon Sep 17 00:00:00 2001 From: Alex Calandra <calandra.aj@gmail.com> Date: Thu, 31 Jan 2019 09:27:23 -0600 Subject: [PATCH 098/238] MC-4405: Convert ProductTypeSwitchingOnCreationTest to MFTF - Added Downloadable to Simple Test --- .../Test/AdminCreateAndSwitchProductType.xml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml new file mode 100755 index 0000000000000..4d880d2f88ca1 --- /dev/null +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateDownloadableProductSwitchToSimpleTest" extends="AdminCreateSimpleProductSwitchToVirtualTest"> + <annotations> + <features value="Catalog"/> + <stories value="Product Type Switching"/> + <title value="Admin should be able to switch a new product from downloadable to simple"/> + <description value="After selecting a downloadable product when adding Admin should be switch to simple implicitly"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-10925"/> + <group value="catalog"/> + <group value="mtf_migrated"/> + </annotations> + <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <argument name="productType" value="downloadable"/> + </actionGroup> + <!-- Fill form for Virtual Product Type --> + <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <argument name="product" value="_defaultProduct"/> + </actionGroup> + <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Simple Product" stepKey="seeProductTypeInGrid"/> + </test> +</tests> From 60e633a0da5e4f08e954b49f8905fc05a8655dcd Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Thu, 31 Jan 2019 10:23:18 -0600 Subject: [PATCH 099/238] MC-4406: Convert CreateSimpleProductEntityByAttributeMaskSkuTest to MFTF - Fix countryOfManufacture selector - Fix magentoCLI call in after block --- .../Catalog/Test/Mftf/Section/AdminProductFormSection.xml | 2 +- ...impleProductWithCountryOfManufactureAttributeSKUMaskTest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index 9195f7f2ebd60..4c0c08dc87295 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -56,7 +56,7 @@ <element name="selectCategory" type="input" selector="//*[@data-index='category_ids']//label[contains(., '{{categoryName}}')]" parameterized="true"/> <element name="done" type="button" selector="//*[@data-index='category_ids']//button[@data-action='close-advanced-select']" timeout="30"/> <element name="selectMultipleCategories" type="input" selector="//*[@data-index='container_category_ids']//*[contains(@class, '_selected')]"/> - <element name="countryOfManufacture" type="select" selector="product[country_of_manufacture]"/> + <element name="countryOfManufacture" type="select" selector="select[name='product[country_of_manufacture]']"/> </section> <section name="ProductInWebsitesSection"> <element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml index b3143be9b0e11..2298ce817fe95 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml @@ -27,7 +27,7 @@ <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{nameAndAttributeSkuMaskSimpleProduct.name}} {{nameAndAttributeSkuMaskSimpleProduct.country_of_manufacture_label}}" /> </actionGroup> - <magentoCLI stepKey="setName" command="config:set catalog/fields_masks/sku '{{name}}'"/> + <magentoCLI stepKey="setName" command="config:set catalog/fields_masks/sku" arguments="'{{name}}'"/> <actionGroup ref="logout" stepKey="logout"/> </after> From a667f22f92f705a816d20b35aaaecb209d65deab Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Thu, 31 Jan 2019 14:01:54 -0600 Subject: [PATCH 100/238] MC-4383: Convert AdvancedMoveCategoryEntityTest to MFTF - Fix whitespace of copyright --- ...veCategoryToAnotherPositionInCategoryTreeTest.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml index c5cdd228d579b..9831f73e07877 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> - <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - --> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> From 53218176b179a3f1fd5b0a18c8f13d2897075e49 Mon Sep 17 00:00:00 2001 From: Kevin Kozan <kkozan@magento.com> Date: Thu, 31 Jan 2019 15:00:45 -0600 Subject: [PATCH 101/238] MC-4399: Convert AddToCartCrossSellTest to MFTF - Created AddToCartCrossSellTest and acocmpanying test materials --- .../ActionGroup/AdminProductActionGroup.xml | 19 ++++ .../AdminProductCrossSellModalSection.xml | 14 +++ ...inProductRelatedUpSellCrossSellSection.xml | 2 + .../Test/Mftf/Test/AddToCartCrossSellTest.xml | 91 +++++++++++++++++++ .../Test/Mftf/Page/CheckoutCartPage.xml | 1 + .../Section/CheckoutCartCrossSellSection.xml | 17 ++++ 6 files changed, 144 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Section/AdminProductCrossSellModalSection.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartCrossSellSection.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml index b74746035878b..d0968cb0f33b8 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml @@ -239,6 +239,25 @@ <click selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}" stepKey="addRelatedProductSelected"/> </actionGroup> + <!--Click AddCrossSellProducts and adds product by SKU--> + <actionGroup name="addCrossSellProductBySku"> + <arguments> + <argument name="sku"/> + </arguments> + <!--Scroll up to avoid error--> + <scrollTo selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" x="0" y="-100" stepKey="scrollTo"/> + <conditionalClick selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" dependentSelector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDependent}}" visible="false" stepKey="openDropDownIfClosedRelatedUpSellCrossSell"/> + <click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddCrossSellProductsButton}}" stepKey="clickAddCrossSellButton"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <click selector="{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/> + <click selector="{{AdminProductCrossSellModalSection.addSelectedProducts}}" stepKey="addRelatedProductSelected"/> + <waitForPageLoad stepKey="waitForModalDisappear"/> + </actionGroup> + <!--Add special price to product in Admin product page--> <actionGroup name="AddSpecialPriceToProductActionGroup"> <arguments> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductCrossSellModalSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductCrossSellModalSection.xml new file mode 100644 index 0000000000000..803d72d7a7eca --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductCrossSellModalSection.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminProductCrossSellModalSection"> + <element name="addSelectedProducts" type="button" selector=".product_form_product_form_related_crosssell_modal .action-primary"/> + </section> +</sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductRelatedUpSellCrossSellSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductRelatedUpSellCrossSellSection.xml index e90d806805f7c..18403d1654275 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductRelatedUpSellCrossSellSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductRelatedUpSellCrossSellSection.xml @@ -9,7 +9,9 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminProductFormRelatedUpSellCrossSellSection"> + <element name="sectionHeader" type="block" selector=".fieldset-wrapper.admin__collapsible-block-wrapper[data-index='related']"/> <element name="AddRelatedProductsButton" type="button" selector="button[data-index='button_related']" timeout="30"/> + <element name="AddCrossSellProductsButton" type="button" selector="button[data-index='button_crosssell']" timeout="30"/> <element name="relatedProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='related']"/> <element name="upSellProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='upsell']"/> <element name="crossSellProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='crosssell']"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml new file mode 100644 index 0000000000000..dc1ac7dc4d9f1 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AddToCartCrossSellTest"> + <annotations> + <features value="Catalog"/> + <stories value="Promote Products as Cross-Sells"/> + <title value="Admin should be able to add cross-sell to products."/> + <description value="Create products, add products to cross sells, and check that they appear in the Shopping Cart page."/> + <severity value="MAJOR"/> + <testCaseId value="MC-113"/> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="SimpleSubCategory" stepKey="category1"/> + <createData entity="_defaultProduct" stepKey="simpleProduct1"> + <requiredEntity createDataKey="category1"/> + </createData> + <createData entity="_defaultProduct" stepKey="simpleProduct2"> + <requiredEntity createDataKey="category1"/> + </createData> + <createData entity="_defaultProduct" stepKey="simpleProduct3"> + <requiredEntity createDataKey="category1"/> + </createData> + </before> + <after> + <deleteData createDataKey="simpleProduct1" stepKey="deleteSimp1"/> + <deleteData createDataKey="simpleProduct2" stepKey="deleteSimp2"/> + <deleteData createDataKey="simpleProduct3" stepKey="deleteSimp3"/> + <deleteData createDataKey="category1" stepKey="deleteCategory"/> + </after> + + <actionGroup ref="LoginAsAdmin" stepKey="logInAsAdmin"/> + + <!-- Go to simpleProduct1, add simpleProduct2 and simpleProduct3 as cross-sell--> + <amOnPage url="{{AdminProductEditPage.url($simpleProduct1.id$)}}" stepKey="goToProduct1"/> + <click stepKey="openHeader1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.sectionHeader}}"/> + + <actionGroup ref="addCrossSellProductBySku" stepKey="addProduct2ToSimp1"> + <argument name="sku" value="$simpleProduct2.sku$"/> + </actionGroup> + <actionGroup ref="addCrossSellProductBySku" stepKey="addProduct3ToSimp1"> + <argument name="sku" value="$simpleProduct3.sku$"/> + </actionGroup> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave"/> + <waitForLoadingMaskToDisappear stepKey="waitForProductPageSave"/> + + <!-- Go to simpleProduct3, add simpleProduct1 and simpleProduct2 as cross-sell--> + <amOnPage url="{{AdminProductEditPage.url($simpleProduct3.id$)}}" stepKey="goToProduct3"/> + <click stepKey="openHeader2" selector="{{AdminProductFormRelatedUpSellCrossSellSection.sectionHeader}}"/> + + <actionGroup ref="addCrossSellProductBySku" stepKey="addProduct1ToSimp3"> + <argument name="sku" value="$simpleProduct1.sku$"/> + </actionGroup> + <actionGroup ref="addCrossSellProductBySku" stepKey="addProduct2ToSimp3"> + <argument name="sku" value="$simpleProduct2.sku$"/> + </actionGroup> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave2"/> + <waitForLoadingMaskToDisappear stepKey="waitForProductPageSave2"/> + + <!-- Go to frontend, add simpleProduct1 to cart--> + <actionGroup ref="AddSimpleProductToCart" stepKey="addSimp1ToCart"> + <argument name="product" value="$simpleProduct1$"/> + </actionGroup> + + <!-- Check that cart page contains cross-sell to simpleProduct2 and simpleProduct3--> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCart1"/> + <waitForPageLoad stepKey="waitForCartToLoad"/> + <waitForElementVisible selector="{{CheckoutCartCrossSellSection.products}}" stepKey="waitForCrossSellLoading"/> + <see stepKey="seeProduct2InCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct2.name$"/> + <see stepKey="seeProduct3InCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct3.name$"/> + + <!-- Add simpleProduct3 to cart, check cross-sell contains product2 but not product3--> + <click stepKey="addSimp3ToCart" selector="{{CheckoutCartCrossSellSection.productRowByName($simpleProduct3.name$)}}{{CheckoutCartCrossSellSection.addToCart}}"/> + <waitForPageLoad stepKey="waitForCartToLoad2"/> + <see stepKey="seeProduct2StillInCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct2.name$"/> + <dontSee stepKey="dontSeeProduct3InCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct3.name$"/> + + <!-- Add simpleProduct2 to cart, check cross-sell doesn't contain product 2 anymore.--> + <click stepKey="addSimp2ToCart" selector="{{CheckoutCartCrossSellSection.productRowByName($simpleProduct2.name$)}}{{CheckoutCartCrossSellSection.addToCart}}"/> + <waitForPageLoad stepKey="waitForCartToLoad3"/> + <dontSee stepKey="dontSeeProduct2InCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct2.name$"/> + </test> +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutCartPage.xml b/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutCartPage.xml index b0acc64c77727..bf17800f29ad1 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutCartPage.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutCartPage.xml @@ -11,5 +11,6 @@ <page name="CheckoutCartPage" url="/checkout/cart" module="Magento_Checkout" area="storefront"> <section name="CheckoutCartProductSection"/> <section name="CheckoutCartSummarySection"/> + <section name="CheckoutCartCrossSellSection"/> </page> </pages> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartCrossSellSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartCrossSellSection.xml new file mode 100644 index 0000000000000..aa23f3364771f --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartCrossSellSection.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="CheckoutCartCrossSellSection"> + <element name="title" type="text" selector=".block.crosssell .block-title"/> + <element name="products" type="block" selector=".block.crosssell .block-content"/> + <element name="productRowByName" type="block" selector="//li[@class='item product product-item'and .//a[@title='{{name}}']]" parameterized="true"/> + <element name="addToCart" type="block" selector="//button[@title='Add to Cart']"/> + </section> +</sections> \ No newline at end of file From 690143d5a9b6abb1ba23abb6b37531095bdb89fe Mon Sep 17 00:00:00 2001 From: Alex Calandra <calandra.aj@gmail.com> Date: Thu, 31 Jan 2019 15:17:08 -0600 Subject: [PATCH 102/238] MC-4405: Convert ProductTypeSwitchingOnCreationTest to MFTF - Correcting Configurable Product Test - Adding Storefront Checks --- .../ActionGroup/AdminProductActionGroup.xml | 9 ++ .../Test/AdminCreateAndSwitchProductType.xml | 10 +++ .../AdminConfigurableProductActionGroup.xml | 6 ++ .../StorefrontProductActionGroup.xml | 9 ++ .../StorefrontProductInfoMainSection.xml | 1 + .../Test/AdminCreateAndSwitchProductType.xml | 83 +++++++++++++++++++ 6 files changed, 118 insertions(+) create mode 100755 app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml index 0c4557f9e11e9..9017ae9bc18c4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml @@ -333,6 +333,7 @@ <arguments> <argument type="string" name="productType" defaultValue="simple"/> </arguments> + <comment userInput="actionGroup:GoToSpecifiedCreateProductPage" stepKey="actionGroupComment"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/> <click selector="{{AdminProductGridActionSection.addTypeProduct(productType)}}" stepKey="clickAddProduct"/> @@ -341,8 +342,16 @@ <!-- This action group simply navigates to the product catalog page --> <actionGroup name="GoToProductCatalogPage"> + <comment userInput="actionGroup:GoToProductCatalogPage" stepKey="actionGroupComment"/> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage"/> <waitForPageLoad stepKey="WaitForPageToLoad"/> </actionGroup> + <actionGroup name="SetProductUrlKey"> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> + <fillField userInput="{{product.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index f67965db3b660..e76ca74280e8f 100755 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -23,6 +23,7 @@ <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> </before> <after> + <actionGroup ref="GoToProductCatalogPage" stepKey="goToProductCatalogPage"/> <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteSimpleProduct"> <argument name="product" value="_defaultProduct"/> </actionGroup> @@ -33,22 +34,31 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> <!-- Open Dropdown and select simple product option --> + <comment stepKey="beforeOpenProductFillForm" userInput="Selecting Product from the Add Product Dropdown"/> <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> <argument name="productType" value="simple"/> </actionGroup> <!-- Fill form for Virtual Product Type --> + <comment stepKey="beforeFillProductForm" userInput="Filling Product Form"/> <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillProductForm"> <argument name="product" value="_defaultProduct"/> </actionGroup> + <actionGroup ref="SetProductUrlKey" stepKey="setProductUrl"> + <argument name="product" value="_defaultProduct"/> + </actionGroup> <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> <!-- Check that product was added with implicit type change --> + <comment stepKey="beforeVerify" userInput="Verify Product Type Assigned Correctly"/> <actionGroup ref="GoToProductCatalogPage" stepKey="goToProductCatalogPage"/> <actionGroup ref="resetProductGridToDefaultView" stepKey="resetSearch"/> <actionGroup ref="filterProductGridByName" stepKey="searchForProduct"> <argument name="product" value="_defaultProduct"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Virtual Product" stepKey="seeProductTypeInGrid"/> + <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <argument name="product" value="_defaultProduct"/> + </actionGroup> </test> <test name="AdminCreateVirtualProductSwitchToSimpleTest" extends="AdminCreateSimpleProductSwitchToVirtualTest"> <annotations> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml index d2abfc7977519..d6e7221ec1cab 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml @@ -150,4 +150,10 @@ <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> </actionGroup> + + <actionGroup name="saveConfiguredProduct"> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml index 0a8d8e56426ba..9be600c239c79 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml @@ -24,4 +24,13 @@ <see userInput="{{product.custom_attributes[description]}}" selector="{{StorefrontProductInfoMainSection.productDescription}}" stepKey="assertProductDescription"/> <see userInput="{{product.custom_attributes[short_description]}}" selector="{{StorefrontProductInfoMainSection.productShortDescription}}" stepKey="assertProductShortDescription"/> </actionGroup> + + <!-- Check Storefront Configurable Product Option --> + <actionGroup name="VerifyOptionInProductStorefront"> + <arguments> + <argument name="attributeCode" type="string"/> + <argument name="optionName" type="string"/> + </arguments> + <seeElement selector="{{StorefrontProductInfoMainSection.attributeOptionByAttributeID(attributeCode, optionName)}}" stepKey="verifyOptionExists"/> + </actionGroup> </actionGroups> \ No newline at end of file diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml index b195c19f7bedd..522403cbf44d2 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml @@ -17,5 +17,6 @@ <!-- Parameter is the order number of the attribute on the page (1 is the newest) --> <element name="nthAttributeOnPage" type="block" selector="tr:nth-of-type({{numElement}}) .data" parameterized="true"/> <element name="stockIndication" type="block" selector=".stock" /> + <element name="attributeOptionByAttributeID" type="select" selector="//div[@class='fieldset']/div[//span[text()='{{attribute_code}}']]//option[text()='{{optionName}}']" parameterized="true"/> </section> </sections> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml new file mode 100755 index 0000000000000..708b2ca2130eb --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateConfigurableProductSwitchToSimpleTest" extends="AdminCreateSimpleProductSwitchToVirtualTest"> + <annotations> + <features value="Catalog"/> + <stories value="Product Type Switching"/> + <title value="Admin should be able to switch a new product from configurable to simple"/> + <description value="After selecting a configurable product when adding Admin should be switch to simple implicitly"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-10925"/> + <group value="catalog"/> + <group value="mtf_migrated"/> + </annotations> + <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <argument name="productType" value="configurable"/> + </actionGroup> + <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <argument name="product" value="_defaultProduct"/> + </actionGroup> + <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Simple Product" stepKey="seeProductTypeInGrid"/> + </test> + <test name="AdminCreateConfigurableProductSwitchToVirtualTest" extends="AdminCreateSimpleProductSwitchToVirtualTest"> + <annotations> + <features value="Catalog"/> + <stories value="Product Type Switching"/> + <title value="Admin should be able to switch a new product from configurable to virtual"/> + <description value="After selecting a configurable product when adding Admin should be switch to virtual implicitly"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-10925"/> + <group value="catalog"/> + <group value="mtf_migrated"/> + </annotations> + <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <argument name="productType" value="configurable"/> + </actionGroup> + <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Virtual Product" stepKey="seeProductTypeInGrid"/> + </test> + <test name="AdminCreateSimpleProductSwitchToConfigurableTest" extends="AdminCreateSimpleProductSwitchToVirtualTest"> + <annotations> + <features value="Catalog"/> + <stories value="Product Type Switching"/> + <title value="Admin should be able to switch a new product from simple to configurable"/> + <description value="After selecting a simple product when adding Admin should be switch to configurable implicitly"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-10925"/> + <group value="catalog"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + </before> + <after> + <deleteData stepKey="deleteAttribute" createDataKey="createConfigProductAttribute"/> + </after> + <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <argument name="productType" value="simple"/> + </actionGroup> + <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <argument name="product" value="_defaultProduct"/> + </actionGroup> + <comment before="createConfiguration" stepKey="beforeCreateConfiguration" userInput="Adding Configuration to Product"/> + <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="createConfiguration" after="fillProductForm"> + <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> + </actionGroup> + <actionGroup ref="saveConfiguredProduct" stepKey="saveProductForm"/> + <see selector="{{AdminProductGridSection.productGridCell('2', 'Type')}}" userInput="Configurable Product" stepKey="seeProductTypeInGrid"/> + <actionGroup ref="VerifyOptionInProductStorefront" stepKey="verifyConfigurableOption" after="AssertProductInStorefrontProductPage"> + <argument name="attributeCode" value="$createConfigProductAttribute.default_frontend_label$"/> + <argument name="optionName" value="$createConfigProductAttributeOption1.option[store_labels][1][label]$"/> + </actionGroup> + </test> +</tests> From 1b71d4d21de67285346a247b553786d304f5001c Mon Sep 17 00:00:00 2001 From: Ravi Chandra <ravi.chandra@krishtechnolabs.com> Date: Fri, 1 Feb 2019 17:34:55 +0530 Subject: [PATCH 103/238] Correct spelling --- app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php b/app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php index da35b566d7e71..6e0d52c2d4f74 100644 --- a/app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php +++ b/app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php @@ -20,8 +20,8 @@ /** * Reports Viewed Products Counter * - * The main responsilibity of this class is provide necessary data to track viewed products - * by customer on frontend and data to synchornize this tracks with backend + * The main responsibility of this class is provide necessary data to track viewed products + * by customer on frontend and data to synchronize this tracks with backend * * @api * @since 101.1.0 From f8e407d6ca3692437eb6764685061942f644af86 Mon Sep 17 00:00:00 2001 From: Robin Rijkeboer <robin.rijkeboer@itonomy.nl> Date: Fri, 1 Feb 2019 16:22:23 +0100 Subject: [PATCH 104/238] Add the ability to disable/remove an action from Mass(Tree)Action --- app/code/Magento/Ui/Component/MassAction.php | 7 ++++++- .../view/base/ui_component/etc/definition.map.xml | 1 + .../base/ui_component/etc/definition/action.xsd | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/Component/MassAction.php b/app/code/Magento/Ui/Component/MassAction.php index ea39e19a65f52..fe786da55faa9 100644 --- a/app/code/Magento/Ui/Component/MassAction.php +++ b/app/code/Magento/Ui/Component/MassAction.php @@ -21,7 +21,12 @@ public function prepare() $config = $this->getConfiguration(); foreach ($this->getChildComponents() as $actionComponent) { - $config['actions'][] = $actionComponent->getConfiguration(); + $actionComponentConfig = $actionComponent->getConfiguration(); + $disabledAction = $actionComponentConfig['actionDisable'] ?? false; + if ($disabledAction) { + continue; + } + $config['actions'][] = $actionComponentConfig; } $origConfig = $this->getConfiguration(); diff --git a/app/code/Magento/Ui/view/base/ui_component/etc/definition.map.xml b/app/code/Magento/Ui/view/base/ui_component/etc/definition.map.xml index ccd702c23ea65..8f82b98112f18 100644 --- a/app/code/Magento/Ui/view/base/ui_component/etc/definition.map.xml +++ b/app/code/Magento/Ui/view/base/ui_component/etc/definition.map.xml @@ -14,6 +14,7 @@ <item name="label" type="string" translate="true" xsi:type="xpath">settings/label</item> <item name="type" type="string" xsi:type="xpath">settings/type</item> <item name="url" type="url" xsi:type="converter">settings/url</item> + <item name="actionDisable" type="boolean" xsi:type="xpath">settings/actionDisable</item> <item name="confirm" xsi:type="array"> <item name="title" type="string" translate="true" xsi:type="xpath">settings/confirm/title</item> <item name="message" type="string" translate="true" xsi:type="xpath">settings/confirm/message</item> diff --git a/app/code/Magento/Ui/view/base/ui_component/etc/definition/action.xsd b/app/code/Magento/Ui/view/base/ui_component/etc/definition/action.xsd index b10ee00818ebc..4dc97910935d6 100644 --- a/app/code/Magento/Ui/view/base/ui_component/etc/definition/action.xsd +++ b/app/code/Magento/Ui/view/base/ui_component/etc/definition/action.xsd @@ -49,6 +49,13 @@ </xs:documentation> </xs:annotation> </xs:element> + <xs:element name="actionDisable" type="xs:boolean"> + <xs:annotation> + <xs:documentation> + Disable and remove this action. + </xs:documentation> + </xs:annotation> + </xs:element> </xs:choice> <xs:attribute name="name" use="required"/> </xs:complexType> @@ -82,6 +89,13 @@ </xs:documentation> </xs:annotation> </xs:element> + <xs:element name="actionDisable" type="xs:boolean"> + <xs:annotation> + <xs:documentation> + Disable and remove this action. + </xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="confirm" type="confirmType"> <xs:annotation> <xs:documentation> From a1ff4b4e1f3c39dbcb3b84270d8d8846aff4e80f Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Fri, 25 Jan 2019 11:48:39 -0600 Subject: [PATCH 105/238] MC-4395: Convert DeleteProductEntityTest to MFTF --- .../Test/Mftf/Data/CustomAttributeData.xml | 8 +++ .../Bundle/Test/Mftf/Data/ProductData.xml | 16 ++++++ .../AdminDeleteBundleDynamicProductTest.xml | 52 +++++++++++++++++ .../AdminDeleteBundleFixedProductTest.xml | 52 +++++++++++++++++ .../AdminProductGridActionGroup.xml | 1 + .../Section/StorefrontCategoryMainSection.xml | 1 + ...AdminDeleteProductWithCustomOptionTest.xml | 54 ++++++++++++++++++ .../Test/AdminDeleteSimpleProductTest.xml | 53 +++++++++++++++++ .../Test/AdminDeleteVirtualProductTest.xml | 54 ++++++++++++++++++ .../StorefrontCatalogSearchMainSection.xml | 1 + .../AdminDeleteConfigurableProductTest.xml | 52 +++++++++++++++++ .../Downloadable/Test/Mftf/Data/LinkData.xml | 22 +++++++ .../Test/Mftf/Data/ProductData.xml | 14 +++++ .../AdminDeleteDownloadableProductTest.xml | 57 +++++++++++++++++++ .../Test/Mftf/Data/GroupedProductData.xml | 12 ++++ .../Test/AdminDeleteGroupedProductTest.xml | 57 +++++++++++++++++++ 16 files changed, 506 insertions(+) create mode 100644 app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleFixedProductTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductWithCustomOptionTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSimpleProductTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteVirtualProductTest.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminDeleteConfigurableProductTest.xml create mode 100644 app/code/Magento/Downloadable/Test/Mftf/Test/AdminDeleteDownloadableProductTest.xml create mode 100644 app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminDeleteGroupedProductTest.xml diff --git a/app/code/Magento/Bundle/Test/Mftf/Data/CustomAttributeData.xml b/app/code/Magento/Bundle/Test/Mftf/Data/CustomAttributeData.xml index e6866ae74a7e1..256bfd7746957 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Data/CustomAttributeData.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Data/CustomAttributeData.xml @@ -23,4 +23,12 @@ <data key="attribute_code">price_view</data> <data key="value">0</data> </entity> + <entity name="CustomAttributeFixWeight" type="custom_attribute"> + <data key="attribute_code">weight_type</data> + <data key="value">1</data> + </entity> + <entity name="CustomAttributeFixSku" type="custom_attribute"> + <data key="attribute_code">sku_type</data> + <data key="value">1</data> + </entity> </entities> diff --git a/app/code/Magento/Bundle/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Bundle/Test/Mftf/Data/ProductData.xml index 9dc30e73228d3..0a0c77755fc7a 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Data/ProductData.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Data/ProductData.xml @@ -31,6 +31,22 @@ <data key="fixedPriceFormatted">$10.00</data> <data key="defaultAttribute">Default</data> </entity> + <entity name="FixedBundleProduct" type="product2"> + <data key="name" unique="suffix">FixedBundleProduct</data> + <data key="sku" unique="suffix">fixed-bundle-product</data> + <data key="type_id">bundle</data> + <data key="attribute_set_id">4</data> + <data key="price">1.23</data> + <data key="visibility">4</data> + <data key="status">1</data> + <data key="urlKey" unique="suffix">fixed-bundle-product</data> + <requiredEntity type="custom_attribute">CustomAttributeCategoryIds</requiredEntity> + <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> + <requiredEntity type="custom_attribute">CustomAttributePriceView</requiredEntity> + <requiredEntity type="custom_attribute">CustomAttributeFixPrice</requiredEntity> + <requiredEntity type="custom_attribute">CustomAttributeFixWeight</requiredEntity> + <requiredEntity type="custom_attribute">CustomAttributeFixSku</requiredEntity> + </entity> <entity name="ApiBundleProduct" type="product2"> <data key="name" unique="suffix">Api Bundle Product</data> <data key="sku" unique="suffix">api-bundle-product</data> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml new file mode 100644 index 0000000000000..bc9a3dba9a5f1 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteBundleDynamicProductTest"> + <annotations> + <features value="Bundle"/> + <stories value="Delete products"/> + <title value="Delete Bundle Dynamic Product"/> + <description value="Admin should be able to delete a bundle dynamic product"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11016"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="ApiBundleProductPriceViewRange" stepKey="createDynamicBundleProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteBundleProductFilteredBySkuAndName"> + <argument name="product" value="$$createDynamicBundleProduct$$"/> + </actionGroup> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> + <!-- Verify product on Product Page --> + <amOnPage url="{{StorefrontProductPage.url($$createDynamicBundleProduct.name$$)}}" stepKey="amOnBundleProductPage"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoops"/> + <!-- Search for the product by sku --> + <fillField selector="{{StorefrontQuickSearchSection.searchPhrase}}" userInput="$$createDynamicBundleProduct.sku$$" stepKey="fillSearchBarByProductSku"/> + <waitForPageLoad stepKey="waitForSearchButton"/> + <click selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForSearchResults"/> + <!-- Should not see any search results --> + <dontSee userInput="$$createDynamicBundleProduct.sku$$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/> + <see selector="{{StorefrontCatalogSearchMainSection.message}}" userInput="Your search returned no results." stepKey="seeCantFindProductOneMessage"/> + <!-- Go to the category page that we created in the before block --> + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> + <!-- Should not see the product --> + <dontSee userInput="$$createDynamicBundleProduct.name$$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="dontSeeProductInCategory"/> + <see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/> + </test> +</tests> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleFixedProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleFixedProductTest.xml new file mode 100644 index 0000000000000..2527dae7eadf8 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleFixedProductTest.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteBundleFixedProductTest"> + <annotations> + <features value="Bundle"/> + <stories value="Delete products"/> + <title value="Delete Bundle Fixed Product"/> + <description value="Admin should be able to delete a bundle fixed product"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11017"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="FixedBundleProduct" stepKey="createFixedBundleProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteBundleProductFilteredBySkuAndName"> + <argument name="product" value="$$createFixedBundleProduct$$"/> + </actionGroup> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> + <!-- Verify product on Product Page --> + <amOnPage url="{{StorefrontProductPage.url($$createFixedBundleProduct.name$$)}}" stepKey="amOnBundleProductPage"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoops"/> + <!-- Search for the product by sku --> + <fillField selector="{{StorefrontQuickSearchSection.searchPhrase}}" userInput="$$createFixedBundleProduct.sku$$" stepKey="fillSearchBarByProductSku"/> + <waitForPageLoad stepKey="waitForSearchButton"/> + <click selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForSearchResults"/> + <!-- Should not see any search results --> + <dontSee userInput="$$createFixedBundleProduct.sku$$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/> + <see selector="{{StorefrontCatalogSearchMainSection.message}}" userInput="Your search returned no results." stepKey="seeCantFindProductOneMessage"/> + <!-- Go to the category page that we created in the before block --> + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> + <!-- Should not see the product --> + <dontSee userInput="$$createFixedBundleProduct.name$$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="dontSeeProductInCategory"/> + <see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml index 817da18f5f2b7..12cb1976ed6d0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml @@ -155,6 +155,7 @@ <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> + <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml index 845b7070e46cd..8e6790cdd3457 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml @@ -30,5 +30,6 @@ <element name="emptyProductMessage" type="block" selector=".message.info.empty>div"/> <element name="lineProductName" type="text" selector=".products.list.items.product-items li:nth-of-type({{line}}) .product-item-link" timeout="30" parameterized="true"/> <element name="asLowAs" type="input" selector="//*[@class='price-box price-final_price']/a/span[@class='price-container price-final_price tax weee']"/> + <element name="productsList" type="block" selector="#maincontent .column.main"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductWithCustomOptionTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductWithCustomOptionTest.xml new file mode 100644 index 0000000000000..7f6a1333b721a --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductWithCustomOptionTest.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteProductWithCustomOptionTest"> + <annotations> + <features value="Catalog"/> + <stories value="Delete products"/> + <title value="Delete Product with Custom Option"/> + <description value="Admin should be able to delete a product with custom option"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11015"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <updateData createDataKey="createSimpleProduct" entity="productWithOptions2" stepKey="updateProductWithCustomOption"/> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteSimpleProductFilteredBySkuAndName"> + <argument name="product" value="$$createSimpleProduct$$"/> + </actionGroup> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> + <!--Verify product on product page --> + <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.name$$)}}" stepKey="amOnSimpleProductPage"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoops"/> + <!-- Search for the product by sku --> + <fillField selector="{{StorefrontQuickSearchSection.searchPhrase}}" userInput="$$createSimpleProduct.sku$$" stepKey="fillSearchBarByProductSku"/> + <waitForPageLoad stepKey="waitForSearchButton"/> + <click selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForSearchResults"/> + <!-- Should not see any search results --> + <dontSee userInput="$$createSimpleProduct.sku$$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/> + <see selector="{{StorefrontCatalogSearchMainSection.message}}" userInput="Your search returned no results." stepKey="seeCantFindProductOneMessage"/> + <!-- Go to the category page that we created in the before block --> + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> + <!-- Should not see the product --> + <dontSee userInput="$$createSimpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="dontSeeProductInCategory"/> + <see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSimpleProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSimpleProductTest.xml new file mode 100644 index 0000000000000..7c460a3dfc51e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSimpleProductTest.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteSimpleProductTest"> + <annotations> + <features value="Catalog"/> + <stories value="Delete products"/> + <title value="Delete Simple Product"/> + <description value="Admin should be able to delete a simple product"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11013"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteSimpleProductFilteredBySkuAndName"> + <argument name="product" value="$$createSimpleProduct$$"/> + </actionGroup> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> + <!--Verify product on Product Page --> + <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.name$$)}}" stepKey="amOnSimpleProductPage"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoops"/> + <!-- Search for the product by sku --> + <fillField selector="{{StorefrontQuickSearchSection.searchPhrase}}" userInput="$$createSimpleProduct.sku$$" stepKey="fillSearchBarByProductSku"/> + <waitForPageLoad stepKey="waitForSearchButton"/> + <click selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForSearchResults"/> + <!-- Should not see any search results --> + <dontSee userInput="$$createSimpleProduct.sku$$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/> + <see selector="{{StorefrontCatalogSearchMainSection.message}}" userInput="Your search returned no results." stepKey="seeCantFindProductOneMessage"/> + <!-- Go to the category page that we created in the before block --> + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> + <!-- Should not see the product --> + <dontSee userInput="$$createSimpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="dontSeeProductInCategory"/> + <see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteVirtualProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteVirtualProductTest.xml new file mode 100644 index 0000000000000..413d53d1c3746 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteVirtualProductTest.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteVirtualProductTest"> + <annotations> + <features value="Catalog"/> + <stories value="Delete products"/> + <title value="Delete Virtual Product"/> + <description value="Admin should be able to delete a virtual product"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11014"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="defaultVirtualProduct" stepKey="createVirtualProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteVirtualProductFilteredBySkuAndName"> + <argument name="product" value="$$createVirtualProduct$$"/> + </actionGroup> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> + <!--Verify product on product page --> + <amOnPage url="{{StorefrontProductPage.url($$createVirtualProduct.name$$)}}" stepKey="amOnVirtualProductPage"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoops"/> + <!-- Search for the product by sku --> + <fillField selector="{{StorefrontQuickSearchSection.searchPhrase}}" userInput="$$createVirtualProduct.sku$$" stepKey="fillSearchBarByProductSku"/> + <waitForPageLoad stepKey="waitForSearchButton"/> + <click selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForSearchResults"/> + <!-- Should not see any search results --> + <dontSee userInput="$$createVirtualProduct.sku$$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/> + <see selector="{{StorefrontCatalogSearchMainSection.message}}" userInput="Your search returned no results." stepKey="seeCantFindProductOneMessage"/> + <!-- Go to the category page that we created in the before block --> + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> + <!-- Should not see the product --> + <dontSee userInput="$$createVirtualProduct.name$$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="dontSeeProductInCategory"/> + <see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/> + </test> +</tests> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Section/StorefrontCatalogSearchMainSection.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Section/StorefrontCatalogSearchMainSection.xml index 8b35ef3336175..667f08fea6579 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Section/StorefrontCatalogSearchMainSection.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Section/StorefrontCatalogSearchMainSection.xml @@ -15,5 +15,6 @@ <element name="SuccessMsg" type="button" selector="div.message-success"/> <element name="productCount" type="text" selector="#toolbar-amount"/> <element name="message" type="text" selector="div.message div"/> + <element name="searchResults" type="block" selector="#maincontent .column.main"/> </section> </sections> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminDeleteConfigurableProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminDeleteConfigurableProductTest.xml new file mode 100644 index 0000000000000..fb2920be528b6 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminDeleteConfigurableProductTest.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteConfigurableProductTest"> + <annotations> + <features value="ConfigurableProduct"/> + <stories value="Delete products"/> + <title value="Delete configurable product test"/> + <description value="Admin should be able to delete a configurable product"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11020"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="BaseConfigurableProduct" stepKey="createConfigurableProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteConfigurableProductFilteredBySkuAndName"> + <argument name="product" value="$$createConfigurableProduct$$"/> + </actionGroup> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> + <!-- Verify product on Product Page --> + <amOnPage url="{{StorefrontProductPage.url($$createConfigurableProduct.name$$)}}" stepKey="amOnConfigurableProductPage"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoops"/> + <!-- Search for the product by sku --> + <fillField selector="{{StorefrontQuickSearchSection.searchPhrase}}" userInput="$$createConfigurableProduct.sku$$" stepKey="fillSearchBarByProductSku"/> + <waitForPageLoad stepKey="waitForSearchButton"/> + <click selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForSearchResults"/> + <!-- Should not see any search results --> + <dontSee userInput="$$createConfigurableProduct.sku$$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/> + <see selector="{{StorefrontCatalogSearchMainSection.message}}" userInput="Your search returned no results." stepKey="seeCantFindProductOneMessage"/> + <!-- Go to the category page that we created in the before block --> + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> + <!-- Should not see the product --> + <dontSee userInput="$$createConfigurableProduct.name$$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="dontSeeProductInCategory"/> + <see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/> + </test> +</tests> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Data/LinkData.xml b/app/code/Magento/Downloadable/Test/Mftf/Data/LinkData.xml index 38ac2c99e4756..08f1c2349357d 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Data/LinkData.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Data/LinkData.xml @@ -31,6 +31,28 @@ <data key="file">magento-logo.png</data> <data key="sample">https://static.magento.com/sites/all/themes/mag_redesign/images/magento-logo.svg</data> </entity> + <entity name="downloadableLink1" type="downloadable_link"> + <data key="title" unique="suffix">link-1</data> + <data key="price">2.43</data> + <data key="number_of_downloads">2</data> + <data key="sample_type">url</data> + <data key="sample_url">http://example.com</data> + <data key="link_type">url</data> + <data key="link_url">http://example.com</data> + <data key="is_shareable">0</data> + <data key="sort_order">1</data> + </entity> + <entity name="downloadableLink2" type="downloadable_link"> + <data key="title" unique="suffix">link-2</data> + <data key="price">3</data> + <data key="number_of_downloads">3</data> + <data key="sample_type">url</data> + <data key="sample_url">http://example.com</data> + <data key="link_type">url</data> + <data key="link_url">http://example.com</data> + <data key="is_shareable">1</data> + <data key="sort_order">2</data> + </entity> <entity name="downloadableSampleFile" type="downloadable_sample"> <data key="title" unique="suffix">SampleFile</data> <data key="file_type">Upload File</data> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Downloadable/Test/Mftf/Data/ProductData.xml index 6a91b60dcb588..4bed31d9f854e 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Data/ProductData.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Data/ProductData.xml @@ -19,6 +19,20 @@ <data key="status">1</data> <data key="urlKey" unique="suffix">downloadableproduct</data> </entity> + <entity name="DownloadableProductWithTwoLink" type="product"> + <data key="sku" unique="suffix">downloadableproduct</data> + <data key="type_id">downloadable</data> + <data key="attribute_set_id">4</data> + <data key="name" unique="suffix">DownloadableProduct</data> + <data key="price">50.99</data> + <data key="quantity">100</data> + <data key="weight">0</data> + <data key="status">1</data> + <data key="urlKey" unique="suffix">downloadableproduct</data> + <requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity> + <requiredEntity type="downloadable_link">downloadableLink1</requiredEntity> + <requiredEntity type="downloadable_link">downloadableLink2</requiredEntity> + </entity> <entity name="ApiDownloadableProduct" type="product"> <data key="sku" unique="suffix">api-downloadable-product</data> <data key="type_id">downloadable</data> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDeleteDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDeleteDownloadableProductTest.xml new file mode 100644 index 0000000000000..d7e93d3429b96 --- /dev/null +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDeleteDownloadableProductTest.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteDownloadableProductTest"> + <annotations> + <features value="Downloadable"/> + <title value="Delete Downloadable Product"/> + <description value="Admin should be able to delete a downloadable product"/> + <testCaseId value="MC-11018"/> + <severity value="CRITICAL"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="DownloadableProductWithTwoLink" stepKey="createDownloadableProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <createData entity="downloadableLink1" stepKey="addDownloadableLink1"> + <requiredEntity createDataKey="createDownloadableProduct"/> + </createData> + <createData entity="downloadableLink2" stepKey="addDownloadableLink2"> + <requiredEntity createDataKey="createDownloadableProduct"/> + </createData> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteDownloadableProductFilteredBySkuAndName"> + <argument name="product" value="$$createDownloadableProduct$$"/> + </actionGroup> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> + <!--Verify product on Product Page --> + <amOnPage url="{{StorefrontProductPage.url($$createDownloadableProduct.name$$)}}" stepKey="amOnDownloadableProductPage"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoops"/> + <!-- Search for the product by sku --> + <fillField selector="{{StorefrontQuickSearchSection.searchPhrase}}" userInput="$$createDownloadableProduct.sku$$" stepKey="fillSearchBarByProductSku"/> + <waitForPageLoad stepKey="waitForSearchButton"/> + <click selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForSearchResults"/> + <!-- Should not see any search results --> + <dontSee userInput="$$createDownloadableProduct.sku$$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/> + <see selector="{{StorefrontCatalogSearchMainSection.message}}" userInput="Your search returned no results." stepKey="seeCantFindProductOneMessage"/> + <!-- Go to the category page that we created in the before block --> + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> + <!-- Should not see the product --> + <dontSee userInput="$$createDownloadableProduct.name$$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="dontSeeProductInCategory"/> + <see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/> + </test> +</tests> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Data/GroupedProductData.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Data/GroupedProductData.xml index 4d979953a934e..cb268b51f08f9 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Data/GroupedProductData.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Data/GroupedProductData.xml @@ -28,4 +28,16 @@ <requiredEntity type="custom_attribute_array">ApiProductDescription</requiredEntity> <requiredEntity type="custom_attribute_array">ApiProductShortDescription</requiredEntity> </entity> + <entity name="ApiGroupedProduct2" type="product3"> + <data key="sku" unique="suffix">api-grouped-product</data> + <data key="type_id">grouped</data> + <data key="attribute_set_id">4</data> + <data key="name" unique="suffix">Api Grouped Product</data> + <data key="status">1</data> + <data key="urlKey" unique="suffix">api-grouped-product</data> + <requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity> + <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> + <requiredEntity type="custom_attribute_array">ApiProductDescription</requiredEntity> + <requiredEntity type="custom_attribute_array">ApiProductShortDescription</requiredEntity> + </entity> </entities> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminDeleteGroupedProductTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminDeleteGroupedProductTest.xml new file mode 100644 index 0000000000000..966e24851395c --- /dev/null +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminDeleteGroupedProductTest.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteGroupedProductTest"> + <annotations> + <features value="GroupedProduct"/> + <title value="Delete Grouped Product"/> + <description value="Admin should be able to delete a grouped product"/> + <testCaseId value="MC-11019"/> + <severity value="CRITICAL"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="ApiProductWithDescription" stepKey="createSimpleProduct"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="ApiGroupedProduct2" stepKey="createGroupedProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <createData entity="OneSimpleProductLink" stepKey="addProductOne"> + <requiredEntity createDataKey="createGroupedProduct"/> + <requiredEntity createDataKey="createSimpleProduct"/> + </createData> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteGroupedProductFilteredBySkuAndName"> + <argument name="product" value="$$createGroupedProduct$$"/> + </actionGroup> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> + <!--Verify product on Product Page --> + <amOnPage url="{{StorefrontProductPage.url($$createGroupedProduct.name$$)}}" stepKey="amOnGroupedProductPage"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoops"/> + <!--Search for the product by sku--> + <fillField selector="{{StorefrontQuickSearchSection.searchPhrase}}" userInput="$$createGroupedProduct.sku$$" stepKey="fillSearchBarByProductSku"/> + <waitForPageLoad stepKey="waitForSearchButton"/> + <click selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForSearchResults"/> + <!-- Should not see any search results --> + <dontSee userInput="$$createGroupedProduct.sku$$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/> + <see selector="{{StorefrontCatalogSearchMainSection.message}}" userInput="Your search returned no results." stepKey="seeCantFindProductOneMessage"/> + <!-- Go to the category page that we created in the before block --> + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> + <!-- Should not see the product --> + <dontSee userInput="$$createGroupedProduct.name$$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="dontSeeProductInCategory"/> + <see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/> + </test> +</tests> From eb4284f745c62c2cb265fa529d491770c7610a19 Mon Sep 17 00:00:00 2001 From: Robin Rijkeboer <robin.rijkeboer@itonomy.nl> Date: Fri, 1 Feb 2019 19:37:33 +0100 Subject: [PATCH 106/238] Update MassAction.php to adhere to standards --- app/code/Magento/Ui/Component/MassAction.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Ui/Component/MassAction.php b/app/code/Magento/Ui/Component/MassAction.php index fe786da55faa9..c1a38a75e7fb2 100644 --- a/app/code/Magento/Ui/Component/MassAction.php +++ b/app/code/Magento/Ui/Component/MassAction.php @@ -21,12 +21,12 @@ public function prepare() $config = $this->getConfiguration(); foreach ($this->getChildComponents() as $actionComponent) { - $actionComponentConfig = $actionComponent->getConfiguration(); - $disabledAction = $actionComponentConfig['actionDisable'] ?? false; + $componentConfig = $actionComponent->getConfiguration(); + $disabledAction = $componentConfig['actionDisable'] ?? false; if ($disabledAction) { continue; } - $config['actions'][] = $actionComponentConfig; + $config['actions'][] = $componentConfig; } $origConfig = $this->getConfiguration(); From eb6d5e2ff017a4365306b4a95adde18b9e922f88 Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Wed, 30 Jan 2019 10:44:30 -0600 Subject: [PATCH 107/238] MC-4313: Convert DeleteAttributeSetTest to MFTF - Delete Attribute Set MFTF test --- .../AdminProductGridActionGroup.xml | 14 +++++ .../Mftf/Test/AdminDeleteAttributeSetTest.xml | 53 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml index 12cb1976ed6d0..533a1eb8f9593 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml @@ -144,6 +144,20 @@ <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> </actionGroup> + <!-- Filter product grid by sku, name --> + <actionGroup name="filerProductsBySkuAndName"> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad stepKey="waitForPageLoadInitial"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> + <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + </actionGroup> + <!--Delete a product by filtering grid and using delete action--> <actionGroup name="deleteProductUsingProductGrid"> <arguments> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml new file mode 100644 index 0000000000000..9b39ca8b382e6 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteAttributeSetTest"> + <annotations> + <features value="Catalog"/> + <title value="Delete Attribute Set"/> + <description value="Admin should be able to delete an attribute set"/> + <testCaseId value="MC-4413"/> + <severity value="CRITICAL"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> + <createData entity="SimpleProductWithCustomAttributeSet" stepKey="SimpleProductWithCustomAttributeSet"> + <requiredEntity createDataKey="createCategory"/> + <requiredEntity createDataKey="createAttributeSet"/> + </createData> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetsPage"/> + <fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="$$createAttributeSet.attribute_set_name$$" stepKey="filterByAttributeName"/> + <!-- Filter the grid to find created below attribute set --> + <click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch"/> + <click selector="{{AdminProductAttributeSetGridSection.nthRow('1')}}" stepKey="clickFirstRow"/> + <!-- Delete attribute set and confirm the modal --> + <click selector="{{AdminProductAttributeSetSection.deleteBtn}}" stepKey="clickDelete"/> + <click selector="{{AdminProductAttributeSetSection.modalOk}}" stepKey="confirmDelete"/> + <waitForPageLoad stepKey="waitForDeleteToFinish"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="The attribute set has been removed." stepKey="deleteMessage"/> + <!-- Assert the attribute set is not in the grid --> + <fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="$$createAttributeSet.attribute_set_name$$" stepKey="filterByAttributeName2"/> + <click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch2"/> + <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/> + <!-- Search for the product by sku and name on the product page --> + <actionGroup ref="filerProductsBySkuAndName" stepKey="filerProductsBySkuAndName"> + <argument name="product" value="SimpleProductWithCustomAttributeSet"/> + </actionGroup> + <!-- Should not see the product --> + <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage2"/> + </test> +</tests> From c1ce6d94b3b022b5858272fdb0aa5d5d28368ce3 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Fri, 1 Feb 2019 13:37:55 -0600 Subject: [PATCH 108/238] MC-4413: Convert DeleteAttributeSetTest to MFTF - Tweak actionGroup name and implementation --- .../Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml | 4 +--- .../Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml index 533a1eb8f9593..7d58f97e0cbb6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml @@ -145,12 +145,10 @@ </actionGroup> <!-- Filter product grid by sku, name --> - <actionGroup name="filerProductsBySkuAndName"> + <actionGroup name="filterProductGridBySkuAndName"> <arguments> <argument name="product" defaultValue="_defaultProduct"/> </arguments> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <waitForPageLoad stepKey="waitForPageLoadInitial"/> <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml index 9b39ca8b382e6..4d28ccbd44d2c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml @@ -44,7 +44,9 @@ <click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch2"/> <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/> <!-- Search for the product by sku and name on the product page --> - <actionGroup ref="filerProductsBySkuAndName" stepKey="filerProductsBySkuAndName"> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToAdminProductIndex"/> + <waitForPageLoad stepKey="waitForAdminProductIndex"/> + <actionGroup ref="filterProductGridBySkuAndName" stepKey="filerProductsBySkuAndName"> <argument name="product" value="SimpleProductWithCustomAttributeSet"/> </actionGroup> <!-- Should not see the product --> From 41db88255ff18acdc8e170f4a0e4ce880d0c5d05 Mon Sep 17 00:00:00 2001 From: Pieter Hoste <hoste.pieter@gmail.com> Date: Sat, 2 Feb 2019 14:21:29 +0100 Subject: [PATCH 109/238] Removed github oauth token in sample file. The token is a personal token and should not be used on the application level. --- auth.json.sample | 3 --- 1 file changed, 3 deletions(-) diff --git a/auth.json.sample b/auth.json.sample index 48b13ee8b69da..be1c70cfe1e18 100644 --- a/auth.json.sample +++ b/auth.json.sample @@ -1,7 +1,4 @@ { - "github-oauth": { - "github.com": "<github-personal-access-token>" - }, "http-basic": { "repo.magento.com": { "username": "<public-key>", From 3da7c76af8bd0c518e31bff67768672c496c94fc Mon Sep 17 00:00:00 2001 From: Aditya Yadav <adityayadav@cedcommerce.com> Date: Sun, 3 Feb 2019 10:12:04 +0530 Subject: [PATCH 110/238] Added Changes of Data Persistance for issue - #20888 --- .../SalesRule/Controller/Adminhtml/Promo/Quote/Save.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php index 388679e6d9eff..d600a9c14022c 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php @@ -8,6 +8,7 @@ use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Framework\Stdlib\DateTime\TimezoneInterface; +use \Magento\Framework\App\Request\DataPersistorInterface; /** * SalesRule save controller @@ -20,6 +21,11 @@ class Save extends \Magento\SalesRule\Controller\Adminhtml\Promo\Quote implement * @var TimezoneInterface */ private $timezone; + + /** + * @var DataPersistorInterface + */ + protected $dataPersistor; /** * @param \Magento\Backend\App\Action\Context $context @@ -27,6 +33,7 @@ class Save extends \Magento\SalesRule\Controller\Adminhtml\Promo\Quote implement * @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory * @param \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter * @param TimezoneInterface $timezone + * @param DataPersistorInterface $dataPersistor */ public function __construct( \Magento\Backend\App\Action\Context $context, @@ -39,6 +46,7 @@ public function __construct( $this->timezone = $timezone ?? \Magento\Framework\App\ObjectManager::getInstance()->get( TimezoneInterface::class ); + $this->dataPersistor = $dataPersistor; } /** @@ -89,6 +97,7 @@ public function execute() $this->messageManager->addErrorMessage($errorMessage); } $session->setPageData($data); + $this->dataPersistor->set('sale_rule', $data); $this->_redirect('sales_rule/*/edit', ['id' => $model->getId()]); return; } From d697ea68c237ca77fd8e935bf1f5a514d7947b5b Mon Sep 17 00:00:00 2001 From: Aditya Yadav <adityayadav@cedcommerce.com> Date: Sun, 3 Feb 2019 10:19:53 +0530 Subject: [PATCH 111/238] Changes in support of Issue 20888 Added Consideration of Data Persistance incase of Failed Submission of form. --- .../SalesRule/Model/Rule/DataProvider.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/code/Magento/SalesRule/Model/Rule/DataProvider.php b/app/code/Magento/SalesRule/Model/Rule/DataProvider.php index 916825776373d..f7daf7a1017de 100644 --- a/app/code/Magento/SalesRule/Model/Rule/DataProvider.php +++ b/app/code/Magento/SalesRule/Model/Rule/DataProvider.php @@ -8,6 +8,7 @@ use Magento\SalesRule\Model\ResourceModel\Rule\Collection; use Magento\SalesRule\Model\ResourceModel\Rule\CollectionFactory; use Magento\SalesRule\Model\Rule; +use Magento\Framework\App\Request\DataPersistorInterface; /** * Class DataProvider @@ -35,6 +36,11 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider * @var \Magento\SalesRule\Model\Rule\Metadata\ValueProvider */ protected $metadataValueProvider; + + /** + * @var DataPersistorInterface + */ + protected $dataPersistor; /** * Initialize dependencies. @@ -45,6 +51,7 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider * @param CollectionFactory $collectionFactory * @param \Magento\Framework\Registry $registry * @param Metadata\ValueProvider $metadataValueProvider + * @param DataPersistorInterface $dataPersistor * @param array $meta * @param array $data */ @@ -55,6 +62,7 @@ public function __construct( CollectionFactory $collectionFactory, \Magento\Framework\Registry $registry, \Magento\SalesRule\Model\Rule\Metadata\ValueProvider $metadataValueProvider, + DataPersistorInterface $dataPersistor, array $meta = [], array $data = [] ) { @@ -62,6 +70,7 @@ public function __construct( $this->coreRegistry = $registry; $this->metadataValueProvider = $metadataValueProvider; $meta = array_replace_recursive($this->getMetadataValues(), $meta); + $this->dataPersistor = $dataPersistor; parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data); } @@ -93,6 +102,13 @@ public function getData() $this->loadedData[$rule->getId()] = $rule->getData(); } + $data = $this->dataPersistor->get('sale_rule'); + if (!empty($data)) { + $rule = $this->collection->getNewEmptyItem(); + $rule->setData($data); + $this->loadedData[$rule->getId()] = $rule->getData(); + $this->dataPersistor->clear('sale_rule'); + } return $this->loadedData; } From 8ff4aa55e320cb9facba7149ca71bca3b5ecebea Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Sun, 3 Feb 2019 10:37:39 +0530 Subject: [PATCH 112/238] Updated Options.php --- app/code/Magento/Customer/Model/Options.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Model/Options.php b/app/code/Magento/Customer/Model/Options.php index 7747e309d82a6..19cac4a7bc326 100644 --- a/app/code/Magento/Customer/Model/Options.php +++ b/app/code/Magento/Customer/Model/Options.php @@ -91,7 +91,7 @@ private function prepareNamePrefixSuffixOptions($options, $isOptional = false) return false; } $result = []; - $options = explode(';', $options); + $options = array_filter(explode(';', $options)); foreach ($options as $value) { $value = $this->escaper->escapeHtml(trim($value)); $result[$value] = $value; From e34db300648121696ba3b6ba426c06a0065ade2c Mon Sep 17 00:00:00 2001 From: satyaprakashpatel <satyaprakash@cedcommerce.com> Date: Sun, 3 Feb 2019 11:45:47 +0530 Subject: [PATCH 113/238] fixed invalid date issue --- app/code/Magento/Ui/view/base/web/js/form/element/date.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index a5eb7d5d1f570..0f3fcd928942d 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -125,7 +125,9 @@ define([ shiftedValue = moment(value, dateFormat); } - + if(!shiftedValue.isValid()){ + shiftedValue = moment(value,this.inputDateFormat); + } shiftedValue = shiftedValue.format(this.pickerDateTimeFormat); } else { shiftedValue = ''; From ab10612be79b17703f0e77b953d578bd7e3b2815 Mon Sep 17 00:00:00 2001 From: Suneet <suneet64@gmail.com> Date: Sun, 3 Feb 2019 14:06:17 +0530 Subject: [PATCH 114/238] Fixed issue if there are multiple skus in catalog rule condition combination. --- .../Magento/Rule/Model/Condition/Product/AbstractProduct.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php index 5ab1379b96cf6..2c6144e75f32c 100644 --- a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php +++ b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php @@ -514,6 +514,10 @@ public function loadArray($arr) ) ? $this->_localeFormat->getNumber( $arr['is_value_parsed'] ) : false; + } elseif (!empty($arr['operator']) && $arr['operator'] == '()') { + if (isset($arr['value'])) { + $arr['value'] = preg_replace('/\s*,\s*/', ',', $arr['value']); + } } return parent::loadArray($arr); From 8faf8e98c3bc047f5cf0e5cb08d9ba6ebfcc5342 Mon Sep 17 00:00:00 2001 From: Aditya Yadav <adityayadav@cedcommerce.com> Date: Sun, 3 Feb 2019 14:54:17 +0530 Subject: [PATCH 115/238] Update Save.php Added Constructor Arguments. --- .../SalesRule/Controller/Adminhtml/Promo/Quote/Save.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php index d600a9c14022c..1a398d98af594 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php @@ -40,13 +40,15 @@ public function __construct( \Magento\Framework\Registry $coreRegistry, \Magento\Framework\App\Response\Http\FileFactory $fileFactory, \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter, - TimezoneInterface $timezone = null + TimezoneInterface $timezone = null, + DataPersistorInterface $dataPersistor = null ) { parent::__construct($context, $coreRegistry, $fileFactory, $dateFilter); $this->timezone = $timezone ?? \Magento\Framework\App\ObjectManager::getInstance()->get( TimezoneInterface::class ); - $this->dataPersistor = $dataPersistor; + $this->dataPersistor = $dataPersistor ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + DataPersistorInterface::class; } /** From e5abf956600086e6de8fa6486f1326850f031659 Mon Sep 17 00:00:00 2001 From: Aditya Yadav <adityayadav@cedcommerce.com> Date: Sun, 3 Feb 2019 17:07:44 +0530 Subject: [PATCH 116/238] Updated Variable acess modifier to private --- app/code/Magento/SalesRule/Model/Rule/DataProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/SalesRule/Model/Rule/DataProvider.php b/app/code/Magento/SalesRule/Model/Rule/DataProvider.php index f7daf7a1017de..cd04e35c698f4 100644 --- a/app/code/Magento/SalesRule/Model/Rule/DataProvider.php +++ b/app/code/Magento/SalesRule/Model/Rule/DataProvider.php @@ -40,7 +40,7 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider /** * @var DataPersistorInterface */ - protected $dataPersistor; + private $dataPersistor; /** * Initialize dependencies. From 811a7bf2331d6ba8df3326c86c5ea9da4140c40b Mon Sep 17 00:00:00 2001 From: Aditya Yadav <adityayadav@cedcommerce.com> Date: Sun, 3 Feb 2019 17:10:50 +0530 Subject: [PATCH 117/238] Changed Variable Access to Private. --- .../Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php index 1a398d98af594..63ff4abb4b391 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php @@ -25,7 +25,7 @@ class Save extends \Magento\SalesRule\Controller\Adminhtml\Promo\Quote implement /** * @var DataPersistorInterface */ - protected $dataPersistor; + private $dataPersistor; /** * @param \Magento\Backend\App\Action\Context $context From be874714e96cc17cd8d9de71159769aeabf7d10e Mon Sep 17 00:00:00 2001 From: Serhiy Zhovnir <s.zhovnir@atwix.com> Date: Sun, 3 Feb 2019 17:49:47 +0200 Subject: [PATCH 118/238] #18698 Fixed order email sending via order async email sending when order was created with disabled email sending --- app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php index f06da0de0fd00..7ac11ca073d26 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php @@ -97,7 +97,7 @@ public function __construct( */ public function send(Order $order, $forceSyncMode = false) { - $order->setSendEmail(true); + $order->setSendEmail($this->identityContainer->isEnabled()); if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) { if ($this->checkAndSend($order)) { From e5f5ecebd5a896bdcbf180434448c0fbfeffcb57 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Mon, 4 Feb 2019 10:34:36 +0200 Subject: [PATCH 119/238] ENGCOM-4022: Static test fix. --- .../Tax/view/frontend/web/js/view/checkout/summary/tax.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js index d65c0ffbf499c..2b1f387f5c8c4 100644 --- a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js +++ b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js @@ -108,6 +108,7 @@ define([ */ getTaxAmount: function (parent, percentage) { var totalPercentage = 0; + taxAmount = parent.amount; rates = parent.rates; _.each(rates, function (rate) { @@ -118,13 +119,13 @@ define([ }, /** - * @param {*} taxAmount + * @param {*} amount * @param {*} totalPercentage * @param {*} percentage * @return {*|String} */ - getPercentAmount: function (taxAmount, totalPercentage, percentage) { - return parseFloat((taxAmount * percentage) / totalPercentage); + getPercentAmount: function (amount, totalPercentage, percentage) { + return parseFloat(amount * percentage / totalPercentage); }, /** From 4812aa4ebbe72d9801fedb26fb50d7cf03e5033b Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Mon, 4 Feb 2019 12:38:59 +0200 Subject: [PATCH 120/238] ENGCOM-4069: Static test fix. --- .../Magento/blank/Magento_Sales/web/css/source/_module.less | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less index e9511d8d14426..298ccbf58e687 100644 --- a/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less @@ -295,7 +295,10 @@ } } .order-items.table-wrapper { - .col.price, .col.qty, .col.subtotal, .col.msrp { + .col.price, + .col.qty, + .col.subtotal, + .col.msrp { text-align: left; } } From 3162291c638d31619a65aa773e2f69ffdec2d3de Mon Sep 17 00:00:00 2001 From: Parag Chavare <parag@2jcommerce.in> Date: Mon, 4 Feb 2019 16:55:00 +0530 Subject: [PATCH 121/238] bundle-product-table-data-grouped-alignment :: Bundle product table data grouped alignment in mobile view --- .../web/css/source/_module.less | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_GroupedProduct/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_GroupedProduct/web/css/source/_module.less index 088372808aa6a..ef323eab94e68 100644 --- a/app/design/frontend/Magento/luma/Magento_GroupedProduct/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_GroupedProduct/web/css/source/_module.less @@ -133,10 +133,19 @@ } .media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) { + .product-add-form{ .table-wrapper.grouped { - .lib-css(margin-left, -@layout__width-xs-indent); - .lib-css(margin-right, -@layout__width-xs-indent); + .lib-css(margin-left, -@layout__width-xs-indent); + .lib-css(margin-right, -@layout__width-xs-indent); + .table.data.grouped{ + tr{ + td{ + padding: 5px 10px 5px 15px; + } + } + } } + } } // From e95de003f7cdee34977f247423d8843a115d9721 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Mon, 4 Feb 2019 15:43:56 +0200 Subject: [PATCH 122/238] ENGCOM-3470: Static test fix. --- app/code/Magento/CacheInvalidate/Model/PurgeCache.php | 3 +-- lib/internal/Magento/Framework/Cache/InvalidateLogger.php | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php index e236b5fb3908f..38f1a31422647 100644 --- a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php +++ b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php @@ -140,7 +140,6 @@ private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedT $errorCount = count($unresponsiveServerError); if ($errorCount > 0) { - $loggerMessage = implode(" ", $unresponsiveServerError); if ($errorCount == count($servers)) { @@ -150,7 +149,7 @@ private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedT ); return false; } - + $this->logger->warning( 'Unresponsive cache server(s) hit' . $loggerMessage, compact('server', 'formattedTagsChunk') diff --git a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php index dd97e88b6344b..08f9930a81b2f 100644 --- a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php +++ b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php @@ -10,6 +10,9 @@ use Magento\Framework\App\Request\Http as HttpRequest; use Psr\Log\LoggerInterface as Logger; +/** + * Invalidate logger cache. + */ class InvalidateLogger { /** @@ -34,6 +37,7 @@ public function __construct(HttpRequest $request, Logger $logger) /** * Logger invalidate cache + * * @param mixed $invalidateInfo * @return void */ @@ -44,6 +48,7 @@ public function execute($invalidateInfo) /** * Make extra data to logger message + * * @param mixed $invalidateInfo * @return array */ From c1be7d84b74d11455409c3ecfb12cb2bb27e3516 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Mon, 4 Feb 2019 16:24:56 +0200 Subject: [PATCH 123/238] ENGCOM-3616: Static test fix. --- .../Indexer/Price/CustomOptionPriceModifier.php | 10 ++++++++++ .../Product/Indexer/Price/DefaultPrice.php | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php index fccb17ea8cb35..463da8762b7cf 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php @@ -127,6 +127,8 @@ public function modifyPrice(IndexTableStructure $priceTable, array $entityIds = } /** + * Check if custom options exist. + * * @param IndexTableStructure $priceTable * @return bool * @throws \Exception @@ -154,6 +156,8 @@ private function checkIfCustomOptionsExist(IndexTableStructure $priceTable): boo } /** + * Get connection. + * * @return \Magento\Framework\DB\Adapter\AdapterInterface */ private function getConnection() @@ -373,6 +377,8 @@ private function getSelectAggregated(string $sourceTable): Select } /** + * Get select for update. + * * @param string $sourceTable * @return \Magento\Framework\DB\Select */ @@ -402,6 +408,8 @@ private function getSelectForUpdate(string $sourceTable): Select } /** + * Get table name. + * * @param string $tableName * @return string */ @@ -411,6 +419,8 @@ private function getTable(string $tableName): string } /** + * Is price scope global. + * * @return bool */ private function isPriceGlobal(): bool diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php index ae6ecd5269d47..3b4c3408e742b 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php @@ -10,6 +10,7 @@ /** * Default Product Type Price Indexer Resource model + * * For correctly work need define product type id * * @api @@ -208,6 +209,8 @@ public function reindexEntity($entityIds) } /** + * Reindex prices. + * * @param null|int|array $entityIds * @return \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\DefaultPrice */ @@ -802,6 +805,8 @@ public function getIdxTable($table = null) } /** + * Check if product exists. + * * @return bool */ protected function hasEntity() @@ -823,6 +828,8 @@ protected function hasEntity() } /** + * Get total tier price expression. + * * @param \Zend_Db_Expr $priceExpression * @return \Zend_Db_Expr */ @@ -863,6 +870,8 @@ private function getTotalTierPriceExpression(\Zend_Db_Expr $priceExpression) } /** + * Get tier price expression for table. + * * @param string $tableAlias * @param \Zend_Db_Expr $priceExpression * @return \Zend_Db_Expr From e71255eadc4b9680daa6f5c24366ad310daef76c Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Mon, 4 Feb 2019 17:05:58 +0200 Subject: [PATCH 124/238] MAGETWO-97966: [2.3] Country of Manufacture displays empty under More Information tab --- app/code/Magento/Catalog/Block/Product/View/Attributes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Block/Product/View/Attributes.php b/app/code/Magento/Catalog/Block/Product/View/Attributes.php index cb59d86a74512..2e474e2057b59 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Attributes.php +++ b/app/code/Magento/Catalog/Block/Product/View/Attributes.php @@ -88,7 +88,7 @@ public function getAdditionalData(array $excludeAttr = []) $value = $this->priceCurrency->convertAndFormat($value); } - if (is_string($value) && strlen($value)) { + if (is_string($value) && strlen(trim($value))) { $data[$attribute->getAttributeCode()] = [ 'label' => __($attribute->getStoreLabel()), 'value' => $value, From 11c998812e54dd0444d8441b5ce67f5689baaf45 Mon Sep 17 00:00:00 2001 From: Alex Calandra <calandra.aj@gmail.com> Date: Mon, 4 Feb 2019 09:50:54 -0600 Subject: [PATCH 125/238] MC-4405: Convert ProductTypeSwitchingOnCreationTest to MFTF - Added migrated tag to mtf variations --- .../TestCase/Product/ProductTypeSwitchingOnCreationTest.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml index 8fbb64f4579b1..2871d402441d6 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml @@ -11,6 +11,7 @@ <data name="tag" xsi:type="string">stable:no</data> <data name="createProduct" xsi:type="string">simple</data> <data name="product" xsi:type="string">configurableProduct::default</data> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid" /> @@ -23,12 +24,14 @@ <variation name="ProductTypeSwitchingOnCreationTestVariation2"> <data name="createProduct" xsi:type="string">simple</data> <data name="product" xsi:type="string">catalogProductVirtual::default</data> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> </variation> <variation name="ProductTypeSwitchingOnCreationTestVariation3"> <data name="createProduct" xsi:type="string">configurable</data> <data name="product" xsi:type="string">catalogProductSimple::product_without_category</data> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> </variation> @@ -42,6 +45,7 @@ <variation name="ProductTypeSwitchingOnCreationTestVariation5"> <data name="createProduct" xsi:type="string">virtual</data> <data name="product" xsi:type="string">catalogProductSimple::default</data> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> </variation> @@ -71,6 +75,7 @@ <variation name="ProductTypeSwitchingOnCreationTestVariation8"> <data name="createProduct" xsi:type="string">downloadable</data> <data name="product" xsi:type="string">catalogProductSimple::default</data> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> </variation> From 5edfbfcf47d5d90083d43f569c6d9b43f4c4ee35 Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Thu, 31 Jan 2019 12:22:07 -0600 Subject: [PATCH 126/238] MC-4411: Convert DeleteProductAttributeEntityTest to MFTF - Delete Product Attribute Text, Field (not assigned to Attribute Set) --- .../AdminProductAttributeActionGroup.xml | 39 +++++++++++ .../AdminProductAttributeSetActionGroup.xml | 10 +++ .../AdminProductAttributeGridSection.xml | 1 + .../Test/AdminDeleteProductAttributeTest.xml | 70 +++++++++++++++++++ .../Test/Mftf/Page/AdminExportIndexPage.xml | 14 ++++ .../Section/AdminExportAttributeSection.xml | 15 ++++ .../Mftf/Section/AdminExportMainSection.xml | 14 ++++ 7 files changed, 163 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml create mode 100644 app/code/Magento/ImportExport/Test/Mftf/Page/AdminExportIndexPage.xml create mode 100644 app/code/Magento/ImportExport/Test/Mftf/Section/AdminExportAttributeSection.xml create mode 100644 app/code/Magento/ImportExport/Test/Mftf/Section/AdminExportMainSection.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml index 80cadbb6571f2..b49ab1ab9e543 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml @@ -47,4 +47,43 @@ <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> </actionGroup> + <!-- Delete product attribute by Attribute Code --> + <actionGroup name="deleteProductAttributeByAttributeCode"> + <arguments> + <argument name="ProductAttributeCode" type="string"/> + </arguments> + <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> + <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" + userInput="{{ProductAttributeCode}}" stepKey="setAttributeCode"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> + <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/> + <waitForPageLoad stepKey="waitForPageLoad2" /> + <click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/> + <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" + stepKey="waitForSuccessMessage"/> + </actionGroup> + <!--Filter product attribute by Attribute Code --> + <actionGroup name="filterProductAttributeByAttributeCode"> + <arguments> + <argument name="ProductAttributeCode" type="string"/> + </arguments> + <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGrid"/> + <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" + userInput="{{ProductAttributeCode}}" stepKey="setAttributeCode"/> + <waitForPageLoad stepKey="waitForUserInput"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> + </actionGroup> + <!--Filter product attribute by Default Label --> + <actionGroup name="filterProductAttributeByDefaultLabel"> + <arguments> + <argument name="productAttributeLabel" type="string"/> + </arguments> + <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGrid"/> + <fillField selector="{{AdminProductAttributeGridSection.GridFilterFrontEndLabel}}" + userInput="{{productAttributeLabel}}" stepKey="setDefaultLabel"/> + <waitForPageLoad stepKey="waitForUserInput"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml index 5948ca12dcf0f..0595ad773238e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml @@ -45,4 +45,14 @@ <fillField selector="{{AdminProductAttributeSetSection.name}}" userInput="{{label}}" stepKey="fillName"/> <click selector="{{AdminProductAttributeSetSection.saveBtn}}" stepKey="clickSave1"/> </actionGroup> + <!-- Filter By Attribute Label --> + <actionGroup name="filterProductAttributeByAttributeLabel"> + <arguments> + <argument name="productAttributeLabel" type="string"/> + </arguments> + <fillField selector="{{AdminProductAttributeGridSection.attributeLabelFilter}}" + userInput="{{productAttributeLabel}}" stepKey="setAttributeLabel"/> + <waitForPageLoad stepKey="waitForUserInput"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml index 160948f8f1f2c..d3aaeefdc6bb2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml @@ -16,5 +16,6 @@ <element name="ResetFilter" type="button" selector="button[data-action='grid-filter-reset']" timeout="30"/> <element name="FirstRow" type="button" selector="//*[@id='attributeGrid_table']/tbody/tr[1]" timeout="30"/> <element name="FilterByAttributeCode" type="input" selector="#attributeGrid_filter_attribute_code"/> + <element name="attributeLabelFilter" type="input" selector="//input[@name='frontend_label']"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml new file mode 100644 index 0000000000000..e55685a2e39fd --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="DeleteProductAttributeTest"> + <annotations> + <features value="Catalog"/> + <title value="Delete Product Attribute"/> + <description value="Admin should able to delete a product attribute"/> + <testCaseId value="MC-4411"/> + <severity value="CRITICAL"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="productAttributeWysiwyg" stepKey="createProductAttribute"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <actionGroup ref="deleteProductAttributeByAttributeCode" stepKey="deleteProductAttribute"> + <argument name="ProductAttributeCode" value="$$createProductAttribute.attribute_code$$"/> + </actionGroup> + <!-- Assert the product attribute is not in the grid by Attribute code --> + <actionGroup ref="filterProductAttributeByAttributeCode" stepKey="filterByAttributeCode"> + <argument name="ProductAttributeCode" value="$$createProductAttribute.attribute_code$$"/> + </actionGroup> + <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" + userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/> + <!--Assert the product attribute is not in the grid by Default Label --> + <actionGroup ref="filterProductAttributeByDefaultLabel" stepKey="filterByDefaultLabel"> + <argument name="productAttributeLabel" value="$$createProductAttribute.default_frontend_label$$"/> + </actionGroup> + <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" + userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage2"/> + <!--Go to the Catalog > Products page and create Simple Product --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductList"/> + <waitForPageLoad stepKey="waitForProductList"/> + <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="toggleAddProductBtn"/> + <click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="chooseAddSimpleProduct"/> + <waitForPageLoad stepKey="waitForProductAdded"/> + <!-- Press Add Attribute button --> + <click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickAddAttributeBtn"/> + <waitForPageLoad stepKey="waitForAttributeAdded"/> + <!-- Filter By Attribute Label on Add Attribute Page --> + <click selector="{{AdminProductFiltersSection.filter}}" stepKey="clickOnFilter"/> + <actionGroup ref="filterProductAttributeByAttributeLabel" stepKey="filterByAttributeLabel"> + <argument name="productAttributeLabel" value="$$createProductAttribute.default_frontend_label$$"/> + </actionGroup> + <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" + userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage3"/> + <!-- Filter By Attribute Code on Export > Products page --> + <amOnPage url="{{AdminExportIndexPage.url}}" stepKey="navigateToSystemExport"/> + <selectOption selector="{{AdminExportMainSection.entityType}}" + userInput="Products" stepKey="selectProductsOption"/> + <waitForElementVisible selector="{{AdminExportMainSection.entityAttributes}}" stepKey="waitForElementVisible"/> + <click selector="{{AdminExportAttributeSection.resetFilter}}" stepKey="resetFilter"/> + <fillField selector="{{AdminExportAttributeSection.filterByAttributeCode}}" + userInput="$$createProductAttribute.attribute_code$$" stepKey="setAttributeCode"/> + <waitForPageLoad stepKey="waitForUserInput"/> + <click selector="{{AdminExportAttributeSection.search}}" stepKey="searchForAttribute"/> + <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" + userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage4"/> + </test> +</tests> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Page/AdminExportIndexPage.xml b/app/code/Magento/ImportExport/Test/Mftf/Page/AdminExportIndexPage.xml new file mode 100644 index 0000000000000..55ed3edd9bc79 --- /dev/null +++ b/app/code/Magento/ImportExport/Test/Mftf/Page/AdminExportIndexPage.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminExportIndexPage" url="admin/export/" area="admin" module="Magento_ImportExport"> + <section name="AdminExportMainSection"/> + </page> +</pages> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Section/AdminExportAttributeSection.xml b/app/code/Magento/ImportExport/Test/Mftf/Section/AdminExportAttributeSection.xml new file mode 100644 index 0000000000000..ad9e7672ce11a --- /dev/null +++ b/app/code/Magento/ImportExport/Test/Mftf/Section/AdminExportAttributeSection.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminExportAttributeSection"> + <element name="filterByAttributeCode" type="input" selector="#export_filter_grid_filter_attribute_code"/> + <element name="resetFilter" type="button" selector="button[data-action='grid-filter-reset']" timeout="30"/> + <element name="search" type="button" selector="button[data-action=grid-filter-apply]" timeout="30"/> + </section> +</sections> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Section/AdminExportMainSection.xml b/app/code/Magento/ImportExport/Test/Mftf/Section/AdminExportMainSection.xml new file mode 100644 index 0000000000000..da1d928607e75 --- /dev/null +++ b/app/code/Magento/ImportExport/Test/Mftf/Section/AdminExportMainSection.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminExportMainSection"> + <element name="entityType" type="select" selector="#entity"/> + <element name="entityAttributes" type="select" selector="#export_filter_form"/> + </section> +</sections> From e210f158fcb7fa2054ad2a379875590dad201ca4 Mon Sep 17 00:00:00 2001 From: John S <john00ivy@gmail.com> Date: Mon, 4 Feb 2019 10:06:03 -0600 Subject: [PATCH 127/238] MC-4380: Convert AdminCreateInactiveFlatCategory Tests to MFTF - Adding missing Page file. - Replacing "waitForLoadingMaskToDisappear" with "waitForPageLoad". - Adjusting selector slightly to clean it up. --- .../Test/Mftf/Page/AdminIndexManagementPage.xml | 14 ++++++++++++++ .../Mftf/Section/AdminIndexManagementSection.xml | 4 ++-- .../CreateCustomStoreViewActionGroup.xml | 7 ++++--- .../Mftf/Section/AdminStoresMainActionsSection.xml | 2 +- .../Test/Mftf/Section/StorefrontHeaderSection.xml | 2 +- 5 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 app/code/Magento/Indexer/Test/Mftf/Page/AdminIndexManagementPage.xml diff --git a/app/code/Magento/Indexer/Test/Mftf/Page/AdminIndexManagementPage.xml b/app/code/Magento/Indexer/Test/Mftf/Page/AdminIndexManagementPage.xml new file mode 100644 index 0000000000000..ed9a3dbb8c74b --- /dev/null +++ b/app/code/Magento/Indexer/Test/Mftf/Page/AdminIndexManagementPage.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminIndexManagementPage" url="indexer/indexer/list/" area="admin" module="Indexer"> + <section name="AdminIndexManagementSection"/> + </page> +</pages> diff --git a/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml b/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml index 99d1fb840e691..860b600de2b53 100644 --- a/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml +++ b/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml @@ -9,11 +9,11 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminIndexManagementSection"> - <!--<element name="catalogSearchCheckbox" type="checkbox" selector="input[value='catalogsearch_fulltext']"/>--> + <element name="catalogSearchCheckbox" type="checkbox" selector="input[value='catalogsearch_fulltext']"/> <element name="indexerCheckbox" type="checkbox" selector="input[value='{{var1}}']" parameterized="true"/> <element name="massActionSelect" type="select" selector="#gridIndexer_massaction-select"/> <element name="massActionSubmit" type="button" selector="#gridIndexer_massaction-form button"/> - <element name="indexerSelect" type="select" selector="//select[@class='action-select-multiselect']"/> + <element name="indexerSelect" type="select" selector="//select[contains(@class,'action-select-multiselect')]"/> <element name="indexerStatus" type="text" selector="//tr[descendant::td[contains(., '{{status}}')]]//*[contains(@class, 'col-indexer_status')]/span" parameterized="true"/> <element name="successMessage" type="text" selector="//*[@data-ui-id='messages-message-success']"/> </section> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml index 9f80bec905b01..7f9aa44f81531 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml @@ -5,6 +5,7 @@ * See COPYING.txt for license details. */ --> + <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="CreateCustomStoreViewActionGroup"> @@ -18,7 +19,7 @@ <fillField userInput="{{customStore.code}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/> <selectOption userInput="{{customStore.is_active}}" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/> <click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/> - <waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton" /> + <waitForPageLoad stepKey="waitForPageLoad2"/> <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/> </actionGroup> <actionGroup name="CreateStoreView"> @@ -26,13 +27,13 @@ <argument name="storeView" defaultValue="customStore"/> </arguments> <amOnPage url="{{AdminSystemStoreViewPage.url}}" stepKey="amOnAdminSystemStoreViewPage"/> - <waitForPageLoad stepKey="waitForProductPageLoad"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> <selectOption userInput="Main Website Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/> <fillField userInput="{{storeView.name}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/> <fillField userInput="{{storeView.code}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/> <selectOption userInput="Enabled" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/> <click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/> - <waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton" /> + <waitForPageLoad stepKey="waitForPageLoad2"/> <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/> <see userInput="You saved the store view." stepKey="seeSavedMessage"/> </actionGroup> diff --git a/app/code/Magento/Store/Test/Mftf/Section/AdminStoresMainActionsSection.xml b/app/code/Magento/Store/Test/Mftf/Section/AdminStoresMainActionsSection.xml index 98ad1db46732b..e40aa76967bec 100644 --- a/app/code/Magento/Store/Test/Mftf/Section/AdminStoresMainActionsSection.xml +++ b/app/code/Magento/Store/Test/Mftf/Section/AdminStoresMainActionsSection.xml @@ -10,7 +10,7 @@ <element name="createStoreViewButton" type="button" selector="#add_store" timeout="30"/> <element name="createStoreButton" type="button" selector="#add_group" timeout="30"/> <element name="createWebsiteButton" type="button" selector="#add" timeout="30"/> - <element name="saveButton" type="button" selector="#save" timeout="30"/> + <element name="saveButton" type="button" selector="#save" timeout="90"/> <element name="backButton" type="button" selector="#back" timeout="30"/> <element name="deleteButton" type="button" selector="#delete" timeout="30"/> </section> diff --git a/app/code/Magento/Store/Test/Mftf/Section/StorefrontHeaderSection.xml b/app/code/Magento/Store/Test/Mftf/Section/StorefrontHeaderSection.xml index c63bd5f48f9d1..37edf5f5e70d3 100644 --- a/app/code/Magento/Store/Test/Mftf/Section/StorefrontHeaderSection.xml +++ b/app/code/Magento/Store/Test/Mftf/Section/StorefrontHeaderSection.xml @@ -11,6 +11,6 @@ <element name="storeViewSwitcher" type="button" selector="#switcher-language-trigger"/> <element name="storeViewDropdown" type="button" selector="ul.switcher-dropdown"/> <element name="storeViewOption" type="button" selector="li.view-{{var1}}>a" parameterized="true"/> - <element name="storeViewList" type="button" selector="//li[contains(.,'{{storeViewName}}')]/a" parameterized="true"/> + <element name="storeViewList" type="button" selector="//li[contains(.,'{{storeViewName}}')]//a" parameterized="true"/> </section> </sections> From f505ea8385baf13eb78f70cd0abe15f1cc543dc2 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Mon, 4 Feb 2019 10:13:19 -0600 Subject: [PATCH 128/238] MC-4411: Convert DeleteProductAttributeEntityTest to MFTF - Fixed incorrect line breaks - Fixed testCaseId --- .../AdminProductAttributeActionGroup.xml | 12 ++++------- .../AdminProductAttributeSetActionGroup.xml | 3 +-- .../Test/AdminDeleteProductAttributeTest.xml | 20 +++++++------------ 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml index b49ab1ab9e543..a2f80b88512c2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml @@ -53,16 +53,14 @@ <argument name="ProductAttributeCode" type="string"/> </arguments> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> - <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" - userInput="{{ProductAttributeCode}}" stepKey="setAttributeCode"/> + <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{ProductAttributeCode}}" stepKey="setAttributeCode"/> <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/> <waitForPageLoad stepKey="waitForPageLoad2" /> <click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/> <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/> <waitForPageLoad stepKey="waitForPageLoad"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" - stepKey="waitForSuccessMessage"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> </actionGroup> <!--Filter product attribute by Attribute Code --> <actionGroup name="filterProductAttributeByAttributeCode"> @@ -70,8 +68,7 @@ <argument name="ProductAttributeCode" type="string"/> </arguments> <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGrid"/> - <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" - userInput="{{ProductAttributeCode}}" stepKey="setAttributeCode"/> + <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{ProductAttributeCode}}" stepKey="setAttributeCode"/> <waitForPageLoad stepKey="waitForUserInput"/> <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> </actionGroup> @@ -81,8 +78,7 @@ <argument name="productAttributeLabel" type="string"/> </arguments> <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGrid"/> - <fillField selector="{{AdminProductAttributeGridSection.GridFilterFrontEndLabel}}" - userInput="{{productAttributeLabel}}" stepKey="setDefaultLabel"/> + <fillField selector="{{AdminProductAttributeGridSection.GridFilterFrontEndLabel}}" userInput="{{productAttributeLabel}}" stepKey="setDefaultLabel"/> <waitForPageLoad stepKey="waitForUserInput"/> <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml index 0595ad773238e..a3b4203b7a69e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml @@ -50,8 +50,7 @@ <arguments> <argument name="productAttributeLabel" type="string"/> </arguments> - <fillField selector="{{AdminProductAttributeGridSection.attributeLabelFilter}}" - userInput="{{productAttributeLabel}}" stepKey="setAttributeLabel"/> + <fillField selector="{{AdminProductAttributeGridSection.attributeLabelFilter}}" userInput="{{productAttributeLabel}}" stepKey="setAttributeLabel"/> <waitForPageLoad stepKey="waitForUserInput"/> <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml index e55685a2e39fd..54b83e034fb11 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml @@ -12,7 +12,7 @@ <features value="Catalog"/> <title value="Delete Product Attribute"/> <description value="Admin should able to delete a product attribute"/> - <testCaseId value="MC-4411"/> + <testCaseId value="MC-10887"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> </annotations> @@ -30,14 +30,12 @@ <actionGroup ref="filterProductAttributeByAttributeCode" stepKey="filterByAttributeCode"> <argument name="ProductAttributeCode" value="$$createProductAttribute.attribute_code$$"/> </actionGroup> - <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" - userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/> + <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/> <!--Assert the product attribute is not in the grid by Default Label --> <actionGroup ref="filterProductAttributeByDefaultLabel" stepKey="filterByDefaultLabel"> <argument name="productAttributeLabel" value="$$createProductAttribute.default_frontend_label$$"/> </actionGroup> - <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" - userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage2"/> + <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage2"/> <!--Go to the Catalog > Products page and create Simple Product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductList"/> <waitForPageLoad stepKey="waitForProductList"/> @@ -52,19 +50,15 @@ <actionGroup ref="filterProductAttributeByAttributeLabel" stepKey="filterByAttributeLabel"> <argument name="productAttributeLabel" value="$$createProductAttribute.default_frontend_label$$"/> </actionGroup> - <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" - userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage3"/> + <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage3"/> <!-- Filter By Attribute Code on Export > Products page --> <amOnPage url="{{AdminExportIndexPage.url}}" stepKey="navigateToSystemExport"/> - <selectOption selector="{{AdminExportMainSection.entityType}}" - userInput="Products" stepKey="selectProductsOption"/> + <selectOption selector="{{AdminExportMainSection.entityType}}" userInput="Products" stepKey="selectProductsOption"/> <waitForElementVisible selector="{{AdminExportMainSection.entityAttributes}}" stepKey="waitForElementVisible"/> <click selector="{{AdminExportAttributeSection.resetFilter}}" stepKey="resetFilter"/> - <fillField selector="{{AdminExportAttributeSection.filterByAttributeCode}}" - userInput="$$createProductAttribute.attribute_code$$" stepKey="setAttributeCode"/> + <fillField selector="{{AdminExportAttributeSection.filterByAttributeCode}}" userInput="$$createProductAttribute.attribute_code$$" stepKey="setAttributeCode"/> <waitForPageLoad stepKey="waitForUserInput"/> <click selector="{{AdminExportAttributeSection.search}}" stepKey="searchForAttribute"/> - <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" - userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage4"/> + <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage4"/> </test> </tests> From 57364362b43216e6c391efa5c1a8113b2335ea98 Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Mon, 4 Feb 2019 13:36:01 -0600 Subject: [PATCH 129/238] MC-4386: Convert ManageProductsStockTest to MFTF Addressing review comments. --- .../Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml | 3 ++- .../AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml | 3 ++- .../AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml index bc91e394f25c1..e21c9f7e7f4ae 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml @@ -37,7 +37,8 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> <!-- Update product Advanced Inventory setting --> - <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click stepKey="openSelectedProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForProductToLoad"/> <click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/> <waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml index 6a9135aa81631..22fd844d667bc 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml @@ -37,7 +37,8 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> <!-- Update product Advanced Inventory Setting --> - <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click stepKey="openSelectedProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForProductToLoad"/> <click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/> <waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml index 6bb4bbec6c1bb..a59e71fa765a9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml @@ -40,7 +40,8 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> <!-- Update product Advanced Inventory Setting --> - <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click stepKey="openSelectedProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForProductToLoad"/> <click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/> <waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/> From 883272a508ef7efb591490f42eccf8d564ddee98 Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Mon, 4 Feb 2019 12:51:45 -0600 Subject: [PATCH 130/238] MC-4384: Convert UpdateCategoryEntityFlatDataTest to MFTF Addressing review comments. --- .../Test/Mftf/Page/AdminIndexManagementPage.xml | 13 +++++++++++++ .../CreateCustomStoreViewActionGroup.xml | 10 +++------- 2 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 app/code/Magento/Indexer/Test/Mftf/Page/AdminIndexManagementPage.xml diff --git a/app/code/Magento/Indexer/Test/Mftf/Page/AdminIndexManagementPage.xml b/app/code/Magento/Indexer/Test/Mftf/Page/AdminIndexManagementPage.xml new file mode 100644 index 0000000000000..e53d40bb01e62 --- /dev/null +++ b/app/code/Magento/Indexer/Test/Mftf/Page/AdminIndexManagementPage.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminIndexManagementPage" url="indexer/indexer/list/" area="admin" module="Magento_Indexer"> + </page> +</pages> \ No newline at end of file diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml index 0ee3887f6b4d9..1f7b3ddc3ab8c 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml @@ -27,17 +27,13 @@ </arguments> <amOnPage url="{{AdminSystemStoreViewPage.url}}" stepKey="amOnAdminSystemStoreViewPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> - <selectOption userInput="Main Website Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/> + <selectOption userInput="{{_defaultStoreGroup.name}}" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/> <fillField userInput="{{storeView.name}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/> <fillField userInput="{{storeView.code}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/> - <selectOption userInput="Enabled" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/> + <selectOption userInput="{{_defaultStore.is_active}}" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/> <click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/> <waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton" /> <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/> <see userInput="You saved the store view." stepKey="seeSavedMessage"/> </actionGroup> -</actionGroups> - - - - +</actionGroups> \ No newline at end of file From a3bf24bd49fa4d88b3464323a59e83398ebe74a2 Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Mon, 4 Feb 2019 14:50:14 -0600 Subject: [PATCH 131/238] MC-4384: Convert UpdateCategoryEntityFlatDataTest to MFTF Addressing the review comments. --- .../Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml index 1f7b3ddc3ab8c..5b086e8ad25f8 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml @@ -24,13 +24,15 @@ <actionGroup name="CreateStoreView"> <arguments> <argument name="storeView" defaultValue="customStore"/> + <argument name="storeGroupName" defaultValue="_defaultStoreGroup.name"/> + <argument name="storeViewStatus" defaultValue="_defaultStore.is_active"/> </arguments> <amOnPage url="{{AdminSystemStoreViewPage.url}}" stepKey="amOnAdminSystemStoreViewPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> - <selectOption userInput="{{_defaultStoreGroup.name}}" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/> + <selectOption userInput="{{storeGroupName}}" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/> <fillField userInput="{{storeView.name}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/> <fillField userInput="{{storeView.code}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/> - <selectOption userInput="{{_defaultStore.is_active}}" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/> + <selectOption userInput="{{storeViewStatus}}" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/> <click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/> <waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton" /> <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/> From 61532bb7bc862a9683f682e85f9043a599d43c50 Mon Sep 17 00:00:00 2001 From: Nainesh <nainesh@2jcommerce.in> Date: Tue, 5 Feb 2019 17:04:28 +0530 Subject: [PATCH 132/238] focus-not-proper-on-configurable-product-swatches:: focus not proper on configurable product swatches --- .../Magento_Catalog/web/css/source/_module.less | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less index 501a1d2918d6a..3f2ef2cc9ee28 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less @@ -294,6 +294,19 @@ } .product-options-wrapper { + &:focus { + box-shadow: none; + } + * { + &:focus { + box-shadow: none; + } + } + .swatch-option { + &:focus { + box-shadow: 0 0 3px 1px #00699d; + } + } .fieldset-product-options-inner { .legend { .lib-css(font-weight, @font-weight__semibold); From ab9bb4434e3b1a00961cfab8b2e1b5fc41ef374f Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Tue, 5 Feb 2019 15:41:33 +0200 Subject: [PATCH 133/238] ENGCOM-4111: Static test fixed. --- .../web/css/source/_module.less | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_GroupedProduct/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_GroupedProduct/web/css/source/_module.less index ef323eab94e68..fe49d6679a613 100644 --- a/app/design/frontend/Magento/luma/Magento_GroupedProduct/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_GroupedProduct/web/css/source/_module.less @@ -133,19 +133,19 @@ } .media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) { - .product-add-form{ - .table-wrapper.grouped { - .lib-css(margin-left, -@layout__width-xs-indent); - .lib-css(margin-right, -@layout__width-xs-indent); - .table.data.grouped{ - tr{ - td{ - padding: 5px 10px 5px 15px; - } + .product-add-form { + .table-wrapper.grouped { + .lib-css(margin-left, -@layout__width-xs-indent); + .lib-css(margin-right, -@layout__width-xs-indent); + .table.data.grouped { + tr { + td { + padding: 5px 10px 5px 15px; + } + } + } } - } } - } } // From 3748d4e912dd4c50a97e65e6c9bba18653aad533 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Tue, 5 Feb 2019 16:24:38 +0200 Subject: [PATCH 134/238] MAGETWO-97966: [2.3] Country of Manufacture displays empty under More Information tab - fixed static --- app/code/Magento/Catalog/Block/Product/View/Attributes.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Catalog/Block/Product/View/Attributes.php b/app/code/Magento/Catalog/Block/Product/View/Attributes.php index 2e474e2057b59..1cf9851d403a0 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Attributes.php +++ b/app/code/Magento/Catalog/Block/Product/View/Attributes.php @@ -16,6 +16,8 @@ use Magento\Framework\Pricing\PriceCurrencyInterface; /** + * Attributes attributes block + * * @api * @since 100.0.2 */ @@ -56,6 +58,8 @@ public function __construct( } /** + * Returns a Product + * * @return Product */ public function getProduct() From ba8ea1796e5a3fa9ad5dc92dde79535663001ad6 Mon Sep 17 00:00:00 2001 From: Patrick McLain <pat@pmclain.com> Date: Tue, 1 Jan 2019 21:12:20 -0500 Subject: [PATCH 135/238] Set isSecureArea to allow delete from ConsumerInterface::process I would propose a long-term solution be the creation of a `consumer` area code which would allow enabling deletes through `di.xml` similar to the `adminhtml`, `webapi_rest`, `webapi_soap` https://github.com/magento/magento2/blob/7648131e42d93ab2be23efa1983702659bbbbe84/app/code/Magento/Webapi/etc/webapi_rest/di.xml#L33 Fixes #24 --- .../Model/MassConsumer.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php index 28bc8141a8e99..86e691daa4213 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php @@ -9,6 +9,7 @@ namespace Magento\AsynchronousOperations\Model; use Magento\Framework\App\ResourceConnection; +use Magento\Framework\Registry; use Psr\Log\LoggerInterface; use Magento\Framework\MessageQueue\MessageLockException; use Magento\Framework\MessageQueue\ConnectionLostException; @@ -58,6 +59,11 @@ class MassConsumer implements ConsumerInterface */ private $operationProcessor; + /** + * @var Registry + */ + private $registry; + /** * Initialize dependencies. * @@ -67,6 +73,7 @@ class MassConsumer implements ConsumerInterface * @param ConsumerConfigurationInterface $configuration * @param OperationProcessorFactory $operationProcessorFactory * @param LoggerInterface $logger + * @param Registry $registry */ public function __construct( CallbackInvoker $invoker, @@ -74,7 +81,8 @@ public function __construct( MessageController $messageController, ConsumerConfigurationInterface $configuration, OperationProcessorFactory $operationProcessorFactory, - LoggerInterface $logger + LoggerInterface $logger, + Registry $registry = null ) { $this->invoker = $invoker; $this->resource = $resource; @@ -84,13 +92,17 @@ public function __construct( 'configuration' => $configuration ]); $this->logger = $logger; + $this->registry = $registry ?? \Magento\Framework\App\ObjectManager::getInstance() + ->get(Registry::class); } /** - * {@inheritdoc} + * @inheritdoc */ public function process($maxNumberOfMessages = null) { + $this->registry->register('isSecureArea', true, true); + $queue = $this->configuration->getQueue(); if (!isset($maxNumberOfMessages)) { @@ -98,6 +110,8 @@ public function process($maxNumberOfMessages = null) } else { $this->invoker->invoke($queue, $maxNumberOfMessages, $this->getTransactionCallback($queue)); } + + $this->registry->unregister('isSecureArea'); } /** From b10871164bc87ea2e3574b73765229132670a079 Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Tue, 5 Feb 2019 11:25:48 -0600 Subject: [PATCH 136/238] MC-4386: Convert ManageProductsStockTest to MFTF --- .../Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml | 6 ++++-- ...dminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml | 6 ++++-- .../AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml index e21c9f7e7f4ae..e3f4d6cbdde0d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml @@ -33,11 +33,13 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <!--Open Product Index Page--> + <!--Open Product Index Page and filter the product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <actionGroup ref="filterProductGridBySku" stepKey="filterProduct"> + <argument name="product" value="SimpleProduct"/> + </actionGroup> <!-- Update product Advanced Inventory setting --> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> <click stepKey="openSelectedProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForProductToLoad"/> <click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml index 22fd844d667bc..ee8b48a94b20d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml @@ -33,11 +33,13 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <!--Open Product Index Page--> + <!--Open Product Index Page and filter the product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <actionGroup ref="filterProductGridBySku" stepKey="filterProduct"> + <argument name="product" value="SimpleProduct"/> + </actionGroup> <!-- Update product Advanced Inventory Setting --> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> <click stepKey="openSelectedProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForProductToLoad"/> <click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml index a59e71fa765a9..e1cb45be22b4e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml @@ -36,11 +36,13 @@ <actionGroup ref="logout" stepKey="logout"/> <magentoCLI stepKey="setDisplayOutOfStockProduct" command="config:set cataloginventory/options/show_out_of_stock 0" /> </after> - <!--Open Product Index Page--> + <!--Open Product Index Page and filter the product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <actionGroup ref="filterProductGridBySku" stepKey="filterProduct"> + <argument name="product" value="SimpleProduct"/> + </actionGroup> <!-- Update product Advanced Inventory Setting --> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> <click stepKey="openSelectedProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForProductToLoad"/> <click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/> From 119fe1e3af48ebb4c8566434dc7d710dec450119 Mon Sep 17 00:00:00 2001 From: satya prakash <p.satyaprakash.viet.2009@gmail.com> Date: Tue, 5 Feb 2019 23:03:19 +0530 Subject: [PATCH 137/238] beautify code --- app/code/Magento/Ui/view/base/web/js/form/element/date.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index 0f3fcd928942d..299c33ba01972 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -122,11 +122,10 @@ define([ shiftedValue = moment.tz(value, 'UTC').tz(this.storeTimeZone); } else { dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat; - shiftedValue = moment(value, dateFormat); } - if(!shiftedValue.isValid()){ - shiftedValue = moment(value,this.inputDateFormat); + if (!shiftedValue.isValid()) { + shiftedValue = moment(value, this.inputDateFormat); } shiftedValue = shiftedValue.format(this.pickerDateTimeFormat); } else { From 600e090a2c4acdcbcbc2e95851debf17858e1435 Mon Sep 17 00:00:00 2001 From: Serhiy Zhovnir <s.zhovnir@atwix.com> Date: Tue, 5 Feb 2019 21:08:59 +0200 Subject: [PATCH 138/238] #18698 Adjust PHPUnit test for OrderSender --- .../Unit/Model/Order/Email/Sender/OrderSenderTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php index 46c44c03b1514..88053ea684ce8 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php @@ -64,7 +64,7 @@ public function testSend($configValue, $forceSyncMode, $emailSendingResult, $sen $this->orderMock->expects($this->once()) ->method('setSendEmail') - ->with(true); + ->with($emailSendingResult); $this->globalConfig->expects($this->once()) ->method('getValue') @@ -72,7 +72,7 @@ public function testSend($configValue, $forceSyncMode, $emailSendingResult, $sen ->willReturn($configValue); if (!$configValue || $forceSyncMode) { - $this->identityContainerMock->expects($this->once()) + $this->identityContainerMock->expects($this->exactly(2)) ->method('isEnabled') ->willReturn($emailSendingResult); @@ -118,7 +118,7 @@ public function testSend($configValue, $forceSyncMode, $emailSendingResult, $sen $this->orderMock->expects($this->once()) ->method('setEmailSent') - ->with(true); + ->with($emailSendingResult); $this->orderResourceMock->expects($this->once()) ->method('saveAttribute') @@ -210,7 +210,7 @@ public function testSendVirtualOrder($isVirtualOrder, $formatCallCount, $expecte ->with('sales_email/general/async_sending') ->willReturn(false); - $this->identityContainerMock->expects($this->once()) + $this->identityContainerMock->expects($this->exactly(2)) ->method('isEnabled') ->willReturn(true); From 20dc45a8a27f64914626dd25baa1773005ef85a5 Mon Sep 17 00:00:00 2001 From: Arvinda kumar <arvindakumar@cedcommerce.com> Date: Wed, 6 Feb 2019 14:03:31 +0530 Subject: [PATCH 139/238] issue fixed #20919 Email label and email field not aligned from left for reorder of guest user issue fixed #20919 Email label and email field not aligned from left for reorder of guest user --- .../css/source/module/order/_order-account.less | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/order/_order-account.less b/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/order/_order-account.less index e14bcbcddd47f..5494cf46c6f9d 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/order/_order-account.less +++ b/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/order/_order-account.less @@ -27,3 +27,18 @@ width: 50%; } } +.page-create-order { + .order-details { + &:not(.order-details-existing-customer) { + .order-account-information { + .field-email { + margin-left: -30px; + } + + .field-group_id { + margin-right: 30px; + } + } + } + } +} From 8ce891dd3005765c85551d7ea57422ffd84bbee6 Mon Sep 17 00:00:00 2001 From: Nainesh <nainesh@2jcommerce.in> Date: Wed, 6 Feb 2019 15:33:13 +0530 Subject: [PATCH 140/238] focus-not-proper-on-configurable-product-swatches:: focus not proper on configurable product swatches --- .../Magento_Swatches/web/css/source/_module.less | 8 ++++++++ .../luma/Magento_Catalog/web/css/source/_module.less | 11 ++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less index 28aa3f187e95c..11ebd48d449ba 100644 --- a/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less @@ -91,6 +91,10 @@ &-options { margin-top: @indent__s; + &:focus { + box-shadow: none; + } + .swatch-option-tooltip-layered .title { .lib-css(color, @swatch-option-tooltip-layered-title__color); width: 100%; @@ -132,6 +136,10 @@ text-align: center; text-overflow: ellipsis; + &:focus { + box-shadow: @focus__box-shadow; + } + &.text { .lib-css(background, @swatch-option-text__background); .lib-css(color, @swatch-option-text__color); diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less index 3f2ef2cc9ee28..fe4e1d20ee4b0 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less @@ -294,19 +294,12 @@ } .product-options-wrapper { - &:focus { - box-shadow: none; - } - * { + .fieldset { &:focus { box-shadow: none; } } - .swatch-option { - &:focus { - box-shadow: 0 0 3px 1px #00699d; - } - } + .fieldset-product-options-inner { .legend { .lib-css(font-weight, @font-weight__semibold); From 335cc77a0c9c232d4c17ee9e212845bd66962693 Mon Sep 17 00:00:00 2001 From: Sergey Shvets <sshvets@magento.com> Date: Wed, 6 Feb 2019 13:17:22 +0200 Subject: [PATCH 141/238] MAGETWO-98105: Import button is available in cases it's shouldn't. --- .../ImportExport/Controller/Adminhtml/Import/Validate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php b/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php index a0992e28bb2cd..fa84abca5ce23 100644 --- a/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php +++ b/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php @@ -136,7 +136,7 @@ private function getImport() private function addMessageToSkipErrors(Result $resultBlock) { $import = $this->getImport(); - if (!$import->getErrorAggregator()->hasFatalExceptions()) { + if (!$import->getErrorAggregator()->hasToBeTerminated()) { $resultBlock->addSuccess( __('Please fix errors and re-upload file or simply press "Import" button to skip rows with errors'), true From 89a572835bd3e35e8e511539c20e22d33b04dac8 Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko <serg.ivashchenko@gmail.com> Date: Wed, 6 Feb 2019 11:46:04 +0000 Subject: [PATCH 142/238] magento/magento2#20895: added missing closing bracket --- .../SalesRule/Controller/Adminhtml/Promo/Quote/Save.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php index 63ff4abb4b391..c1f540eb57d27 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php @@ -8,7 +8,7 @@ use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Framework\Stdlib\DateTime\TimezoneInterface; -use \Magento\Framework\App\Request\DataPersistorInterface; +use Magento\Framework\App\Request\DataPersistorInterface; /** * SalesRule save controller @@ -48,7 +48,8 @@ public function __construct( TimezoneInterface::class ); $this->dataPersistor = $dataPersistor ?? \Magento\Framework\App\ObjectManager::getInstance()->get( - DataPersistorInterface::class; + DataPersistorInterface::class + ); } /** From bf2a704f6e45e689678593fcc825c33f8863af38 Mon Sep 17 00:00:00 2001 From: priti <priti@2jcommerce.in> Date: Wed, 6 Feb 2019 17:57:08 +0530 Subject: [PATCH 143/238] products-in-category-checkbox-not-align-properly --- .../backend/Magento_Ui/web/css/source/module/_data-grid.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less index d55608ade4a05..6a8763fe154b8 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less +++ b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less @@ -1074,8 +1074,8 @@ body._in-resize { } .data-grid-checkbox-cell-inner { - margin: @data-grid-checkbox-cell-inner__padding-top @data-grid-checkbox-cell-inner__padding-horizontal .9rem; - padding: 0; + margin: 0; + padding: 0 @data-grid-checkbox-cell-inner__padding-horizontal 0 0; } // Content Hierarchy specific From aa669d346d16e2ad6b3fa8323c175b15797f7b03 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Wed, 6 Feb 2019 16:33:39 +0200 Subject: [PATCH 144/238] ENGCOM-3992: Static test fix. --- .../luma/Magento_Newsletter/web/css/source/_module.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less index b39b1d3ddf5c3..d7ee1319c9a43 100644 --- a/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less @@ -87,7 +87,7 @@ // _____________________________________________ .media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) { - .block{ + .block { &.newsletter { input { font-size: 12px; @@ -95,7 +95,7 @@ } .field { - .control:before{ + .control:before { font-size: 13px; } } From f4ad401448de9057b1662d2ae579ff6cce74a321 Mon Sep 17 00:00:00 2001 From: John S <john00ivy@gmail.com> Date: Tue, 5 Feb 2019 13:24:32 -0600 Subject: [PATCH 145/238] MC-4405: Convert ProductTypeSwitchingOnCreationTest to MFTF - Adjusting selector slightly to make them more stable. --- .../Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml | 2 +- .../Test/Mftf/Section/StorefrontProductInfoMainSection.xml | 2 +- .../Test/Mftf/Section/StorefrontProductInfoMainSection.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml index 845b7070e46cd..4d5646260fe26 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml @@ -25,7 +25,7 @@ <element name="productImage" type="text" selector="img.product-image-photo"/> <element name="productLink" type="text" selector="a.product-item-link"/> <element name="productLinkByHref" type="text" selector="a.product-item-link[href$='{{var1}}.html']" parameterized="true"/> - <element name="productPrice" type="text" selector="div.price-box.price-final_price"/> + <element name="productPrice" type="text" selector=".price-final_price"/> <element name="categoryImage" type="text" selector=".category-image"/> <element name="emptyProductMessage" type="block" selector=".message.info.empty>div"/> <element name="lineProductName" type="text" selector=".products.list.items.product-items li:nth-of-type({{line}}) .product-item-link" timeout="30" parameterized="true"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml index 6a4ac0d7683c7..2d56b2488a6df 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml @@ -13,7 +13,7 @@ <element name="productName" type="text" selector=".base"/> <element name="productSku" type="text" selector=".product.attribute.sku>.value"/> <element name="productPriceLabel" type="text" selector=".price-label"/> - <element name="productPrice" type="text" selector="div.price-box.price-final_price"/> + <element name="productPrice" type="text" selector=".price-final_price"/> <element name="qty" type="input" selector="#qty"/> <element name="specialPrice" type="text" selector=".special-price"/> <element name="specialPriceAmount" type="text" selector=".special-price span.price"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml index 522403cbf44d2..b64a52d7cea41 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml @@ -17,6 +17,6 @@ <!-- Parameter is the order number of the attribute on the page (1 is the newest) --> <element name="nthAttributeOnPage" type="block" selector="tr:nth-of-type({{numElement}}) .data" parameterized="true"/> <element name="stockIndication" type="block" selector=".stock" /> - <element name="attributeOptionByAttributeID" type="select" selector="//div[@class='fieldset']/div[//span[text()='{{attribute_code}}']]//option[text()='{{optionName}}']" parameterized="true"/> + <element name="attributeOptionByAttributeID" type="select" selector="//div[@class='fieldset']//div[//span[text()='{{attribute_code}}']]//option[text()='{{optionName}}']" parameterized="true"/> </section> </sections> From c3845db335eea03a2d234042910e6e0d106a21f5 Mon Sep 17 00:00:00 2001 From: Vitaliy Boyko <v.boyko@atwix.com> Date: Wed, 6 Feb 2019 17:55:00 +0200 Subject: [PATCH 146/238] graphQl-263: removed unused param and static fixes --- .../GraphQl/SendFriend/SendFriendTest.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php index 57e61895e6d17..5d84b5846fce9 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php @@ -20,14 +20,9 @@ class SendFriendTest extends GraphQlAbstract * @var SendFriendFactory */ private $sendFriendFactory; - /** - * @var DataObjectFactory - */ - private $dataObjectFactory; protected function setUp() { - $this->dataObjectFactory = Bootstrap::getObjectManager()->get(DataObjectFactory::class); $this->sendFriendFactory = Bootstrap::getObjectManager()->get(SendFriendFactory::class); } @@ -120,7 +115,9 @@ public function testSendWithoutExistProduct() } QUERY; $this->expectException(\Exception::class); - $this->expectExceptionMessage('The product that was requested doesn\'t exist. Verify the product and try again.'); + $this->expectExceptionMessage( + 'The product that was requested doesn\'t exist. Verify the product and try again.' + ); $this->graphQlQuery($query); } @@ -191,7 +188,7 @@ public function testMaxSendEmailToFriend() /** * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php */ - public function testSendWithoutRecipentsName() + public function testSendWithoutRecipientName() { $query = <<<QUERY @@ -236,7 +233,7 @@ public function testSendWithoutRecipentsName() /** * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php */ - public function testSendWithoutRecipentsEmail() + public function testSendWithoutRecipientEmail() { $query = <<<QUERY @@ -460,7 +457,9 @@ public function testLimitMessagesPerHour() } QUERY; $this->expectException(\Exception::class); - $this->expectExceptionMessage("You can't send messages more than {$sendFriend->getMaxSendsToFriend()} times an hour."); + $this->expectExceptionMessage( + "You can't send messages more than {$sendFriend->getMaxSendsToFriend()} times an hour." + ); for ($i = 0; $i <= $sendFriend->getMaxSendsToFriend() + 1; $i++) { $this->graphQlQuery($query); From 32accc927c867cbf42e218063f4d449ee9346f27 Mon Sep 17 00:00:00 2001 From: Arvinda kumar <arvindakumar@cedcommerce.com> Date: Wed, 6 Feb 2019 09:53:28 -0800 Subject: [PATCH 147/238] _order-account.less updated _order-account.less updated --- .../web/css/source/module/order/_order-account.less | 1 + 1 file changed, 1 insertion(+) diff --git a/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/order/_order-account.less b/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/order/_order-account.less index 5494cf46c6f9d..f66e94940c55d 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/order/_order-account.less +++ b/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/order/_order-account.less @@ -27,6 +27,7 @@ width: 50%; } } + .page-create-order { .order-details { &:not(.order-details-existing-customer) { From 89808eda5bdad5ab9907f763e029a87254df235f Mon Sep 17 00:00:00 2001 From: Valerii Naida <vnayda@adobe.com> Date: Wed, 6 Feb 2019 14:05:04 -0600 Subject: [PATCH 148/238] GraphQL-256: [Query] My Account > Stored Payment Methods -- fix static tests --- app/code/Magento/VaultGraphQl/etc/module.xml | 8 +------- composer.lock | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/VaultGraphQl/etc/module.xml b/app/code/Magento/VaultGraphQl/etc/module.xml index 8d29b7983c79f..f821d9fa67041 100644 --- a/app/code/Magento/VaultGraphQl/etc/module.xml +++ b/app/code/Magento/VaultGraphQl/etc/module.xml @@ -6,11 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_VaultGraphQl" > - <sequence> - <module name="Magento_Vault"/> - <module name="Magento_GraphQl"/> - <module name="Magento_CustomerGraphQl"/> - </sequence> - </module> + <module name="Magento_VaultGraphQl"/> </config> diff --git a/composer.lock b/composer.lock index 697e7df3e19aa..437d4f3bdb6d2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3f58ddc5609e6a934ee3706006357646", + "content-hash": "cbb00c4fca63f582602807151c7ecd2c", "packages": [ { "name": "braintree/braintree_php", @@ -2165,7 +2165,7 @@ }, { "name": "Gert de Pagter", - "email": "backendtea@gmail.com" + "email": "BackEndTea@gmail.com" } ], "description": "Symfony polyfill for ctype functions", From fdaa3ada5456a1c88d3d99f29008bc3100b1358f Mon Sep 17 00:00:00 2001 From: Vitaliy Boyko <v.boyko@atwix.com> Date: Wed, 6 Feb 2019 22:18:31 +0200 Subject: [PATCH 149/238] graphQl-167: removed redundant fixture, optimised tests --- .../GraphQl/SendFriend/SendFriendTest.php | 245 +++++------------- .../SendFriend/_files/product_simple.php | 212 --------------- 2 files changed, 67 insertions(+), 390 deletions(-) delete mode 100644 dev/tests/integration/testsuite/Magento/SendFriend/_files/product_simple.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php index 5d84b5846fce9..05e3e608c5e52 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php @@ -7,7 +7,6 @@ namespace Magento\GraphQl\SendFriend; -use Magento\Framework\DataObjectFactory; use Magento\SendFriend\Model\SendFriend; use Magento\SendFriend\Model\SendFriendFactory; use Magento\TestFramework\Helper\Bootstrap; @@ -27,7 +26,7 @@ protected function setUp() } /** - * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php + * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php */ public function testSendFriend() { @@ -122,7 +121,7 @@ public function testSendWithoutExistProduct() } /** - * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php + * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php */ public function testMaxSendEmailToFriend() { @@ -186,31 +185,19 @@ public function testMaxSendEmailToFriend() } /** - * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php + * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php + * @dataProvider sendFriendsErrorsDataProvider + * @param string $input + * @param string $errorMessage */ - public function testSendWithoutRecipientName() + public function testErrors(string $input, string $errorMessage) { $query = <<<QUERY mutation { sendEmailToFriend( input: { - product_id: 1 - sender: { - name: "Name" - email: "e@mail.com" - message: "Lorem Ipsum" - } - recipients: [ - { - name: "" - email:"recipient1@mail.com" - }, - { - name: "" - email:"recipient2@mail.com" - } - ] + $input } ) { sender { @@ -226,37 +213,44 @@ public function testSendWithoutRecipientName() } QUERY; $this->expectException(\Exception::class); - $this->expectExceptionMessage('Please provide Name for all of recipients.'); + $this->expectExceptionMessage($errorMessage); $this->graphQlQuery($query); } /** - * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php + * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php + * TODO: use magentoApiConfigFixture (to be merged https://github.com/magento/graphql-ce/pull/351) + * @magentoApiDataFixture Magento/SendFriend/Fixtures/sendfriend_configuration.php */ - public function testSendWithoutRecipientEmail() + public function testLimitMessagesPerHour() { + + /** @var SendFriend $sendFriend */ + $sendFriend = $this->sendFriendFactory->create(); + $query = <<<QUERY mutation { sendEmailToFriend( input: { - product_id: 1 + product_id: 1 sender: { name: "Name" email: "e@mail.com" message: "Lorem Ipsum" - } + } recipients: [ - { + { name: "Recipient Name 1" - email:"" + email:"recipient1@mail.com" }, - { + { name: "Recipient Name 2" - email:"" - } + email:"recipient2@mail.com" + } + ] - } + } ) { sender { name @@ -271,115 +265,63 @@ public function testSendWithoutRecipientEmail() } QUERY; $this->expectException(\Exception::class); - $this->expectExceptionMessage('Please provide Email for all of recipients.'); - $this->graphQlQuery($query); + $this->expectExceptionMessage( + "You can't send messages more than {$sendFriend->getMaxSendsToFriend()} times an hour." + ); + + for ($i = 0; $i <= $sendFriend->getMaxSendsToFriend() + 1; $i++) { + $this->graphQlQuery($query); + } } /** - * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php + * @return array */ - public function testSendWithoutSenderName() + public function sendFriendsErrorsDataProvider() { - $query = - <<<QUERY -mutation { - sendEmailToFriend( - input: { - product_id: 1 - sender: { - name: "" + return [ + [ + 'product_id: 1 + sender: { + name: "Name" email: "e@mail.com" message: "Lorem Ipsum" } recipients: [ { - name: "Recipient Name 1" + name: "" email:"recipient1@mail.com" }, { - name: "Recipient Name 2" + name: "" email:"recipient2@mail.com" } - ] - } - ) { - sender { - name - email - message - } - recipients { - name - email - } - } -} -QUERY; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('Please provide Name of sender.'); - $this->graphQlQuery($query); - } - - /** - * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php - */ - public function testSendWithoutSenderEmail() - { - $query = - <<<QUERY -mutation { - sendEmailToFriend( - input: { - product_id: 1 + ]', 'Please provide Name for all of recipients.' + ], + [ + 'product_id: 1 sender: { name: "Name" - email: "" + email: "e@mail.com" message: "Lorem Ipsum" } recipients: [ { name: "Recipient Name 1" - email:"recipient1@mail.com" + email:"" }, { name: "Recipient Name 2" - email:"recipient2@mail.com" + email:"" } - ] - } - ) { - sender { - name - email - message - } - recipients { - name - email - } - } -} -QUERY; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('Please provide Email of sender.'); - $this->graphQlQuery($query); - } - - /** - * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php - */ - public function testSendWithoutSenderMessage() - { - $query = - <<<QUERY -mutation { - sendEmailToFriend( - input: { - product_id: 1 + ]', 'Please provide Email for all of recipients.' + ], + [ + 'product_id: 1 sender: { - name: "Name" + name: "" email: "e@mail.com" - message: "" + message: "Lorem Ipsum" } recipients: [ { @@ -390,79 +332,26 @@ public function testSendWithoutSenderMessage() name: "Recipient Name 2" email:"recipient2@mail.com" } - ] - } - ) { - sender { - name - email - message - } - recipients { - name - email - } - } -} -QUERY; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('Please provide Message.'); - $this->graphQlQuery($query); - } - - /** - * @magentoApiDataFixture Magento/SendFriend/_files/product_simple.php - * @magentoApiDataFixture Magento/SendFriend/Fixtures/sendfriend_configuration.php - */ - public function testLimitMessagesPerHour() - { - - /** @var SendFriend $sendFriend */ - $sendFriend = $this->sendFriendFactory->create(); - - $query = - <<<QUERY -mutation { - sendEmailToFriend( - input: { - product_id: 1 + ]', 'Please provide Name of sender.' + ], + [ + 'product_id: 1 sender: { name: "Name" email: "e@mail.com" - message: "Lorem Ipsum" - } + message: "" + } recipients: [ - { + { name: "Recipient Name 1" email:"recipient1@mail.com" }, - { + { name: "Recipient Name 2" email:"recipient2@mail.com" - } - - ] - } - ) { - sender { - name - email - message - } - recipients { - name - email - } - } -} -QUERY; - $this->expectException(\Exception::class); - $this->expectExceptionMessage( - "You can't send messages more than {$sendFriend->getMaxSendsToFriend()} times an hour." - ); - - for ($i = 0; $i <= $sendFriend->getMaxSendsToFriend() + 1; $i++) { - $this->graphQlQuery($query); - } + } + ]', 'Please provide Message.' + ] + ]; } } diff --git a/dev/tests/integration/testsuite/Magento/SendFriend/_files/product_simple.php b/dev/tests/integration/testsuite/Magento/SendFriend/_files/product_simple.php deleted file mode 100644 index c275996000814..0000000000000 --- a/dev/tests/integration/testsuite/Magento/SendFriend/_files/product_simple.php +++ /dev/null @@ -1,212 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -use Magento\Catalog\Api\Data\ProductTierPriceExtensionFactory; -use Magento\Catalog\Api\Data\ProductExtensionInterfaceFactory; - -\Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(); - -/** @var \Magento\TestFramework\ObjectManager $objectManager */ -$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - -/** @var \Magento\Catalog\Api\CategoryLinkManagementInterface $categoryLinkManagement */ -$categoryLinkManagement = $objectManager->get(\Magento\Catalog\Api\CategoryLinkManagementInterface::class); - -$tierPrices = []; -/** @var \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory */ -$tierPriceFactory = $objectManager->get(\Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory::class); -/** @var $tpExtensionAttributes */ -$tpExtensionAttributesFactory = $objectManager->get(ProductTierPriceExtensionFactory::class); -/** @var $productExtensionAttributes */ -$productExtensionAttributesFactory = $objectManager->get(ProductExtensionInterfaceFactory::class); - -$adminWebsite = $objectManager->get(\Magento\Store\Api\WebsiteRepositoryInterface::class)->get('admin'); -$tierPriceExtensionAttributes1 = $tpExtensionAttributesFactory->create() - ->setWebsiteId($adminWebsite->getId()); -$productExtensionAttributesWebsiteIds = $productExtensionAttributesFactory->create( - ['website_ids' => $adminWebsite->getId()] -); - -$tierPrices[] = $tierPriceFactory->create( - [ - 'data' => [ - 'customer_group_id' => \Magento\Customer\Model\Group::CUST_GROUP_ALL, - 'qty' => 2, - 'value' => 8 - ] - ] -)->setExtensionAttributes($tierPriceExtensionAttributes1); - -$tierPrices[] = $tierPriceFactory->create( - [ - 'data' => [ - 'customer_group_id' => \Magento\Customer\Model\Group::CUST_GROUP_ALL, - 'qty' => 5, - 'value' => 5 - ] - ] -)->setExtensionAttributes($tierPriceExtensionAttributes1); - -$tierPrices[] = $tierPriceFactory->create( - [ - 'data' => [ - 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, - 'qty' => 3, - 'value' => 5 - ] - ] -)->setExtensionAttributes($tierPriceExtensionAttributes1); - -$tierPriceExtensionAttributes2 = $tpExtensionAttributesFactory->create() - ->setWebsiteId($adminWebsite->getId()) - ->setPercentageValue(50); - -$tierPrices[] = $tierPriceFactory->create( - [ - 'data' => [ - 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, - 'qty' => 10 - ] - ] -)->setExtensionAttributes($tierPriceExtensionAttributes2); - -/** @var $product \Magento\Catalog\Model\Product */ -$product = $objectManager->create(\Magento\Catalog\Model\Product::class); -$product->isObjectNew(true); -$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) - ->setId(1) - ->setAttributeSetId(4) - ->setWebsiteIds([1]) - ->setName('Simple Product') - ->setSku('simple') - ->setPrice(10) - ->setWeight(1) - ->setShortDescription("Short description") - ->setTaxClassId(0) - ->setTierPrices($tierPrices) - ->setDescription('Description with <b>html tag</b>') - ->setExtensionAttributes($productExtensionAttributesWebsiteIds) - ->setMetaTitle('meta title') - ->setMetaKeyword('meta keyword') - ->setMetaDescription('meta description') - ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) - ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) - ->setStockData( - [ - 'use_config_manage_stock' => 1, - 'qty' => 100, - 'is_qty_decimal' => 0, - 'is_in_stock' => 1, - ] - )->setCanSaveCustomOptions(true) - ->setHasOptions(true); - -$oldOptions = [ - [ - 'previous_group' => 'text', - 'title' => 'Test Field', - 'type' => 'field', - 'is_require' => 1, - 'sort_order' => 0, - 'price' => 1, - 'price_type' => 'fixed', - 'sku' => '1-text', - 'max_characters' => 100, - ], - [ - 'previous_group' => 'date', - 'title' => 'Test Date and Time', - 'type' => 'date_time', - 'is_require' => 1, - 'sort_order' => 0, - 'price' => 2, - 'price_type' => 'fixed', - 'sku' => '2-date', - ], - [ - 'previous_group' => 'select', - 'title' => 'Test Select', - 'type' => 'drop_down', - 'is_require' => 1, - 'sort_order' => 0, - 'values' => [ - [ - 'option_type_id' => null, - 'title' => 'Option 1', - 'price' => 3, - 'price_type' => 'fixed', - 'sku' => '3-1-select', - ], - [ - 'option_type_id' => null, - 'title' => 'Option 2', - 'price' => 3, - 'price_type' => 'fixed', - 'sku' => '3-2-select', - ], - ] - ], - [ - 'previous_group' => 'select', - 'title' => 'Test Radio', - 'type' => 'radio', - 'is_require' => 1, - 'sort_order' => 0, - 'values' => [ - [ - 'option_type_id' => null, - 'title' => 'Option 1', - 'price' => 3, - 'price_type' => 'fixed', - 'sku' => '4-1-radio', - ], - [ - 'option_type_id' => null, - 'title' => 'Option 2', - 'price' => 3, - 'price_type' => 'fixed', - 'sku' => '4-2-radio', - ], - ] - ] -]; - -$options = []; - -/** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory $customOptionFactory */ -$customOptionFactory = $objectManager->create(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class); - -foreach ($oldOptions as $option) { - /** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterface $option */ - $option = $customOptionFactory->create(['data' => $option]); - $option->setProductSku($product->getSku()); - - $options[] = $option; -} - -$product->setOptions($options); - -/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ -$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); -$productRepository->save($product); - -$categoryLinkManagement->assignProductToCategories( - $product->getSku(), - [2] -); -///** -// * @var $configWriter \Magento\Framework\App\Config\Storage\WriterInterface -// */ -//$configWriter = $objectManager->get(\Magento\Framework\App\Config\Storage\WriterInterface::class); -///** -// * @var $cacheManager \Magento\Framework\App\Cache\Manager -// */ -//$cacheManager = $objectManager->get(\Magento\Framework\App\Cache\Manager::class); -//$configWriter->save('sendfriend/email/max_per_hour', 1); -//$configWriter->save('sendfriend/email/check_by', 1); -//$types = $cacheManager->getAvailableTypes(); -//$cacheManager->clean($types); - From cc0b1cd7334f8f54f673739494f3542e4a7afca6 Mon Sep 17 00:00:00 2001 From: Patrick McLain <pat@pmclain.com> Date: Wed, 6 Feb 2019 17:32:11 -0500 Subject: [PATCH 150/238] Fix static tests --- .../Model/Resolver/PaymentTokens.php | 14 +-- .../Model/VisibleTokenRetriever.php | 110 ------------------ .../Vault/CustomerPaymentTokensTest.php | 7 +- 3 files changed, 10 insertions(+), 121 deletions(-) delete mode 100644 app/code/Magento/VaultGraphQl/Model/VisibleTokenRetriever.php diff --git a/app/code/Magento/VaultGraphQl/Model/Resolver/PaymentTokens.php b/app/code/Magento/VaultGraphQl/Model/Resolver/PaymentTokens.php index d76cbd058e44e..80e81037bb5dd 100644 --- a/app/code/Magento/VaultGraphQl/Model/Resolver/PaymentTokens.php +++ b/app/code/Magento/VaultGraphQl/Model/Resolver/PaymentTokens.php @@ -10,7 +10,7 @@ use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; -use Magento\VaultGraphQl\Model\VisibleTokenRetriever; +use Magento\Vault\Model\PaymentTokenManagement; use Magento\CustomerGraphQl\Model\Customer\CheckCustomerAccount; /** @@ -19,9 +19,9 @@ class PaymentTokens implements ResolverInterface { /** - * @var VisibleTokenRetriever + * @var PaymentTokenManagement */ - private $visibleTokenRetriever; + private $paymentTokenManagement; /** * @var CheckCustomerAccount @@ -29,14 +29,14 @@ class PaymentTokens implements ResolverInterface private $checkCustomerAccount; /** - * @param VisibleTokenRetriever $visibleTokenRetriever + * @param PaymentTokenManagement $paymentTokenManagement * @param CheckCustomerAccount $checkCustomerAccount */ public function __construct( - VisibleTokenRetriever $visibleTokenRetriever, + PaymentTokenManagement $paymentTokenManagement, CheckCustomerAccount $checkCustomerAccount ) { - $this->visibleTokenRetriever = $visibleTokenRetriever; + $this->paymentTokenManagement = $paymentTokenManagement; $this->checkCustomerAccount = $checkCustomerAccount; } @@ -55,7 +55,7 @@ public function resolve( $this->checkCustomerAccount->execute($currentUserId, $currentUserType); - $tokens = $this->visibleTokenRetriever->getVisibleAvailableTokens($currentUserId); + $tokens = $this->paymentTokenManagement->getVisibleAvailableTokens($currentUserId); $result = []; foreach ($tokens as $token) { diff --git a/app/code/Magento/VaultGraphQl/Model/VisibleTokenRetriever.php b/app/code/Magento/VaultGraphQl/Model/VisibleTokenRetriever.php deleted file mode 100644 index a62f61a57862d..0000000000000 --- a/app/code/Magento/VaultGraphQl/Model/VisibleTokenRetriever.php +++ /dev/null @@ -1,110 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\VaultGraphQl\Model; - -use Magento\Framework\Api\FilterBuilder; -use Magento\Framework\Api\SearchCriteriaBuilder; -use Magento\Framework\Intl\DateTimeFactory; -use Magento\Vault\Api\Data\PaymentTokenInterface; -use Magento\Vault\Api\Data\PaymentTokenSearchResultsInterfaceFactory; -use Magento\Vault\Api\PaymentTokenRepositoryInterface; - -/** - * Vault payment token repository - */ -class VisibleTokenRetriever -{ - /** - * @var PaymentTokenRepositoryInterface - */ - protected $paymentTokenRepository; - - /** - * @var PaymentTokenSearchResultsInterfaceFactory - */ - protected $searchResultsFactory; - - /** - * @var \Magento\Framework\Api\FilterBuilder - */ - protected $filterBuilder; - - /** - * @var \Magento\Framework\Api\SearchCriteriaBuilder - */ - protected $searchCriteriaBuilder; - - /** - * @var DateTimeFactory - */ - private $dateTimeFactory; - - /** - * @param PaymentTokenRepositoryInterface $repository - * @param FilterBuilder $filterBuilder - * @param SearchCriteriaBuilder $searchCriteriaBuilder - * @param PaymentTokenSearchResultsInterfaceFactory $searchResultsFactory - * @param DateTimeFactory $dateTimeFactory - */ - public function __construct( - PaymentTokenRepositoryInterface $repository, - FilterBuilder $filterBuilder, - SearchCriteriaBuilder $searchCriteriaBuilder, - PaymentTokenSearchResultsInterfaceFactory $searchResultsFactory, - DateTimeFactory $dateTimeFactory - ) { - $this->paymentTokenRepository = $repository; - $this->filterBuilder = $filterBuilder; - $this->searchCriteriaBuilder = $searchCriteriaBuilder; - $this->searchResultsFactory = $searchResultsFactory; - $this->dateTimeFactory = $dateTimeFactory; - } - - /** - * Searches for all visible, non-expired tokens - * - * @param int $customerId - * @return PaymentTokenInterface[] - */ - public function getVisibleAvailableTokens($customerId) - { - $customerFilter = [ - $this->filterBuilder->setField(PaymentTokenInterface::CUSTOMER_ID) - ->setValue($customerId) - ->create() - ]; - $visibleFilter = [ - $this->filterBuilder->setField(PaymentTokenInterface::IS_VISIBLE) - ->setValue(1) - ->create() - ]; - $isActiveFilter = [ - $this->filterBuilder->setField(PaymentTokenInterface::IS_ACTIVE) - ->setValue(1) - ->create() - ]; - $expiresAtFilter = [ - $this->filterBuilder->setField(PaymentTokenInterface::EXPIRES_AT) - ->setConditionType('gt') - ->setValue( - $this->dateTimeFactory->create( - 'now', - new \DateTimeZone('UTC') - )->format('Y-m-d 00:00:00') - ) - ->create() - ]; - $this->searchCriteriaBuilder->addFilters($customerFilter); - $this->searchCriteriaBuilder->addFilters($visibleFilter); - $this->searchCriteriaBuilder->addFilters($isActiveFilter); - // add filters to different filter groups in order to filter by AND expression - $searchCriteria = $this->searchCriteriaBuilder->addFilters($expiresAtFilter)->create(); - - return $this->paymentTokenRepository->getList($searchCriteria)->getItems(); - } -} diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Vault/CustomerPaymentTokensTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Vault/CustomerPaymentTokensTest.php index 268c5663251f0..89fbbb9c49ed3 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Vault/CustomerPaymentTokensTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Vault/CustomerPaymentTokensTest.php @@ -10,7 +10,7 @@ use Magento\Integration\Api\CustomerTokenServiceInterface; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\GraphQlAbstract; -use Magento\VaultGraphQl\Model\VisibleTokenRetriever; +use Magento\Vault\Model\PaymentTokenManagement; use Magento\Vault\Model\ResourceModel\PaymentToken as TokenResource; use Magento\Vault\Model\ResourceModel\PaymentToken\CollectionFactory; @@ -22,7 +22,7 @@ class CustomerPaymentTokensTest extends GraphQlAbstract private $customerTokenService; /** - * @var VisibleTokenRetriever + * @var PaymentTokenManagement */ private $paymentTokenManagement; @@ -41,7 +41,7 @@ protected function setUp() parent::setUp(); $this->customerTokenService = Bootstrap::getObjectManager()->get(CustomerTokenServiceInterface::class); - $this->paymentTokenManagement = Bootstrap::getObjectManager()->get(VisibleTokenRetriever::class); + $this->paymentTokenManagement = Bootstrap::getObjectManager()->get(PaymentTokenManagement::class); $this->tokenResource = Bootstrap::getObjectManager()->get(TokenResource::class); $this->tokenCollectionFactory = Bootstrap::getObjectManager()->get(CollectionFactory::class); } @@ -151,7 +151,6 @@ public function testDeletePaymentToken() $this->assertArrayHasKey('type', $token); // Validate gateway token is NOT returned $this->assertArrayNotHasKey('gateway_token', $token); - } /** From 5b7b239e2797efce2c354452bd79499c1d8d0ff7 Mon Sep 17 00:00:00 2001 From: Patrick McLain <pat@pmclain.com> Date: Sun, 3 Feb 2019 16:34:04 -0500 Subject: [PATCH 151/238] Provide available shipping rates for addresses --- .../Cart/Address/AddressDataProvider.php | 54 ++++++++++++++- .../Model/Resolver/CartAddresses.php | 7 +- .../Magento/QuoteGraphQl/etc/schema.graphqls | 20 +++++- .../Quote/SetShippingAddressOnCartTest.php | 65 +++++++++++++++++++ 4 files changed, 140 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/AddressDataProvider.php b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/AddressDataProvider.php index fb742477ec99b..64032cae64b56 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/AddressDataProvider.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/AddressDataProvider.php @@ -10,7 +10,9 @@ use Magento\Framework\Api\ExtensibleDataObjectConverter; use Magento\Quote\Api\Data\AddressInterface; use Magento\Quote\Api\Data\CartInterface; +use Magento\Quote\Api\Data\ShippingMethodInterface; use Magento\Quote\Model\Quote\Address as QuoteAddress; +use Magento\Quote\Model\Cart\ShippingMethodConverter; /** * Class AddressDataProvider @@ -24,24 +26,33 @@ class AddressDataProvider */ private $dataObjectConverter; + /** + * @var ShippingMethodConverter + */ + private $shippingMethodConverter; + /** * AddressDataProvider constructor. * * @param ExtensibleDataObjectConverter $dataObjectConverter + * @param ShippingMethodConverter $shippingMethodConverter */ public function __construct( - ExtensibleDataObjectConverter $dataObjectConverter + ExtensibleDataObjectConverter $dataObjectConverter, + ShippingMethodConverter $shippingMethodConverter ) { $this->dataObjectConverter = $dataObjectConverter; + $this->shippingMethodConverter = $shippingMethodConverter; } /** * Collect and return information about shipping and billing addresses * * @param CartInterface $cart + * @param bool $includeShippingMethods * @return array */ - public function getCartAddresses(CartInterface $cart): array + public function getCartAddresses(CartInterface $cart, $includeShippingMethods = false): array { $addressData = []; $shippingAddress = $cart->getShippingAddress(); @@ -50,6 +61,12 @@ public function getCartAddresses(CartInterface $cart): array if ($shippingAddress) { $shippingData = $this->dataObjectConverter->toFlatArray($shippingAddress, [], AddressInterface::class); $shippingData['address_type'] = 'SHIPPING'; + if ($includeShippingMethods) { + $shippingData['available_shipping_methods'] = $this->extractAvailableShippingRateData( + $cart, + $shippingAddress + ); + } $addressData[] = array_merge($shippingData, $this->extractAddressData($shippingAddress)); } @@ -84,11 +101,42 @@ private function extractAddressData(QuoteAddress $address): array 'code' => $address->getShippingMethod(), 'label' => $address->getShippingDescription(), 'free_shipping' => $address->getFreeShipping(), + 'amount' => $address->getShippingAmount(), + 'base_amount' => $address->getBaseShippingAmount(), + 'amount_incl_tax' => $address->getShippingInclTax(), + 'base_amount_incl_tax' => $address->getBaseShippingInclTax(), ], 'items_weight' => $address->getWeight(), - 'customer_notes' => $address->getCustomerNotes() + 'customer_notes' => $address->getCustomerNotes(), + 'quote_id' => $address->getQuoteId(), ]; return $addressData; } + + private function extractAvailableShippingRateData(CartInterface $cart, QuoteAddress $address): array + { + $output = []; + + // Allow shipping rates by setting country id for new addresses + if (!$address->getCountryId() && $address->getCountryCode()) { + $address->setCountryId($address->getCountryCode()); + } + + $address->setCollectShippingRates(true); + $address->collectShippingRates(); + + $shippingRates = $address->getGroupedAllShippingRates(); + foreach ($shippingRates as $carrierRates) { + foreach ($carrierRates as $rate) { + $output[] = $this->dataObjectConverter->toFlatArray( + $this->shippingMethodConverter->modelToDataObject($rate, $cart->getQuoteCurrencyCode()), + [], + ShippingMethodInterface::class + ); + } + } + + return $output; + } } diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddresses.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddresses.php index 69544672bf12e..96305f9713c3c 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddresses.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddresses.php @@ -43,6 +43,11 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value $cart = $value['model']; - return $this->addressDataProvider->getCartAddresses($cart); + return $this->addressDataProvider->getCartAddresses($cart, $this->includeShippingMethods($info)); + } + + private function includeShippingMethods(ResolveInfo $info): bool + { + return $info->getFieldSelection()['available_shipping_methods'] ?? false; } } diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index 4c1101a5f90a8..86688a360ccf0 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -112,7 +112,7 @@ type CartAddress { telephone: String address_type: AdressTypeEnum selected_shipping_method: CheckoutShippingMethod - available_shipping_methods: [CheckoutShippingMethod] + available_shipping_methods: [CheckoutAvailableShippingMethod] items_weight: Float customer_notes: String cart_items: [CartItemQuantity] @@ -138,7 +138,23 @@ type CheckoutShippingMethod { label: String free_shipping: Boolean! error_message: String - # TODO: Add more complex structure for shipping rates + amount: Float! + base_amount: Float! + amount_incl_tax: Float! + base_amount_incl_tax: Float! +} + +type CheckoutAvailableShippingMethod { + carrier_code: String! + carrier_title: String! + method_code: String! + method_title: String! + error_message: String + amount: Float! + base_amount: Float! + price_excl_tax: Float! + price_incl_tax: Float! + available: Boolean! } enum AdressTypeEnum { diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php index a023d37895c23..9fcaa894425c2 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php @@ -87,6 +87,18 @@ public function testSetNewGuestShippingAddressOnCart() city postcode telephone + available_shipping_methods { + amount + available + base_amount + carrier_code + carrier_title + error_message + method_code + method_title + price_excl_tax + price_incl_tax + } } } } @@ -99,6 +111,7 @@ public function testSetNewGuestShippingAddressOnCart() self::assertArrayHasKey('addresses', $cartResponse); $shippingAddressResponse = current($cartResponse['addresses']); $this->assertNewShippingAddressFields($shippingAddressResponse); + $this->assertAvailableShippingRates($shippingAddressResponse); } /** @@ -340,6 +353,18 @@ public function testSetNewRegisteredCustomerShippingAddressOnCart() city postcode telephone + available_shipping_methods { + amount + available + base_amount + carrier_code + carrier_title + error_message + method_code + method_title + price_excl_tax + price_incl_tax + } } } } @@ -352,6 +377,7 @@ public function testSetNewRegisteredCustomerShippingAddressOnCart() self::assertArrayHasKey('addresses', $cartResponse); $shippingAddressResponse = current($cartResponse['addresses']); $this->assertNewShippingAddressFields($shippingAddressResponse); + $this->assertAvailableShippingRates($shippingAddressResponse); } /** @@ -398,6 +424,18 @@ public function testSetSavedRegisteredCustomerShippingAddressOnCart() city postcode telephone + available_shipping_methods { + amount + available + base_amount + carrier_code + carrier_title + error_message + method_code + method_title + price_excl_tax + price_incl_tax + } } } } @@ -410,6 +448,7 @@ public function testSetSavedRegisteredCustomerShippingAddressOnCart() self::assertArrayHasKey('addresses', $cartResponse); $shippingAddressResponse = current($cartResponse['addresses']); $this->assertSavedShippingAddressFields($shippingAddressResponse); + $this->assertAvailableShippingRates($shippingAddressResponse); } /** @@ -452,6 +491,32 @@ private function assertSavedShippingAddressFields(array $shippingAddressResponse $this->assertResponseFields($shippingAddressResponse, $assertionMap); } + /** + * Verify the expected shipping method is available + * + * @param array $shippingAddressResponse + */ + private function assertAvailableShippingRates(array $shippingAddressResponse): void + { + $this->assertArrayHasKey('available_shipping_methods', $shippingAddressResponse); + $rate = current($shippingAddressResponse['available_shipping_methods']); + + $assertionMap = [ + ['response_field' => 'amount', 'expected_value' => 5], + ['response_field' => 'available', 'expected_value' => true], + ['response_field' => 'base_amount', 'expected_value' => 5], + ['response_field' => 'carrier_code', 'expected_value' => 'flatrate'], + ['response_field' => 'carrier_title', 'expected_value' => 'Flat Rate'], + ['response_field' => 'error_message', 'expected_value' => ''], + ['response_field' => 'method_code', 'expected_value' => 'flatrate'], + ['response_field' => 'method_title', 'expected_value' => 'Fixed'], + ['response_field' => 'price_incl_tax', 'expected_value' => 5], + ['response_field' => 'price_excl_tax', 'expected_value' => 5], + ]; + + $this->assertResponseFields($rate, $assertionMap); + } + /** * @param string $username * @return array From 6d6d5d56282fd7851e1eb9af15cf9a58c308bda5 Mon Sep 17 00:00:00 2001 From: Patrick McLain <pat@pmclain.com> Date: Tue, 5 Feb 2019 21:19:05 -0500 Subject: [PATCH 152/238] Separate resolver for address shipping methods --- .../Cart/Address/AddressDataProvider.php | 10 +-- .../Address/ShippingMethodsDataProvider.php | 67 +++++++++++++++++++ .../Resolver/CartAddressShippingMethods.php | 46 +++++++++++++ .../Model/Resolver/CartAddresses.php | 7 +- .../Magento/QuoteGraphQl/etc/schema.graphqls | 2 +- 5 files changed, 117 insertions(+), 15 deletions(-) create mode 100644 app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingMethodsDataProvider.php create mode 100644 app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressShippingMethods.php diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/AddressDataProvider.php b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/AddressDataProvider.php index 64032cae64b56..73183ea903fc6 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/AddressDataProvider.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/AddressDataProvider.php @@ -49,10 +49,9 @@ public function __construct( * Collect and return information about shipping and billing addresses * * @param CartInterface $cart - * @param bool $includeShippingMethods * @return array */ - public function getCartAddresses(CartInterface $cart, $includeShippingMethods = false): array + public function getCartAddresses(CartInterface $cart): array { $addressData = []; $shippingAddress = $cart->getShippingAddress(); @@ -61,12 +60,6 @@ public function getCartAddresses(CartInterface $cart, $includeShippingMethods = if ($shippingAddress) { $shippingData = $this->dataObjectConverter->toFlatArray($shippingAddress, [], AddressInterface::class); $shippingData['address_type'] = 'SHIPPING'; - if ($includeShippingMethods) { - $shippingData['available_shipping_methods'] = $this->extractAvailableShippingRateData( - $cart, - $shippingAddress - ); - } $addressData[] = array_merge($shippingData, $this->extractAddressData($shippingAddress)); } @@ -88,6 +81,7 @@ public function getCartAddresses(CartInterface $cart, $includeShippingMethods = private function extractAddressData(QuoteAddress $address): array { $addressData = [ + 'model' => $address, 'country' => [ 'code' => $address->getCountryId(), 'label' => $address->getCountry() diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingMethodsDataProvider.php b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingMethodsDataProvider.php new file mode 100644 index 0000000000000..fd9540194b421 --- /dev/null +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingMethodsDataProvider.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\QuoteGraphQl\Model\Cart\Address; + +use Magento\Quote\Api\Data\ShippingMethodInterface; +use Magento\Framework\Api\ExtensibleDataObjectConverter; +use Magento\Quote\Model\Cart\ShippingMethodConverter; +use Magento\Quote\Model\Quote\Address as QuoteAddress; + +class ShippingMethodsDataProvider +{ + /** + * @var ExtensibleDataObjectConverter + */ + private $dataObjectConverter; + + /** + * @var ShippingMethodConverter + */ + private $shippingMethodConverter; + + /** + * AddressDataProvider constructor. + * + * @param ExtensibleDataObjectConverter $dataObjectConverter + * @param ShippingMethodConverter $shippingMethodConverter + */ + public function __construct( + ExtensibleDataObjectConverter $dataObjectConverter, + ShippingMethodConverter $shippingMethodConverter + ) { + $this->dataObjectConverter = $dataObjectConverter; + $this->shippingMethodConverter = $shippingMethodConverter; + } + + public function getAvailableShippingMethods(QuoteAddress $address): array + { + $methods = []; + + // Allow shipping rates by setting country id for new addresses + if (!$address->getCountryId() && $address->getCountryCode()) { + $address->setCountryId($address->getCountryCode()); + } + + $address->setCollectShippingRates(true); + $address->collectShippingRates(); + $cart = $address->getQuote(); + + $shippingRates = $address->getGroupedAllShippingRates(); + foreach ($shippingRates as $carrierRates) { + foreach ($carrierRates as $rate) { + $methods[] = $this->dataObjectConverter->toFlatArray( + $this->shippingMethodConverter->modelToDataObject($rate, $cart->getQuoteCurrencyCode()), + [], + ShippingMethodInterface::class + ); + } + } + + return $methods; + } +} diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressShippingMethods.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressShippingMethods.php new file mode 100644 index 0000000000000..e3c250237ad15 --- /dev/null +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressShippingMethods.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\QuoteGraphQl\Model\Resolver; + +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\GraphQl\Config\Element\Field; +use Magento\Framework\GraphQl\Query\ResolverInterface; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\QuoteGraphQl\Model\Cart\Address\ShippingMethodsDataProvider; + +/** + * @inheritdoc + */ +class CartAddressShippingMethods implements ResolverInterface +{ + /** + * @var ShippingMethodsDataProvider + */ + private $shippingMethodsDataProvider; + + /** + * @param ShippingMethodsDataProvider $shippingMethodsDataProvider + */ + public function __construct( + ShippingMethodsDataProvider $shippingMethodsDataProvider + ) { + $this->shippingMethodsDataProvider = $shippingMethodsDataProvider; + } + + /** + * @inheritdoc + */ + public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) + { + if (!isset($value['model'])) { + throw new LocalizedException(__('"model" values should be specified')); + } + + return $this->shippingMethodsDataProvider->getAvailableShippingMethods($value['model']); + } +} diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddresses.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddresses.php index 96305f9713c3c..69544672bf12e 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddresses.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddresses.php @@ -43,11 +43,6 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value $cart = $value['model']; - return $this->addressDataProvider->getCartAddresses($cart, $this->includeShippingMethods($info)); - } - - private function includeShippingMethods(ResolveInfo $info): bool - { - return $info->getFieldSelection()['available_shipping_methods'] ?? false; + return $this->addressDataProvider->getCartAddresses($cart); } } diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index 86688a360ccf0..c2c7412df4b6e 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -112,7 +112,7 @@ type CartAddress { telephone: String address_type: AdressTypeEnum selected_shipping_method: CheckoutShippingMethod - available_shipping_methods: [CheckoutAvailableShippingMethod] + available_shipping_methods: [CheckoutAvailableShippingMethod] @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartAddressShippingMethods") items_weight: Float customer_notes: String cart_items: [CartItemQuantity] From 1a69d431194ba1f524487cad7f134114d95fc9ea Mon Sep 17 00:00:00 2001 From: Aditya Yadav <adityayadav@cedcommerce.com> Date: Thu, 7 Feb 2019 10:03:45 +0530 Subject: [PATCH 153/238] Changes to support backward compatibility --- app/code/Magento/SalesRule/Model/Rule/DataProvider.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/SalesRule/Model/Rule/DataProvider.php b/app/code/Magento/SalesRule/Model/Rule/DataProvider.php index cd04e35c698f4..a336f62207d5c 100644 --- a/app/code/Magento/SalesRule/Model/Rule/DataProvider.php +++ b/app/code/Magento/SalesRule/Model/Rule/DataProvider.php @@ -62,7 +62,7 @@ public function __construct( CollectionFactory $collectionFactory, \Magento\Framework\Registry $registry, \Magento\SalesRule\Model\Rule\Metadata\ValueProvider $metadataValueProvider, - DataPersistorInterface $dataPersistor, + DataPersistorInterface $dataPersistor = null, array $meta = [], array $data = [] ) { @@ -70,7 +70,9 @@ public function __construct( $this->coreRegistry = $registry; $this->metadataValueProvider = $metadataValueProvider; $meta = array_replace_recursive($this->getMetadataValues(), $meta); - $this->dataPersistor = $dataPersistor; + $this->dataPersistor = $dataPersistor ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + DataPersistorInterface::class + ); parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data); } From c09acd82adb8f2b173fca5fbbaba060bd1b8ba8d Mon Sep 17 00:00:00 2001 From: Sunil Patel <patelsunil42@gmail.com> Date: Wed, 6 Feb 2019 12:08:57 +0530 Subject: [PATCH 154/238] disable add to cart until page load --- .../view/frontend/templates/product/view/addtocart.phtml | 2 +- .../Magento/Catalog/view/frontend/web/js/validate-product.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml index 9c18a18ff5837..fc578c7652419 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml @@ -32,7 +32,7 @@ <button type="submit" title="<?= /* @escapeNotVerified */ $buttonTitle ?>" class="action primary tocart" - id="product-addtocart-button"> + id="product-addtocart-button" disabled> <span><?= /* @escapeNotVerified */ $buttonTitle ?></span> </button> <?= $block->getChildHtml('', true) ?> diff --git a/app/code/Magento/Catalog/view/frontend/web/js/validate-product.js b/app/code/Magento/Catalog/view/frontend/web/js/validate-product.js index c0637cb672dc6..ab848aa442f81 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/validate-product.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/validate-product.js @@ -13,7 +13,8 @@ define([ $.widget('mage.productValidate', { options: { bindSubmit: false, - radioCheckboxClosest: '.nested' + radioCheckboxClosest: '.nested', + addToCartButtonSelector: '.action.tocart' }, /** @@ -41,6 +42,7 @@ define([ return false; } }); + $(this.options.addToCartButtonSelector).attr('disabled',false); } }); From 6e7734e4066347b61c65278f2ae54f0138ee7479 Mon Sep 17 00:00:00 2001 From: priti <priti@2jcommerce.in> Date: Thu, 7 Feb 2019 13:50:56 +0530 Subject: [PATCH 155/238] products-in-category-checkbox-not-align-properly --- .../backend/Magento_Ui/web/css/source/module/_data-grid.less | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less index 6a8763fe154b8..564c0769274df 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less +++ b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less @@ -1074,8 +1074,9 @@ body._in-resize { } .data-grid-checkbox-cell-inner { - margin: 0; - padding: 0 @data-grid-checkbox-cell-inner__padding-horizontal 0 0; + margin: @data-grid-checkbox-cell-inner__padding-top @data-grid-checkbox-cell-inner__padding-horizontal .9rem; + padding: 0; + display: unset; } // Content Hierarchy specific From 5c8f2b15b90d40032b79dc633c42d7fd2597e6e1 Mon Sep 17 00:00:00 2001 From: Nainesh <nainesh@2jcommerce.in> Date: Thu, 7 Feb 2019 16:11:21 +0530 Subject: [PATCH 156/238] quantity-not-center-align-on-review-order --- .../Magento_Multishipping/web/css/source/_module.less | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/design/frontend/Magento/luma/Magento_Multishipping/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Multishipping/web/css/source/_module.less index ed6b53727da52..059cdcd934b17 100644 --- a/app/design/frontend/Magento/luma/Magento_Multishipping/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Multishipping/web/css/source/_module.less @@ -345,6 +345,15 @@ .data.table { &:extend(.abs-checkout-order-review all); + &.table-order-review { + > tbody { + > tr { + > td.col.qty { + text-align: center; + } + } + } + } } } From 3fc1709fae8b9e3a14f351f54b6e7d2e23db302e Mon Sep 17 00:00:00 2001 From: Nainesh <nainesh@2jcommerce.in> Date: Thu, 7 Feb 2019 17:12:25 +0530 Subject: [PATCH 157/238] quantity-not-center-align-on-review-order --- .../Magento_Multishipping/web/css/source/_module.less | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Multishipping/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Multishipping/web/css/source/_module.less index 059cdcd934b17..1abfd44c5d696 100644 --- a/app/design/frontend/Magento/luma/Magento_Multishipping/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Multishipping/web/css/source/_module.less @@ -348,8 +348,15 @@ &.table-order-review { > tbody { > tr { - > td.col.qty { - text-align: center; + > td { + &.col { + &.subtotal { + border-bottom: none; + } + &.qty { + text-align: center; + } + } } } } From e104ec45ce698fec8c1db52f9f60f600e9f54959 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@adobe.com> Date: Wed, 6 Feb 2019 19:25:31 -0600 Subject: [PATCH 158/238] MQE-1352: bug fix in dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php --- .../functional/lib/Magento/Mtf/Util/Command/Cli.php | 4 +++- .../Util/Protocol/CurlTransport/WebapiDecorator.php | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php index 840ec00df474a..f0abd280f3ebc 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php @@ -72,7 +72,9 @@ public function execute($command, $options = []) */ private function prepareParamArray($command, $options = []) { - $command .= ' ' . implode(' ', $options); + if (!empty($options)) { + $command .= ' ' . implode(' ', $options); + } return [ 'token' => urlencode($this->webapiHandler->getWebapiToken()), 'command' => urlencode($command) diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/WebapiDecorator.php b/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/WebapiDecorator.php index 846117e569d56..df5ab45a3f96d 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/WebapiDecorator.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/WebapiDecorator.php @@ -171,7 +171,13 @@ protected function setConfiguration(Integration $integration) */ protected function isValidIntegration() { - $this->write($_ENV['app_frontend_url'] . 'rest/V1/modules', [], CurlInterface::GET); + $url = rtrim($_ENV['app_frontend_url'], '/'); + if (strpos($url, 'index.php') === false) { + $url .= '/index.php/rest/V1/modules'; + } else { + $url .= '/rest/V1/modules'; + } + $this->write($url, [], CurlInterface::GET); $response = json_decode($this->read(), true); return (null !== $response) && !isset($response['message']); @@ -237,6 +243,10 @@ public function close() */ public function getWebapiToken() { + // Request token if integration is no longer valid + if (!$this->isValidIntegration()) { + $this->init(); + } return $this->webapiToken; } } From a1890eefae340f8112ebd7e9039ccc70d938b274 Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Mon, 4 Feb 2019 10:24:57 -0600 Subject: [PATCH 159/238] MC-4418: Convert CreateProductAttributeEntityFromProductPageTest to MFTF --- .../Test/Mftf/Data/ProductAttributeData.xml | 21 +++ .../Mftf/Data/ProductAttributeOptionData.xml | 5 + .../AdminCreateNewProductAttributeSection.xml | 33 +++++ .../AdminProductAttributeGridSection.xml | 6 + .../Mftf/Section/AdminProductFormSection.xml | 2 + .../Section/StorefrontCategoryMainSection.xml | 1 + ...mProductAttributeWithDropdownFieldTest.xml | 123 ++++++++++++++++++ ...ateProductAttributeFromProductPageTest.xml | 117 +++++++++++++++++ ...eProductAttributeRequiredTextFieldTest.xml | 78 +++++++++++ 9 files changed, 386 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateNewProductAttributeSection.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml index b367cdcab9d8b..cf3986003542f 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml @@ -115,4 +115,25 @@ <data key="used_for_sort_by">true</data> <requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity> </entity> + <entity name="newProductAttribute" type="ProductAttribute"> + <data key="attribute_code" unique="suffix">attribute</data> + <data key="frontend_input">Text Field</data> + <data key="scope">global</data> + <data key="is_required">false</data> + <data key="is_unique">false</data> + <data key="is_searchable">true</data> + <data key="is_visible">true</data> + <data key="is_visible_in_advanced_search">true</data> + <data key="is_visible_on_front">true</data> + <data key="is_filterable">true</data> + <data key="is_filterable_in_search">true</data> + <data key="used_in_product_listing">true</data> + <data key="is_used_for_promo_rules">true</data> + <data key="is_comparable">true</data> + <data key="is_used_in_grid">true</data> + <data key="is_visible_in_grid">true</data> + <data key="is_filterable_in_grid">true</data> + <data key="used_for_sort_by">true</data> + <requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity> + </entity> </entities> diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeOptionData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeOptionData.xml index 5be2a84f54555..fcb56cf298a98 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeOptionData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeOptionData.xml @@ -81,4 +81,9 @@ <requiredEntity type="StoreLabel">Option9Store0</requiredEntity> <requiredEntity type="StoreLabel">Option10Store1</requiredEntity> </entity> + <entity name="ProductAttributeOption8" type="ProductAttributeOption"> + <var key="attribute_code" entityKey="attribute_code" entityType="ProductAttribute"/> + <data key="label" unique="suffix">White</data> + <data key="value" unique="suffix">white</data> + </entity> </entities> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateNewProductAttributeSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateNewProductAttributeSection.xml new file mode 100644 index 0000000000000..e218f5ae74fc0 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateNewProductAttributeSection.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminCreateNewProductAttributeSection"> + <element name="saveAttribute" type="button" selector="#save"/> + <element name="defaultLabel" type="input" selector="input[name='frontend_label[0]']"/> + <element name="inputType" type="select" selector="select[name='frontend_input']" timeout="30"/> + <element name="addValue" type="button" selector="//button[contains(@data-action,'add_new_row')]" timeout="30"/> + <element name="defaultStoreView" type="input" selector="//input[contains(@name,'option[value][option_{{row}}][1]')]" parameterized="true"/> + <element name="adminOption" type="input" selector="//input[contains(@name,'option[value][option_{{row}}][0]')]" parameterized="true"/> + <element name="defaultRadioButton" type="radio" selector="//tr[{{row}}]//input[contains(@name,'default[]')]/..//label" parameterized="true"/> + <element name="isRequired" type="checkbox" selector="//input[contains(@name,'is_required')]/..//label"/> + <element name="advancedAttributeProperties" type="text" selector="//div[contains(@data-index,'advanced_fieldset')]"/> + <element name="attributeCode" type="input" selector="//*[@class='admin__fieldset-wrapper-content admin__collapsible-content _show']//input[@name='attribute_code']"/> + <element name="scope" type="select" selector="//*[@class='admin__fieldset-wrapper-content admin__collapsible-content _show']//select[@name='is_global']" timeout="30"/> + <element name="defaultValue" type="input" selector="//*[@class='admin__fieldset-wrapper-content admin__collapsible-content _show']//input[@name='default_value_text']"/> + <element name="isUnique" type="checkbox" selector="//input[contains(@name, 'is_unique')]/..//label"/> + <element name="storefrontProperties" type="text" selector="//div[contains(@data-index,'front_fieldset')]"/> + <element name="inSearch" type="checkbox" selector="//input[contains(@name, 'is_searchable')]/..//label"/> + <element name="advancedSearch" type="checkbox" selector="//input[contains(@name, 'is_visible_in_advanced_search')]/..//label"/> + <element name="isComparable" type="checkbox" selector="//input[contains(@name, 'is_comparable')]/..//label"/> + <element name="allowHtmlTags" type="checkbox" selector="//input[contains(@name, 'is_html_allowed_on_front')]/..//label"/> + <element name="visibleOnStorefront" type="checkbox" selector="//input[contains(@name, 'is_visible_on_front')]/..//label"/> + <element name="sortProductListing" type="checkbox" selector="//input[contains(@name, 'is_visible_on_front')]/..//label"/> + </section> +</sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml index d3aaeefdc6bb2..f025e561e529f 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml @@ -17,5 +17,11 @@ <element name="FirstRow" type="button" selector="//*[@id='attributeGrid_table']/tbody/tr[1]" timeout="30"/> <element name="FilterByAttributeCode" type="input" selector="#attributeGrid_filter_attribute_code"/> <element name="attributeLabelFilter" type="input" selector="//input[@name='frontend_label']"/> + <element name="attributeCodeColumn" type="text" selector="//div[@id='attributeGrid']//tbody//td[contains(@class,'col-attr-code col-attribute_code')]"/> + <element name="defaultLabelColumn" type="text" selector="//div[@id='attributeGrid']//tbody//td[contains(@class,'col-label col-frontend_label')]"/> + <element name="isVisibleColumn" type="text" selector="//div[@id='attributeGrid']//tbody//td[contains(@class,'a-center col-is_visible')]"/> + <element name="scopeColumn" type="text" selector="//div[@id='attributeGrid']//tbody/tr/td[contains(@class,'a-center col-is_global')]"/> + <element name="isSearchableColumn" type="text" selector="//div[@id='attributeGrid']//tbody/tr/td[contains(@class,'a-center col-is_searchable')]"/> + <element name="isComparableColumn" type="text" selector="//div[@id='attributeGrid']//tbody/tr/td[contains(@class,'a-center col-is_comparable')]"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index e2ccbe165a0b2..f6e2b0a06285d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -51,6 +51,8 @@ <element name="setProductAsNewFrom" type="input" selector="input[name='product[news_from_date]']"/> <element name="setProductAsNewTo" type="input" selector="input[name='product[news_to_date]']"/> <element name="attributeLabelByText" type="text" selector="//*[@class='admin__field']//span[text()='{{attributeLabel}}']" parameterized="true"/> + <element name="attributeRequiredInput" type="input" selector="//input[contains(@name, 'product[{{attributeCode}}]')]" parameterized="true"/> + <element name="attributeFieldError" type="text" selector="//*[@class='admin__field _required _error']/..//label[contains(.,'This is a required field.')]"/> <element name="customSelectField" type="select" selector="//select[@name='product[{{var}}]']" parameterized="true"/> <element name="searchCategory" type="input" selector="//*[@data-index='category_ids']//input[contains(@class, 'multiselect-search')]"/> <element name="selectCategory" type="input" selector="//*[@data-index='category_ids']//label[contains(., '{{categoryName}}')]" parameterized="true"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml index c0cf332478c06..2e4946095b473 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml @@ -32,5 +32,6 @@ <element name="asLowAs" type="input" selector="//*[@class='price-box price-final_price']/a/span[@class='price-container price-final_price tax weee']"/> <element name="productsList" type="block" selector="#maincontent .column.main"/> <element name="productName" type="text" selector=".product.name.product-item-name"/> + <element name="productOptionList" type="text" selector="#narrow-by-list"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml new file mode 100644 index 0000000000000..097d3488d98da --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateCustomProductAttributeWithDropdownFieldTest"> + <annotations> + <stories value="Create product Attribute"/> + <title value="Create Custom Product Attribute Dropdown Field (Not Required) from Product Page"/> + <description value="login as admin and create configurable product attribute with Dropdown field"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-10905"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <!--Create Category--> + <createData entity="SimpleSubCategory" stepKey="createCategory"/> + <!--Create Configurable Product--> + <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <!--Delete created entity --> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> + <actionGroup ref="deleteProductAttribute" stepKey="deleteCreatedAttribute"> + <argument name="ProductAttribute" value="newProductAttribute"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Open Product Index Page--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <!-- Select Created Product--> + <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createConfigProduct.sku$$)}}"/> + <waitForPageLoad stepKey="waitForProductToLoad"/> + <!-- Create New Product Attribute --> + <click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/> + <waitForPageLoad stepKey="waitForAttributePageToLoad"/> + <click selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}" stepKey="clickCreateNewAttributeButton"/> + <waitForPageLoad stepKey="waitForNewAttributePageToLoad"/> + <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}" stepKey="waitForDefaultLabelToBeVisible"/> + <fillField selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillAttributeLabel"/> + <selectOption selector="{{AdminCreateNewProductAttributeSection.inputType}}" userInput="Dropdown" stepKey="selectInputType"/> + <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="waitForAddValueButtonToVisible"/> + <click selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="clickOnAddValueButton"/> + <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('0')}}" stepKey="waitForDefaultStoreViewToVisible"/> + <fillField selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('0')}}" userInput="{{ProductAttributeOption8.label}}" stepKey="fillDefaultStoreView"/> + <fillField selector="{{AdminCreateNewProductAttributeSection.adminOption('0')}}" userInput="{{ProductAttributeOption8.value}}" stepKey="fillAdminField"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.defaultRadioButton('1')}}" stepKey="selectRadioButton"/> + <click selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="clickOnAdvancedAttributeProperties"/> + <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="waitForAttributeCodeToVisible"/> + <scrollTo selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="scrollToAttributeCode"/> + <fillField selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="fillAttributeCode"/> + <selectOption selector="{{AdminCreateNewProductAttributeSection.scope}}" userInput="Global" stepKey="selectScope"/> + <scrollTo selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="scrollToIsUniqueOption"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="enableIsUniqueOption"/> + <scrollTo selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="scrollToAdvancedAttributeProperties"/> + <click selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="clickOnAdvancedAttributeProperties1"/> + <scrollTo selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="scrollToStorefrontProperties"/> + <click selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="clickOnStorefrontProperties"/> + <waitForPageLoad stepKey="waitForStoreFrontPropertiesTodiaplay"/> + <scrollTo selector="{{AdminCreateNewProductAttributeSection.sortProductListing}}" x="0" y="-80" stepKey="scroll1ToSortProductListing"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.inSearch}}" stepKey="enableInSearchOption"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.advancedSearch}}" stepKey="enableAdvancedSearch"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.isComparable}}" stepKey="enableComparableOption"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.allowHtmlTags}}" stepKey="enableAllowHtmlTags"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.visibleOnStorefront}}" stepKey="enableVisibleOnStorefront"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.sortProductListing}}" stepKey="enableSortProductListing"/> + <scrollToTopOfPage stepKey="scrollToTopOfPage"/> + <click selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="clickOnSaveAttribute"/> + <waitForPageLoad stepKey="waitForAttributeToSave"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="saveTheProduct"/> + <waitForPageLoad stepKey="waitForProductToSave"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> + <!--Verify product attribute added in product form --> + <scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/> + <waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/> + <click selector="{{AdminProductFormSection.attributeTab}}" stepKey="clickOnAttribute"/> + <seeElement selector="{{AdminProductFormSection.attributeLabelByText(ProductAttributeFrontendLabel.label)}}" stepKey="seeAttributeLabelInProductForm"/> + <!--Verify Product Attribute in Attribute Form --> + <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> + <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="setAttributeCode"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> + <waitForPageLoad stepKey="waitForPageLoad" /> + <see selector="{{AdminProductAttributeGridSection.attributeCodeColumn}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="seeAttributeCode"/> + <see selector="{{AdminProductAttributeGridSection.defaultLabelColumn}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeDefaultLabel"/> + <see selector="{{AdminProductAttributeGridSection.isVisibleColumn}}" userInput="Yes" stepKey="seeIsVisibleColumn"/> + <see selector="{{AdminProductAttributeGridSection.scopeColumn}}" userInput="Global" stepKey="seeScopeColumn"/> + <see selector="{{AdminProductAttributeGridSection.isSearchableColumn}}" userInput="Yes" stepKey="seeSearchableColumn"/> + <see selector="{{AdminProductAttributeGridSection.isComparableColumn}}" userInput="Yes" stepKey="seeComparableColumn"/> + <!--Verify Product Attribute is present in Category Store Front Page --> + <amOnPage url="$$createCategory.name$$.html" stepKey="goToStorefrontPage"/> + <waitForPageLoad stepKey="waitForProductFrontPageToLoad"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="clickOnCategory"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <click selector="{{StorefrontCategoryMainSection.productLink}}" stepKey="openSearchedProduct"/> + <waitForPageLoad stepKey="waitForProductToLoad1"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{ApiConfigurableProduct.name}}" stepKey="seeProductNameInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="{{ApiConfigurableProduct.price}}" stepKey="seeProductPriceInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="{{ApiConfigurableProduct.sku}}" stepKey="seeProductSkuInStoreFront"/> + <scrollTo selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="scrollToMoreInformation"/> + <see selector="{{StorefrontProductMoreInformationSection.attributeLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeLabel"/> + <see selector="{{StorefrontProductMoreInformationSection.attributeValue}}" userInput="{{ProductAttributeOption8.value}}" stepKey="seeAttributeValue"/> + <!--Verify Product Attribute present in search page --> + <amOnPage url="$$createCategory.name$$.html" stepKey="goToStorefrontPage1"/> + <waitForPageLoad stepKey="waitForProductFrontPageToLoad1"/> + <fillField selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" userInput="{{ProductAttributeOption8.value}}" stepKey="fillAttribute"/> + <waitForPageLoad stepKey="waitForSearchTextBox"/> + <click selector="{{StorefrontQuickSearchResultsSection.searchTextBoxButton}}" stepKey="clickSearchTextBoxButton"/> + <waitForPageLoad stepKey="waitForSearchResultToLoad"/> + <see selector="{{StorefrontCategoryMainSection.productName}}" userInput="{{ApiConfigurableProduct.name}}" stepKey="seeProductNameInCategoryPage"/> + <see selector="{{StorefrontCategoryMainSection.productOptionList}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeProductAttributeOptionInCategoryPage"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml new file mode 100644 index 0000000000000..36393ec0890c5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateProductAttributeFromProductPageTest"> + <annotations> + <stories value="Create product Attribute"/> + <title value="Create Product Attribute from Product Page"/> + <description value="Login as admin and create new product attribute from product page with Text Field"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-10899"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <!--Create Category--> + <createData entity="SimpleSubCategory" stepKey="createCategory"/> + <!--Create Simple Product--> + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <!--Delete created entity --> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <!--<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>--> + <actionGroup ref="deleteProductAttribute" stepKey="deleteCreatedAttribute"> + <argument name="ProductAttribute" value="newProductAttribute"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Open Product Index Page--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <!-- Select Created Product--> + <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> + <waitForPageLoad stepKey="waitForProductToLoad"/> + <!-- Create New Product Attribute --> + <click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/> + <waitForPageLoad stepKey="waitForAttributePageToLoad"/> + <click selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}" stepKey="clickCreateNewAttributeButton"/> + <waitForPageLoad stepKey="waitForNewAttributePageToLoad"/> + <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}" stepKey="waitForDefaultLabelToBeVisible"/> + <fillField selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillAttributeLabel"/> + <selectOption selector="{{AdminCreateNewProductAttributeSection.inputType}}" userInput="Text Field" stepKey="selectTextField"/> + <click selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="clickOnAdvancedAttributeProperties"/> + <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="waitForAttributeCodeToVisible"/> + <scrollTo selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="scrollToAttributeCode"/> + <fillField selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="fillAttributeCode"/> + <selectOption selector="{{AdminCreateNewProductAttributeSection.scope}}" userInput="Global" stepKey="selectScope"/> + <fillField selector="{{AdminCreateNewProductAttributeSection.defaultValue}}" userInput="{{ProductAttributeOption8.value}}" stepKey="fillDefaultValue"/> + <scrollTo selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="scrollToIsUniqueOption"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="enableIsUniqueOption"/> + <scrollTo selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="scrollToAdvancedAttributeProperties"/> + <click selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="clickOnAdvancedAttributeProperties1"/> + <scrollTo selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="scrollToStorefrontProperties"/> + <click selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="clickOnStorefrontProperties"/> + <waitForPageLoad stepKey="waitForStoreFrontToLoad"/> + <scrollTo stepKey="scroll1" selector="{{AdminCreateNewProductAttributeSection.sortProductListing}}" x="0" y="-80"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.inSearch}}" stepKey="enableInSearchOption"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.advancedSearch}}" stepKey="enableAdvancedSearch"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.isComparable}}" stepKey="enableIsUComparableption"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.allowHtmlTags}}" stepKey="enableAllowHtmlTags"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.visibleOnStorefront}}" stepKey="enableVisibleOnStorefront"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.sortProductListing}}" stepKey="enableSortProductListing"/> + <scrollToTopOfPage stepKey="scrollToTopOfPage"/> + <click selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="clickOnSaveAttribute"/> + <waitForPageLoad stepKey="waitForAttributeToSave"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="saveTheProduct"/> + <waitForPageLoad stepKey="waitForProductToSave"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> + <!--Verify product attribute added in product form --> + <scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/> + <waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/> + <click selector="{{AdminProductFormSection.attributeTab}}" stepKey="clickOnAttribute"/> + <seeElement selector="{{AdminProductFormSection.attributeLabelByText(ProductAttributeFrontendLabel.label)}}" stepKey="seeAttributeLabelInProductForm"/> + <!--Verify Product Attribute in Attribute Form --> + <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> + <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="setAttributeCode"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> + <waitForPageLoad stepKey="waitForPageLoad" /> + <see selector="{{AdminProductAttributeGridSection.attributeCodeColumn}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="seeAttributeCode"/> + <see selector="{{AdminProductAttributeGridSection.defaultLabelColumn}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeDefaultLabel"/> + <see selector="{{AdminProductAttributeGridSection.isVisibleColumn}}" userInput="Yes" stepKey="seeIsVisibleColumn"/> + <see selector="{{AdminProductAttributeGridSection.scopeColumn}}" userInput="Global" stepKey="seeScopeColumn"/> + <see selector="{{AdminProductAttributeGridSection.isSearchableColumn}}" userInput="Yes" stepKey="seeSearchableColumn"/> + <see selector="{{AdminProductAttributeGridSection.isComparableColumn}}" userInput="Yes" stepKey="seeComparableColumn"/> + <!--Verify Product Attribute is present in Category Store Front Page --> + <amOnPage url="$$createCategory.name$$.html" stepKey="goToStorefrontPage"/> + <waitForPageLoad stepKey="waitForProductFrontPageToLoad"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="clickOnCategory"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <click selector="{{StorefrontCategoryMainSection.productLink}}" stepKey="openSearchedProduct"/> + <waitForPageLoad stepKey="waitForProductToLoad1"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{SimpleProduct.name}}" stepKey="seeProductNameInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="{{SimpleProduct.price}}" stepKey="seeProductPriceInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="{{SimpleProduct.sku}}" stepKey="seeProductSkuInStoreFront"/> + <scrollTo selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="scrollToMoreInformation"/> + <see selector="{{StorefrontProductMoreInformationSection.attributeLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeLabel"/> + <see selector="{{StorefrontProductMoreInformationSection.attributeValue}}" userInput="{{ProductAttributeOption8.value}}" stepKey="seeAttributeValue"/> + <!--Verify Product Attribute present in search page --> + <amOnPage url="$$createCategory.name$$.html" stepKey="goToStorefrontPage1"/> + <waitForPageLoad stepKey="waitForProductFrontPageToLoad1"/> + <fillField selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" userInput="{{ProductAttributeOption8.value}}" stepKey="fillAttribute"/> + <waitForPageLoad stepKey="waitForSearchTextBox"/> + <click selector="{{StorefrontQuickSearchResultsSection.searchTextBoxButton}}" stepKey="clickSearchTextBoxButton"/> + <waitForPageLoad stepKey="waitForSearch"/> + <see selector="{{StorefrontCategoryMainSection.productName}}" userInput="{{SimpleProduct.name}}" stepKey="seeProductNameInCategoryPage"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml new file mode 100644 index 0000000000000..5a9d6ed4f1cb5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateProductAttributeRequiredTextFieldTest"> + <annotations> + <stories value="Manage products"/> + <title value="Create Custom Product Attribute Text Field (Required) from Product Page"/> + <description value="Login as admin and create product attribute with Text Field and Required option"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-10906"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <!--Create Category--> + <createData entity="SimpleSubCategory" stepKey="createCategory"/> + <!--Create Simple Product--> + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <!--Delete created entity --> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <actionGroup ref="deleteProductAttribute" stepKey="deleteCreatedAttribute"> + <argument name="ProductAttribute" value="newProductAttribute"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Open Product Index Page--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <!-- Select Created Product--> + <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> + <waitForPageLoad stepKey="waitForProductToLoad"/> + <!-- Create Product Attribute --> + <click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/> + <waitForPageLoad stepKey="waitForAttributePageToLoad"/> + <click selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}" stepKey="clickCreateNewAttributeButton"/> + <waitForPageLoad stepKey="waitForNewAttributePageToLoad"/> + <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}" stepKey="waitForDefaultLabelToBeVisible"/> + <fillField selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillAttributeLabel"/> + <selectOption selector="{{AdminCreateNewProductAttributeSection.inputType}}" userInput="Text Field" stepKey="selectTextField"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.isRequired}}" stepKey="enableIsRequiredOption"/> + <click selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="clickOnAdvancedAttributeProperties"/> + <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="waitForAttributeCodeToVisible"/> + <scrollTo selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="scrollToAttributeCode"/> + <fillField selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="fillAttributeCode"/> + <selectOption selector="{{AdminCreateNewProductAttributeSection.scope}}" userInput="Global" stepKey="selectScope"/> + <fillField selector="{{AdminCreateNewProductAttributeSection.defaultValue}}" userInput="{{ProductAttributeOption8.value}}" stepKey="fillDefaultValue"/> + <scrollTo selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="scrollToIsUniqueOption"/> + <checkOption selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="enableIsUniqueOption"/> + <scrollToTopOfPage stepKey="scrollToTopOfPage"/> + <click selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="clickOnSaveAttribute"/> + <waitForPageLoad stepKey="waitForAttributeToSave"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="saveTheProduct"/> + <waitForPageLoad stepKey="waitForProductToSave"/> + <!--Verify product attribute added in product form and Is Required message displayed--> + <scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/> + <waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/> + <seeElement selector="{{AdminProductFormSection.attributeFieldError}}" stepKey="seeAttributeInputFiledErrorMessage"/> + <!--Fill the Required field and save the product --> + <fillField selector="{{AdminProductFormSection.attributeRequiredInput(newProductAttribute.attribute_code)}}" userInput="attribute" stepKey="fillTheAttributeRequiredInputField"/> + <scrollToTopOfPage stepKey="scrollToTopOfProductFormPage"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="saveTheProduct1"/> + <waitForPageLoad stepKey="waitForProductToSave1"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> + </test> +</tests> From 449fe3444482be2d29105f06d58a67482ce65eda Mon Sep 17 00:00:00 2001 From: John S <john00ivy@gmail.com> Date: Wed, 6 Feb 2019 15:46:41 -0600 Subject: [PATCH 160/238] MC-4418: Convert CreateProductAttributeEntityFromProductPageTest to MFTF - Adding actions to fill in the Product Quantity so it appears in the Storefront. - Correcting data references in the Test actions so they refer to the createData vs the Data Entity. --- ...mProductAttributeWithDropdownFieldTest.xml | 25 ++++++++++++++----- ...ateProductAttributeFromProductPageTest.xml | 17 +++++++++++-- ...eProductAttributeRequiredTextFieldTest.xml | 11 ++++++++ 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml index 097d3488d98da..c3011e3b88256 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml @@ -17,11 +17,14 @@ <testCaseId value="MC-10905"/> <group value="mtf_migrated"/> </annotations> + <before> <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <!--Create Category--> <createData entity="SimpleSubCategory" stepKey="createCategory"/> + <!--Create Configurable Product--> <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> <requiredEntity createDataKey="createCategory"/> @@ -31,17 +34,25 @@ <!--Delete created entity --> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> + <actionGroup ref="deleteProductAttribute" stepKey="deleteCreatedAttribute"> <argument name="ProductAttribute" value="newProductAttribute"/> </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> </after> + <!-- Open Product Index Page--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <!-- Select Created Product--> <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createConfigProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForProductToLoad"/> + + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="100" stepKey="fillProductQty"/> + <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="In Stock" stepKey="selectStockStatus"/> + <!-- Create New Product Attribute --> <click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/> <waitForPageLoad stepKey="waitForAttributePageToLoad"/> @@ -60,7 +71,6 @@ <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="waitForAttributeCodeToVisible"/> <scrollTo selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="scrollToAttributeCode"/> <fillField selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="fillAttributeCode"/> - <selectOption selector="{{AdminCreateNewProductAttributeSection.scope}}" userInput="Global" stepKey="selectScope"/> <scrollTo selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="scrollToIsUniqueOption"/> <checkOption selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="enableIsUniqueOption"/> <scrollTo selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="scrollToAdvancedAttributeProperties"/> @@ -81,11 +91,13 @@ <click selector="{{AdminProductFormSection.save}}" stepKey="saveTheProduct"/> <waitForPageLoad stepKey="waitForProductToSave"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> + <!--Verify product attribute added in product form --> <scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/> <waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/> <click selector="{{AdminProductFormSection.attributeTab}}" stepKey="clickOnAttribute"/> <seeElement selector="{{AdminProductFormSection.attributeLabelByText(ProductAttributeFrontendLabel.label)}}" stepKey="seeAttributeLabelInProductForm"/> + <!--Verify Product Attribute in Attribute Form --> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="setAttributeCode"/> @@ -94,9 +106,9 @@ <see selector="{{AdminProductAttributeGridSection.attributeCodeColumn}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="seeAttributeCode"/> <see selector="{{AdminProductAttributeGridSection.defaultLabelColumn}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeDefaultLabel"/> <see selector="{{AdminProductAttributeGridSection.isVisibleColumn}}" userInput="Yes" stepKey="seeIsVisibleColumn"/> - <see selector="{{AdminProductAttributeGridSection.scopeColumn}}" userInput="Global" stepKey="seeScopeColumn"/> <see selector="{{AdminProductAttributeGridSection.isSearchableColumn}}" userInput="Yes" stepKey="seeSearchableColumn"/> <see selector="{{AdminProductAttributeGridSection.isComparableColumn}}" userInput="Yes" stepKey="seeComparableColumn"/> + <!--Verify Product Attribute is present in Category Store Front Page --> <amOnPage url="$$createCategory.name$$.html" stepKey="goToStorefrontPage"/> <waitForPageLoad stepKey="waitForProductFrontPageToLoad"/> @@ -104,12 +116,13 @@ <waitForPageLoad stepKey="waitForPageToLoad"/> <click selector="{{StorefrontCategoryMainSection.productLink}}" stepKey="openSearchedProduct"/> <waitForPageLoad stepKey="waitForProductToLoad1"/> - <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{ApiConfigurableProduct.name}}" stepKey="seeProductNameInStoreFront"/> - <see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="{{ApiConfigurableProduct.price}}" stepKey="seeProductPriceInStoreFront"/> - <see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="{{ApiConfigurableProduct.sku}}" stepKey="seeProductSkuInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigProduct.price$$" stepKey="seeProductPriceInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="$$createConfigProduct.sku$$" stepKey="seeProductSkuInStoreFront"/> <scrollTo selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="scrollToMoreInformation"/> <see selector="{{StorefrontProductMoreInformationSection.attributeLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeLabel"/> <see selector="{{StorefrontProductMoreInformationSection.attributeValue}}" userInput="{{ProductAttributeOption8.value}}" stepKey="seeAttributeValue"/> + <!--Verify Product Attribute present in search page --> <amOnPage url="$$createCategory.name$$.html" stepKey="goToStorefrontPage1"/> <waitForPageLoad stepKey="waitForProductFrontPageToLoad1"/> @@ -117,7 +130,7 @@ <waitForPageLoad stepKey="waitForSearchTextBox"/> <click selector="{{StorefrontQuickSearchResultsSection.searchTextBoxButton}}" stepKey="clickSearchTextBoxButton"/> <waitForPageLoad stepKey="waitForSearchResultToLoad"/> - <see selector="{{StorefrontCategoryMainSection.productName}}" userInput="{{ApiConfigurableProduct.name}}" stepKey="seeProductNameInCategoryPage"/> + <see selector="{{StorefrontCategoryMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInCategoryPage"/> <see selector="{{StorefrontCategoryMainSection.productOptionList}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeProductAttributeOptionInCategoryPage"/> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml index 36393ec0890c5..bc1f92009ec43 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml @@ -17,11 +17,14 @@ <testCaseId value="MC-10899"/> <group value="mtf_migrated"/> </annotations> + <before> <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <!--Create Category--> <createData entity="SimpleSubCategory" stepKey="createCategory"/> + <!--Create Simple Product--> <createData entity="SimpleProduct" stepKey="createSimpleProduct"> <requiredEntity createDataKey="createCategory"/> @@ -30,18 +33,26 @@ <after> <!--Delete created entity --> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <!--<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>--> <actionGroup ref="deleteProductAttribute" stepKey="deleteCreatedAttribute"> <argument name="ProductAttribute" value="newProductAttribute"/> </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> </after> + <!-- Open Product Index Page--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <!-- Select Created Product--> <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForProductToLoad"/> + + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="100" stepKey="fillProductQty"/> + <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="In Stock" stepKey="selectStockStatus"/> + <!-- Create New Product Attribute --> <click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/> <waitForPageLoad stepKey="waitForAttributePageToLoad"/> @@ -54,7 +65,6 @@ <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="waitForAttributeCodeToVisible"/> <scrollTo selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="scrollToAttributeCode"/> <fillField selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="fillAttributeCode"/> - <selectOption selector="{{AdminCreateNewProductAttributeSection.scope}}" userInput="Global" stepKey="selectScope"/> <fillField selector="{{AdminCreateNewProductAttributeSection.defaultValue}}" userInput="{{ProductAttributeOption8.value}}" stepKey="fillDefaultValue"/> <scrollTo selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="scrollToIsUniqueOption"/> <checkOption selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="enableIsUniqueOption"/> @@ -76,11 +86,13 @@ <click selector="{{AdminProductFormSection.save}}" stepKey="saveTheProduct"/> <waitForPageLoad stepKey="waitForProductToSave"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> + <!--Verify product attribute added in product form --> <scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/> <waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/> <click selector="{{AdminProductFormSection.attributeTab}}" stepKey="clickOnAttribute"/> <seeElement selector="{{AdminProductFormSection.attributeLabelByText(ProductAttributeFrontendLabel.label)}}" stepKey="seeAttributeLabelInProductForm"/> + <!--Verify Product Attribute in Attribute Form --> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="setAttributeCode"/> @@ -89,9 +101,9 @@ <see selector="{{AdminProductAttributeGridSection.attributeCodeColumn}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="seeAttributeCode"/> <see selector="{{AdminProductAttributeGridSection.defaultLabelColumn}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeDefaultLabel"/> <see selector="{{AdminProductAttributeGridSection.isVisibleColumn}}" userInput="Yes" stepKey="seeIsVisibleColumn"/> - <see selector="{{AdminProductAttributeGridSection.scopeColumn}}" userInput="Global" stepKey="seeScopeColumn"/> <see selector="{{AdminProductAttributeGridSection.isSearchableColumn}}" userInput="Yes" stepKey="seeSearchableColumn"/> <see selector="{{AdminProductAttributeGridSection.isComparableColumn}}" userInput="Yes" stepKey="seeComparableColumn"/> + <!--Verify Product Attribute is present in Category Store Front Page --> <amOnPage url="$$createCategory.name$$.html" stepKey="goToStorefrontPage"/> <waitForPageLoad stepKey="waitForProductFrontPageToLoad"/> @@ -105,6 +117,7 @@ <scrollTo selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="scrollToMoreInformation"/> <see selector="{{StorefrontProductMoreInformationSection.attributeLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeLabel"/> <see selector="{{StorefrontProductMoreInformationSection.attributeValue}}" userInput="{{ProductAttributeOption8.value}}" stepKey="seeAttributeValue"/> + <!--Verify Product Attribute present in search page --> <amOnPage url="$$createCategory.name$$.html" stepKey="goToStorefrontPage1"/> <waitForPageLoad stepKey="waitForProductFrontPageToLoad1"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml index 5a9d6ed4f1cb5..b25dd46a23518 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml @@ -17,11 +17,14 @@ <testCaseId value="MC-10906"/> <group value="mtf_migrated"/> </annotations> + <before> <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <!--Create Category--> <createData entity="SimpleSubCategory" stepKey="createCategory"/> + <!--Create Simple Product--> <createData entity="SimpleProduct" stepKey="createSimpleProduct"> <requiredEntity createDataKey="createCategory"/> @@ -36,12 +39,18 @@ </actionGroup> <actionGroup ref="logout" stepKey="logout"/> </after> + <!-- Open Product Index Page--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <!-- Select Created Product--> <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForProductToLoad"/> + + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="100" stepKey="fillProductQty"/> + <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="In Stock" stepKey="selectStockStatus"/> + <!-- Create Product Attribute --> <click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/> <waitForPageLoad stepKey="waitForAttributePageToLoad"/> @@ -64,10 +73,12 @@ <waitForPageLoad stepKey="waitForAttributeToSave"/> <click selector="{{AdminProductFormSection.save}}" stepKey="saveTheProduct"/> <waitForPageLoad stepKey="waitForProductToSave"/> + <!--Verify product attribute added in product form and Is Required message displayed--> <scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/> <waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/> <seeElement selector="{{AdminProductFormSection.attributeFieldError}}" stepKey="seeAttributeInputFiledErrorMessage"/> + <!--Fill the Required field and save the product --> <fillField selector="{{AdminProductFormSection.attributeRequiredInput(newProductAttribute.attribute_code)}}" userInput="attribute" stepKey="fillTheAttributeRequiredInputField"/> <scrollToTopOfPage stepKey="scrollToTopOfProductFormPage"/> From b2fd89dcc2ca02c40ef546715b2e72b5511b2161 Mon Sep 17 00:00:00 2001 From: John S <john00ivy@gmail.com> Date: Thu, 7 Feb 2019 09:01:59 -0600 Subject: [PATCH 161/238] MC-4418: Convert CreateProductAttributeEntityFromProductPageTest to MFTF - Adjusting selectors slightly to make them more stable. --- .../Section/AdminProductAttributeGridSection.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml index f025e561e529f..12cc788ae06ae 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml @@ -17,11 +17,11 @@ <element name="FirstRow" type="button" selector="//*[@id='attributeGrid_table']/tbody/tr[1]" timeout="30"/> <element name="FilterByAttributeCode" type="input" selector="#attributeGrid_filter_attribute_code"/> <element name="attributeLabelFilter" type="input" selector="//input[@name='frontend_label']"/> - <element name="attributeCodeColumn" type="text" selector="//div[@id='attributeGrid']//tbody//td[contains(@class,'col-attr-code col-attribute_code')]"/> - <element name="defaultLabelColumn" type="text" selector="//div[@id='attributeGrid']//tbody//td[contains(@class,'col-label col-frontend_label')]"/> - <element name="isVisibleColumn" type="text" selector="//div[@id='attributeGrid']//tbody//td[contains(@class,'a-center col-is_visible')]"/> - <element name="scopeColumn" type="text" selector="//div[@id='attributeGrid']//tbody/tr/td[contains(@class,'a-center col-is_global')]"/> - <element name="isSearchableColumn" type="text" selector="//div[@id='attributeGrid']//tbody/tr/td[contains(@class,'a-center col-is_searchable')]"/> - <element name="isComparableColumn" type="text" selector="//div[@id='attributeGrid']//tbody/tr/td[contains(@class,'a-center col-is_comparable')]"/> + <element name="attributeCodeColumn" type="text" selector="//div[@id='attributeGrid']//td[contains(@class,'col-attr-code col-attribute_code')]"/> + <element name="defaultLabelColumn" type="text" selector="//div[@id='attributeGrid']//td[contains(@class,'col-label col-frontend_label')]"/> + <element name="isVisibleColumn" type="text" selector="//div[@id='attributeGrid']//td[contains(@class,'a-center col-is_visible')]"/> + <element name="scopeColumn" type="text" selector="//div[@id='attributeGrid']//td[contains(@class,'a-center col-is_global')]"/> + <element name="isSearchableColumn" type="text" selector="//div[@id='attributeGrid']//td[contains(@class,'a-center col-is_searchable')]"/> + <element name="isComparableColumn" type="text" selector="//div[@id='attributeGrid']//td[contains(@class,'a-center col-is_comparable')]"/> </section> </sections> From c58f14d84f27668013cd1dcdd5bfab51235486b4 Mon Sep 17 00:00:00 2001 From: John S <john00ivy@gmail.com> Date: Thu, 7 Feb 2019 09:06:26 -0600 Subject: [PATCH 162/238] MC-4418: Convert CreateProductAttributeEntityFromProductPageTest to MFTF - Adjusting selectors slightly to make them more stable. --- .../Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml index 2e4946095b473..65d06518346b6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml @@ -31,7 +31,7 @@ <element name="lineProductName" type="text" selector=".products.list.items.product-items li:nth-of-type({{line}}) .product-item-link" timeout="30" parameterized="true"/> <element name="asLowAs" type="input" selector="//*[@class='price-box price-final_price']/a/span[@class='price-container price-final_price tax weee']"/> <element name="productsList" type="block" selector="#maincontent .column.main"/> - <element name="productName" type="text" selector=".product.name.product-item-name"/> + <element name="productName" type="text" selector=".product-item-name"/> <element name="productOptionList" type="text" selector="#narrow-by-list"/> </section> </sections> From b408ff0e686d93243260d8d1b00f082b7cf14b3b Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Thu, 7 Feb 2019 11:35:14 -0600 Subject: [PATCH 163/238] MC-4524: Convert DeleteChildConfigurableProductTest to MFTF --- ...minDeleteConfigurableChildProductsTest.xml | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml new file mode 100644 index 0000000000000..0df9dd0b57545 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteConfigurableChildProductsTest"> + <annotations> + <stories value="Configurable Product"/> + <title value="Configurable Product should not be visible on storefront after child products are deleted"/> + <description value="Login as admin, delete configurable child product and verify product displays out of stock in store front"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-13684"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!--Set Display Out Of Stock Product --> + <magentoCLI stepKey="setDisplayOutOfStockProduct" command="config:set cataloginventory/options/show_out_of_stock 0 "/> + <!--Login as Admin --> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <!--Create Default Category --> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <!-- Create an attribute with two options to be used in the first child product --> + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <!-- Add the attribute just created to default attribute set --> + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <!-- Get the first option of the attribute created --> + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + <!-- Get the second option of the attribute created --> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + <!-- Create Configurable product --> + <createData entity="BaseConfigurableProduct" stepKey="createConfigProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <!-- Create a simple product and give it the attribute with the first option --> + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + </createData> + <!--Create a simple product and give it the attribute with the second option --> + <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + </createData> + <!-- Create the configurable product --> + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + </createData> + <!-- Add the first simple product to the configurable product --> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct1"/> + </createData> + <!-- Add the second simple product to the configurable product --> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct2"/> + </createData> + </before> + <after> + <!--Delete Created Data--> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteAttribute"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Open Product in Store Front Page --> + <amOnPage url="$$createConfigProduct.sku$$.html" stepKey="openProductInStoreFront"/> + <waitForPageLoad stepKey="waitForProductToLoad"/> + <!--Verify Product is visible and In Stock --> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryInFrontPage"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigProduct.price$$" stepKey="seeProductPriceInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="$$createConfigProduct.sku$$" stepKey="seeProductSkuInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="In Stock" stepKey="seeProductStatusInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productAttributeTitle1}}" userInput="$$createConfigProductAttribute.default_value$$" stepKey="seeProductAttributeLabel"/> + <seeElement selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" stepKey="seeProductAttributeOptions"/> + <!-- Delete Child products --> + <actionGroup ref="deleteProductBySku" stepKey="deleteFirstChildProduct"> + <argument name="sku" value="$$createConfigChildProduct1.sku$$"/> + </actionGroup> + <actionGroup ref="deleteProductBySku" stepKey="deleteSecondChildProduct"> + <argument name="sku" value="$$createConfigChildProduct2.sku$$"/> + </actionGroup> + <!--Verify product is not visible in category store front page --> + <amOnPage url="$$createCategory.name$$.html" stepKey="openCategoryStoreFrontPage"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryInStoreFrontPage"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="clickOnCategory"/> + <dontSee selector="{{StorefrontCategoryMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="dontSeeProductInCategoryPage"/> + <!--Open Product Store Front Page and Verify Product is Out Of Stock --> + <amOnPage url="$$createConfigProduct.sku$$.html" stepKey="openProductInStoreFront1"/> + <waitForPageLoad stepKey="waitForProductToLoad1"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryInFrontPage1"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInStoreFront1"/> + <dontSee selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigProduct.price$$" stepKey="dontSeeProductPriceInStoreFront"/> + <see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="$$createConfigProduct.sku$$" stepKey="seeProductSkuInStoreFront1"/> + <see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="OUT OF STOCK" stepKey="seeProductStatusInStoreFront1"/> + <dontSee selector="{{StorefrontProductInfoMainSection.productAttributeTitle1}}" userInput="$$createConfigProductAttribute.default_value$$" stepKey="dontSeeProductAttributeLabel"/> + <dontSeeElement selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" stepKey="dontSeeProductAttributeOptions"/> + </test> +</tests> From 4222ec243e43837f09581dea7a06d8bdb4d5577c Mon Sep 17 00:00:00 2001 From: Volodymyr Kublytskyi <vkublytskyi@magento.com> Date: Thu, 7 Feb 2019 12:19:27 -0600 Subject: [PATCH 164/238] Fixed code style. --- app/code/Magento/Payment/Model/Method/Cc.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index 06661469014a5..11629308cd46b 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -10,6 +10,8 @@ use Magento\Quote\Model\Quote\Payment; /** + * Credit Card payment method legacy implementation. + * * @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @deprecated 100.0.8 @@ -93,6 +95,7 @@ public function __construct( * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function validate() { @@ -205,6 +208,8 @@ public function validate() } /** + * Check if verification should be used. + * * @return bool * @api */ @@ -218,6 +223,8 @@ public function hasVerification() } /** + * Get list of credit cards verification reg exp. + * * @return array * @api */ @@ -242,6 +249,8 @@ public function getVerificationRegEx() } /** + * Validate expiration date + * * @param string $expYear * @param string $expMonth * @return bool @@ -292,6 +301,8 @@ public function assignData(\Magento\Framework\DataObject $data) } /** + * Get code for "other" credit cards. + * * @param string $type * @return bool * @api From 509ad72b2e675a45aff9daf477f230a80c71b87f Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Thu, 7 Feb 2019 16:20:29 -0600 Subject: [PATCH 165/238] MC-4415: Convert DeleteSystemProductAttributeTest to MFTF --- .../Test/Mftf/Data/ProductAttributeData.xml | 21 ++++++++++++ .../AdminDeleteSystemProductAttributeTest.xml | 34 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSystemProductAttributeTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml index cf3986003542f..3d21d1c9efc92 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml @@ -115,6 +115,27 @@ <data key="used_for_sort_by">true</data> <requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity> </entity> + <entity name="newsFromDate" type="ProductAttribute"> + <data key="attribute_code">news_from_date</data> + <data key="default_frontend_label">Set Product as New from Date</data> + <data key="frontend_input">date</data> + <data key="is_required">false</data> + <data key="is_user_defined">true</data> + <data key="scope">website</data> + <data key="is_unique">false</data> + <data key="is_searchable">false</data> + <data key="is_visible">false</data> + <data key="is_visible_on_front">false</data> + <data key="is_filterable">false</data> + <data key="is_filterable_in_search">false</data> + <data key="used_in_product_listing">true</data> + <data key="is_used_for_promo_rules">false</data> + <data key="is_comparable">false</data> + <data key="is_used_in_grid">true</data> + <data key="is_filterable_in_grid">true</data> + <data key="used_for_sort_by">false</data> + <requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity> + </entity> <entity name="newProductAttribute" type="ProductAttribute"> <data key="attribute_code" unique="suffix">attribute</data> <data key="frontend_input">Text Field</data> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSystemProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSystemProductAttributeTest.xml new file mode 100644 index 0000000000000..6de1a5cd359cd --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSystemProductAttributeTest.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteSystemProductAttributeTest"> + <annotations> + <features value="Catalog"/> + <stories value="Delete System Product Attribute"/> + <title value="Delete System Product Attribute"/> + <description value="Admin should not be able to see Delete Attribute button"/> + <testCaseId value="MC-10893"/> + <severity value="CRITICAL"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttribute"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGrid"/> + <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{newsFromDate.attribute_code}}" stepKey="setAttributeCode"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> + <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/> + <dontSeeElement selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="dontSeeDeleteAttributeBtn" /> + </test> +</tests> From da38e292fb7c00f0eaf1e8a9b99c790e7b46acce Mon Sep 17 00:00:00 2001 From: "w.perera" <w.perera@ism-apac.com> Date: Fri, 8 Feb 2019 12:51:57 +0530 Subject: [PATCH 166/238] added min=0 to qty field product detail page --- .../Catalog/view/frontend/templates/product/view/addtocart.phtml | 1 + .../view/frontend/templates/cart/item/configure/updatecart.phtml | 1 + 2 files changed, 2 insertions(+) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml index 9c18a18ff5837..baed8c1ce04de 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml @@ -20,6 +20,7 @@ <input type="number" name="qty" id="qty" + min="0" value="<?= /* @escapeNotVerified */ $block->getProductDefaultQty() * 1 ?>" title="<?= /* @escapeNotVerified */ __('Qty') ?>" class="input-text qty" diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml index c1db2f7775ca8..bfb7ddc55cda6 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml @@ -20,6 +20,7 @@ <input type="number" name="qty" id="qty" + min="0" value="" title="<?= /* @escapeNotVerified */ __('Qty') ?>" class="input-text qty" From bc3fa6b86a2541acd0a8d70ac31f11c4ebbcb59a Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Fri, 8 Feb 2019 13:42:52 +0200 Subject: [PATCH 167/238] Fix static test. --- .../backend/Magento_Ui/web/css/source/module/_data-grid.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less index 564c0769274df..829e03f461508 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less +++ b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less @@ -1074,9 +1074,9 @@ body._in-resize { } .data-grid-checkbox-cell-inner { + display: unset; margin: @data-grid-checkbox-cell-inner__padding-top @data-grid-checkbox-cell-inner__padding-horizontal .9rem; padding: 0; - display: unset; } // Content Hierarchy specific From 505352c0f87cff15ccdf00494694675263a6f2b0 Mon Sep 17 00:00:00 2001 From: Kajal Solanki <kajal.solanki@krishtechnolabs.com> Date: Fri, 8 Feb 2019 17:36:50 +0530 Subject: [PATCH 168/238] Error icon issue resolved --- .../Magento/backend/web/css/source/components/_messages.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/components/_messages.less b/app/design/adminhtml/Magento/backend/web/css/source/components/_messages.less index 19d076bd20cc5..15cd295885892 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/components/_messages.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/components/_messages.less @@ -111,7 +111,7 @@ content: @alert-icon__error__content; font-size: @alert-icon__error__font-size; left: 2.2rem; - margin-top: 0.5rem; + margin-top: -1.1rem; } } From e575e978df3ad1ab690bf8af5c192872d15c549c Mon Sep 17 00:00:00 2001 From: Abrar pathan <abrarkhan@krishtechnolabs.com> Date: Fri, 8 Feb 2019 17:55:10 +0530 Subject: [PATCH 169/238] fixed-issue-21070 --- .../Magento_Sales/web/css/source/_module.less | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less index 1e4a92fa0701f..815517670438a 100644 --- a/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less @@ -555,13 +555,13 @@ margin: 0 @tab-control__margin-right 0 0; a { - padding: @tab-control__padding-top @tab-control__padding-right; + padding: @tab-control__padding-top @indent__base; } strong { border-bottom: 0; margin-bottom: -1px; - padding: @tab-control__padding-top @tab-control__padding-right @tab-control__padding-bottom + 1 @tab-control__padding-left; + padding: @tab-control__padding-top @indent__base @tab-control__padding-bottom + 1 @indent__base; } } } @@ -687,3 +687,23 @@ } } } + +.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) { + + .order-links { + .item { + margin: 0 @tab-control__margin-right 0 0; + + a { + padding: @tab-control__padding-top @tab-control__padding-right; + } + + strong { + border-bottom: 0; + margin-bottom: -1px; + padding: @tab-control__padding-top @tab-control__padding-right @tab-control__padding-bottom + 1 @tab-control__padding-left; + } + } + } + +} \ No newline at end of file From fa72ee7f925963020ec5f5af558abff09fa4795b Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Fri, 8 Feb 2019 15:39:40 +0200 Subject: [PATCH 170/238] ENGCOM-4146: Static test fix. --- app/code/Magento/Customer/Model/Options.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Customer/Model/Options.php b/app/code/Magento/Customer/Model/Options.php index 19cac4a7bc326..71e70f8e14208 100644 --- a/app/code/Magento/Customer/Model/Options.php +++ b/app/code/Magento/Customer/Model/Options.php @@ -8,7 +8,11 @@ use Magento\Config\Model\Config\Source\Nooptreq as NooptreqSource; use Magento\Customer\Helper\Address as AddressHelper; use Magento\Framework\Escaper; +use Magento\Store\Api\Data\StoreInterface; +/** + * Customer Options. + */ class Options { /** @@ -38,7 +42,7 @@ public function __construct( /** * Retrieve name prefix dropdown options * - * @param null $store + * @param null|string|bool|int|StoreInterface $store * @return array|bool */ public function getNamePrefixOptions($store = null) @@ -52,7 +56,7 @@ public function getNamePrefixOptions($store = null) /** * Retrieve name suffix dropdown options * - * @param null $store + * @param null|string|bool|int|StoreInterface $store * @return array|bool */ public function getNameSuffixOptions($store = null) @@ -64,7 +68,9 @@ public function getNameSuffixOptions($store = null) } /** - * @param $options + * Unserialize and clear name prefix or suffix options. + * + * @param string $options * @param bool $isOptional * @return array|bool * @@ -78,6 +84,7 @@ protected function _prepareNamePrefixSuffixOptions($options, $isOptional = false /** * Unserialize and clear name prefix or suffix options + * * If field is optional, add an empty first option. * * @param string $options From 99b12549f8cf9c4b89c6651885d305c1700f9dcc Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Fri, 8 Feb 2019 15:58:56 +0200 Subject: [PATCH 171/238] ENGCOM-4149: Static test fix. --- .../Magento/Rule/Model/Condition/Product/AbstractProduct.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php index 2c6144e75f32c..e216e2ae658ba 100644 --- a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php +++ b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php @@ -95,8 +95,8 @@ abstract class AbstractProduct extends \Magento\Rule\Model\Condition\AbstractCon * @param \Magento\Catalog\Model\ResourceModel\Product $productResource * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\Collection $attrSetCollection * @param \Magento\Framework\Locale\FormatInterface $localeFormat - * @param ProductCategoryList|null $categoryList * @param array $data + * @param ProductCategoryList|null $categoryList * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -699,6 +699,7 @@ protected function _getAttributeSetId($productId) /** * Correct '==' and '!=' operators + * * Categories can't be equal because product is included categories selected by administrator and in their parents * * @return string From e53d9727dd1d4098e4547ffd8db430f41f084681 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Fri, 8 Feb 2019 16:24:00 +0200 Subject: [PATCH 172/238] ENGCOM-4145: Static test fix. --- .../Magento_Swatches/web/css/source/_module.less | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less index 11ebd48d449ba..7445fcf919ae4 100644 --- a/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less @@ -97,13 +97,13 @@ .swatch-option-tooltip-layered .title { .lib-css(color, @swatch-option-tooltip-layered-title__color); - width: 100%; - height: 20px; - position: absolute; bottom: -5px; + height: 20px; left: 0; - text-align: center; margin-bottom: @indent__s; + position: absolute; + text-align: center; + width: 100%; } } @@ -146,9 +146,9 @@ font-size: @font-size__s; font-weight: @font-weight__bold; line-height: 20px; - padding: 4px 8px; - min-width: 22px; margin-right: 7px; + min-width: 22px; + padding: 4px 8px; &.selected { .lib-css(background-color, @swatch-option-text__selected__background-color) !important; From 1efb4a9f3435e0ec1f2b1b9d0b6a3242eee20eb7 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Fri, 8 Feb 2019 16:40:45 +0200 Subject: [PATCH 173/238] ENGCOM-4101: Static test fix. --- app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php index 7ac11ca073d26..bfbe1fb4fd7ff 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php @@ -55,10 +55,10 @@ class OrderSender extends Sender * @param OrderIdentity $identityContainer * @param Order\Email\SenderBuilderFactory $senderBuilderFactory * @param \Psr\Log\LoggerInterface $logger + * @param Renderer $addressRenderer * @param PaymentHelper $paymentHelper * @param OrderResource $orderResource * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig - * @param Renderer $addressRenderer * @param ManagerInterface $eventManager */ public function __construct( From 93b1e0d7f4a6e6da1300649da2afc90f61e14632 Mon Sep 17 00:00:00 2001 From: Sergey Shvets <sshvets@magento.com> Date: Fri, 8 Feb 2019 17:00:49 +0200 Subject: [PATCH 174/238] MAGETWO-98105: Import button is available in cases it's shouldn't. --- app/code/Magento/CatalogImportExport/Model/Import/Product.php | 2 +- .../ImportExport/Controller/Adminhtml/Import/Validate.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index c525b69b91e7f..de402279d75f7 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -2556,7 +2556,7 @@ public function validateRow(array $rowData, $rowNum) $rowNum, $rowData[self::COL_NAME], $message, - ProcessingError::ERROR_LEVEL_NOT_CRITICAL + $errorLevel ) ->getErrorAggregator() ->addRowToSkip($rowNum); diff --git a/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php b/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php index fa84abca5ce23..a0992e28bb2cd 100644 --- a/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php +++ b/app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php @@ -136,7 +136,7 @@ private function getImport() private function addMessageToSkipErrors(Result $resultBlock) { $import = $this->getImport(); - if (!$import->getErrorAggregator()->hasToBeTerminated()) { + if (!$import->getErrorAggregator()->hasFatalExceptions()) { $resultBlock->addSuccess( __('Please fix errors and re-upload file or simply press "Import" button to skip rows with errors'), true From bf6d02348fc414ad011d944731232734eea18dba Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Fri, 8 Feb 2019 18:03:08 +0200 Subject: [PATCH 175/238] Fix functional test. --- app/code/Magento/Sales/Test/Mftf/Section/OrdersGridSection.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Section/OrdersGridSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/OrdersGridSection.xml index 717022322698f..b716047a39008 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/OrdersGridSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/OrdersGridSection.xml @@ -19,7 +19,7 @@ <element name="website" type="radio" selector="//label[contains(text(), '{{arg}}')]" parameterized="true"/> <element name="addProducts" type="button" selector="#add_products"/> - <element name="selectProduct" type="checkbox" selector="//td[contains(text(), '{{arg}}')]/following-sibling::td[contains(@class, 'col-select col-in_products')]" parameterized="true"/> + <element name="selectProduct" type="checkbox" selector="//td[contains(text(), '{{arg}}')]/following-sibling::td[contains(@class, 'col-select col-in_products')]/label/input" parameterized="true"/> <element name="setQuantity" type="checkbox" selector="//td[contains(text(), '{{arg}}')]/following-sibling::td[contains(@class, 'col-qty')]/input" parameterized="true"/> <element name="addProductsToOrder" type="button" selector="//span[text()='Add Selected Product(s) to Order']"/> <element name="customPrice" type="checkbox" selector="//span[text()='{{arg}}']/parent::td/following-sibling::td/div//span[contains(text(),'Custom Price')]" parameterized="true"/> From 20d2a7b0303716e7c3c27c7c8281cb932a1ba5e3 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Fri, 8 Feb 2019 19:08:22 +0200 Subject: [PATCH 176/238] MAGETWO-98183: [2.3] State is always required in backend in customer address form --- .../Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php index 9a025211c9b0a..0aeed1562c51e 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php @@ -48,7 +48,7 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele $regionId = $element->getForm()->getElement('region_id')->getValue(); - $html = '<div class="field field-state required admin__field _required">'; + $html = '<div class="field field-state admin__field">'; $element->setClass('input-text admin__control-text'); $element->setRequired(true); $html .= $element->getLabelHtml() . '<div class="control admin__field-control">'; From c5f211b71bb97eb161e2c61e6b091cde9fb5b34b Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@adobe.com> Date: Fri, 8 Feb 2019 11:27:32 -0600 Subject: [PATCH 177/238] MQE-1352: bug fix in dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php --- .../CurlTransport/BackendDecorator.php | 65 ++++++++++++++----- 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php b/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php index bb82715e4b402..1126cd29727fc 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php @@ -63,23 +63,54 @@ public function __construct(CurlTransport $transport, DataInterface $configurati */ protected function authorize() { - // Perform GET to backend url so form_key is set - $url = $_ENV['app_backend_url']; - $this->transport->write($url, [], CurlInterface::GET); - $this->read(); - - $url = $_ENV['app_backend_url'] . $this->configuration->get('application/0/backendLoginUrl/0/value'); - $data = [ - 'login[username]' => $this->configuration->get('application/0/backendLogin/0/value'), - 'login[password]' => $this->configuration->get('application/0/backendPassword/0/value'), - 'form_key' => $this->formKey, - ]; - $this->transport->write($url, $data, CurlInterface::POST); - $response = $this->read(); - if (strpos($response, 'login-form') !== false) { - throw new \Exception( - 'Admin user cannot be logged in by curl handler!' - ); + // There are situations where magento application backend url could be slightly different from the environment + // variable we know. It could be intentionally (e.g. InstallTest) or unintentionally. We would still want tests + // to run in this case. + // When the original app_backend_url does not work, we will try 4 variants of the it. i.e. with and without + // url rewrite, http and https. + $urls = []; + $originalUrl = rtrim($_ENV['app_backend_url'], '/') . '/'; + $urls[] = $originalUrl; + if (strpos($originalUrl, '/index.php') !== false) { + $url2 = str_replace('/index.php', '', $originalUrl); + } else { + $url2 = $originalUrl . 'index.php/'; + } + $urls[] = $url2; + if (strpos($originalUrl, 'https') !== false) { + $urls[] = str_replace('https', 'http', $originalUrl); + } else { + $urls[] = str_replace('http', 'https', $url2); + } + + $isAuthorized = false; + foreach ($urls as $url) { + try { + // Perform GET to backend url so form_key is set + $this->transport->write($url, [], CurlInterface::GET); + $this->read(); + + $authUrl = $url . $this->configuration->get('application/0/backendLoginUrl/0/value'); + $data = [ + 'login[username]' => $this->configuration->get('application/0/backendLogin/0/value'), + 'login[password]' => $this->configuration->get('application/0/backendPassword/0/value'), + 'form_key' => $this->formKey, + ]; + + $this->transport->write($authUrl, $data, CurlInterface::POST); + $response = $this->read(); + if (strpos($response, 'login-form')) { + continue; + } + $isAuthorized = true; + $_ENV['app_backend_url'] = $url; + break; + } catch (\Exception $e) { + continue; + } + } + if ($isAuthorized == false) { + throw new \Exception('Admin user cannot be logged in by curl handler!'); } } From d8c6e31f5f723397b51c3e8c7b3945b25ef45926 Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Fri, 8 Feb 2019 13:13:45 -0600 Subject: [PATCH 178/238] MC-4412: Convert CreateAttributeSetEntityTest to MFTF --- .../AdminProductAttributeSetActionGroup.xml | 9 +++ .../AdminProductAttributeSetGridSection.xml | 1 + .../AdminCreateAttributeSetEntityTest.xml | 72 +++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml index a3b4203b7a69e..77d2faa3552c1 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml @@ -45,6 +45,15 @@ <fillField selector="{{AdminProductAttributeSetSection.name}}" userInput="{{label}}" stepKey="fillName"/> <click selector="{{AdminProductAttributeSetSection.saveBtn}}" stepKey="clickSave1"/> </actionGroup> + <actionGroup name="goToAttributeSetByName"> + <arguments> + <argument name="name" type="string"/> + </arguments> + <click selector="{{AdminProductAttributeSetGridSection.resetFilter}}" stepKey="clickResetButton"/> + <fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="{{name}}" stepKey="filterByName"/> + <click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch"/> + <click selector="{{AdminProductAttributeSetGridSection.nthRow('1')}}" stepKey="clickFirstRow"/> + </actionGroup> <!-- Filter By Attribute Label --> <actionGroup name="filterProductAttributeByAttributeLabel"> <arguments> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeSetGridSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeSetGridSection.xml index b906e2fa9084b..3fad50adb771a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeSetGridSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeSetGridSection.xml @@ -14,5 +14,6 @@ <element name="nthRow" type="block" selector="#setGrid_table tbody tr:nth-of-type({{var1}})" parameterized="true"/> <element name="AttributeSetName" type="text" selector="//td[contains(text(), '{{var1}}')]" parameterized="true"/> <element name="addAttributeSetBtn" type="button" selector="button.add-set" timeout="30"/> + <element name="resetFilter" type="button" selector="button[data-action='grid-filter-reset']" timeout="30"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml new file mode 100644 index 0000000000000..03cf03e3e3fcb --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateAttributeSetEntityTest"> + <annotations> + <features value="Catalog"/> + <stories value="Create Attribute Set"/> + <title value="Create attribute set with new product attribute"/> + <description value="Admin should be able to create attribute set with new product attribute"/> + <testCaseId value="MC-10884"/> + <severity value="CRITICAL"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="productAttributeWysiwyg" stepKey="createProductAttribute"/> + </before> + + <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> + <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSets"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <actionGroup ref="goToAttributeSetByName" stepKey="filterProductAttributeSetGridByLabel"> + <argument name="name" value="$$createAttributeSet.attribute_set_name$$"/> + </actionGroup> + + <!-- Assert created attribute in an unassigned attributes --> + <see userInput="$$createProductAttribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassignedAttr"/> + + <!-- Assign attribute in the group --> + <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <argument name="group" value="Product Details"/> + <argument name="attribute" value="$$createProductAttribute.attribute_code$$"/> + </actionGroup> + <see userInput="$$createProductAttribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/> + <actionGroup ref="SaveAttributeSet" stepKey="SaveAttributeSet"/> + <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSets2"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + + <!-- Assert an attribute in the group--> + <actionGroup ref="goToAttributeSetByName" stepKey="filterProductAttributeSetGridByLabel2"> + <argument name="name" value="$$createAttributeSet.attribute_set_name$$"/> + </actionGroup> + <see userInput="$$createProductAttribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup2"/> + + <!-- Assert attribute can be used in product creation --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToCatalogProductGrid"/> + <waitForPageLoad stepKey="waitForPageLoad3"/> + <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/> + <click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/> + + <!-- Switch from default attribute set to new attribute set --> + <click selector="{{AdminProductFormSection.attributeSet}}" stepKey="startEditAttrSet"/> + <fillField selector="{{AdminProductFormSection.attributeSetFilter}}" userInput="$$createAttributeSet.attribute_set_name$$" stepKey="searchForAttrSet"/> + <click selector="{{AdminProductFormSection.attributeSetFilterResult}}" stepKey="selectAttrSet"/> + + <!-- See new attribute set --> + <see selector="{{AdminProductFormSection.attributeSet}}" userInput="$$createAttributeSet.attribute_set_name$$" stepKey="seeAttributeSetName"/> + + <!--Finish filling the new product page and save the product --> + <actionGroup ref="fillMainProductForm" stepKey="fillSimpleProductMain"> + <argument name="product" value="_defaultProduct"/> + </actionGroup> + <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> + </test> +</tests> From 265c403ddef1eb638fe8e6470543da39a788fc94 Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Fri, 8 Feb 2019 13:42:05 -0600 Subject: [PATCH 179/238] MC-4412: Convert CreateAttributeSetEntityTest to MFTF --- .../Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml index 03cf03e3e3fcb..337dc693a4ce9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml @@ -62,11 +62,5 @@ <!-- See new attribute set --> <see selector="{{AdminProductFormSection.attributeSet}}" userInput="$$createAttributeSet.attribute_set_name$$" stepKey="seeAttributeSetName"/> - - <!--Finish filling the new product page and save the product --> - <actionGroup ref="fillMainProductForm" stepKey="fillSimpleProductMain"> - <argument name="product" value="_defaultProduct"/> - </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> </test> </tests> From dff3e6a0659380705053cbcd068cb1fb2e488e60 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@adobe.com> Date: Fri, 8 Feb 2019 14:11:28 -0600 Subject: [PATCH 180/238] Revert "MQE-1145: Update FrontendExecutor::authorize() method." This reverts commit e9f5427 --- .../Mftf/Test/StorefrontDeletePersistedWishlistTest.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeletePersistedWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeletePersistedWishlistTest.xml index 0bb4ca843726e..0001bd9d6db75 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeletePersistedWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeletePersistedWishlistTest.xml @@ -16,6 +16,9 @@ <severity value="AVERAGE"/> <group value="wishlist"/> <testCaseId value="MC-4110"/> + <skip> + <issueId value="MQE-1145"/> + </skip> </annotations> <before> <createData stepKey="category" entity="SimpleSubCategory"/> @@ -36,7 +39,6 @@ </after> <amOnPage stepKey="amOnSignInPage" url="{{StorefrontCustomerSignInPage.url}}"/> - <waitForPageLoad stepKey="waitForLoginPage"/> <fillField stepKey="fillEmail" userInput="$$customer.email$$" selector="{{StorefrontCustomerSignInFormSection.emailField}}"/> <fillField stepKey="fillPassword" userInput="$$customer.password$$" selector="{{StorefrontCustomerSignInFormSection.passwordField}}"/> <waitForElementVisible stepKey="waitForButton" selector="{{StorefrontCustomerSignInFormSection.signInAccountButton}}"/> @@ -44,8 +46,8 @@ <see stepKey="seeFirstName" userInput="$$customer.firstname$$" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" /> <see stepKey="seeLastName" userInput="$$customer.lastname$$" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" /> <see stepKey="seeEmail" userInput="$$customer.email$$" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" /> + <waitForPageLoad stepKey="15"/> <amOnPage stepKey="amOnWishlist" url="{{StorefrontCustomerWishlistPage.url}}"/> - <waitForPageLoad stepKey="waitForWishlist"/> <see stepKey="seeWishlist" userInput="$$product.name$$" selector="{{StorefrontCustomerWishlistSection.productItemNameText}}"/> <moveMouseOver stepKey="mouseOver" selector="{{StorefrontCustomerWishlistSection.productItemNameText}}"/> <waitForElementVisible stepKey="waitForRemoveButton" selector="{{StorefrontCustomerWishlistSection.removeWishlistButton}}"/> From 8c4c1189723e821663a041861b21c0b4d5757b12 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@adobe.com> Date: Fri, 8 Feb 2019 14:12:43 -0600 Subject: [PATCH 181/238] MQE-1352: bug fix in dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php --- .../Mtf/Util/Protocol/CurlTransport/BackendDecorator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php b/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php index 1126cd29727fc..44ddb16a18741 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php @@ -99,7 +99,7 @@ protected function authorize() $this->transport->write($authUrl, $data, CurlInterface::POST); $response = $this->read(); - if (strpos($response, 'login-form')) { + if (strpos($response, 'login-form') !== false) { continue; } $isAuthorized = true; From d684fa1d56bc869c3b0afc0bed18e75edd28840e Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Fri, 8 Feb 2019 14:49:54 -0600 Subject: [PATCH 182/238] MC-4412: Convert CreateAttributeSetEntityTest to MFTF --- .../Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml index 337dc693a4ce9..d9e410a9a3009 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml @@ -21,9 +21,13 @@ <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <createData entity="productAttributeWysiwyg" stepKey="createProductAttribute"/> + <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> </before> + <after> + <deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/> + <deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/> + </after> - <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSets"/> <waitForPageLoad stepKey="waitForPageLoad"/> <actionGroup ref="goToAttributeSetByName" stepKey="filterProductAttributeSetGridByLabel"> From 01cda3e5967a7208390f4a9a56e1c64d2684b857 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Fri, 8 Feb 2019 15:00:02 -0600 Subject: [PATCH 183/238] MC-4412: Convert CreateAttributeSetEntityTest to MFTF - Add waitForPageLoad to new actionGroup --- .../Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml index 77d2faa3552c1..a4d4f92035c18 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml @@ -53,6 +53,7 @@ <fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="{{name}}" stepKey="filterByName"/> <click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch"/> <click selector="{{AdminProductAttributeSetGridSection.nthRow('1')}}" stepKey="clickFirstRow"/> + <waitForPageLoad stepKey="waitForPageLoad"/> </actionGroup> <!-- Filter By Attribute Label --> <actionGroup name="filterProductAttributeByAttributeLabel"> From 448f838494a950c375af08f73fe519bb26d688fc Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Fri, 8 Feb 2019 15:36:16 -0600 Subject: [PATCH 184/238] MC-4524: Convert DeleteChildConfigurableProductTest to MFTF - Add timeout to element to increase robustness --- .../Catalog/Test/Mftf/Section/StorefrontHeaderSection.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontHeaderSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontHeaderSection.xml index 509ad2b8f849c..52a377ad264c0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontHeaderSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontHeaderSection.xml @@ -9,6 +9,6 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="StorefrontHeaderSection"> - <element name="NavigationCategoryByName" type="button" selector="//nav//a[span[contains(., '{{var1}}')]]" parameterized="true"/> + <element name="NavigationCategoryByName" type="button" selector="//nav//a[span[contains(., '{{var1}}')]]" parameterized="true" timeout="30"/> </section> </sections> From 16d720c4456c79ab87e20b01ba2300d5693803ba Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Fri, 8 Feb 2019 16:01:39 -0600 Subject: [PATCH 185/238] MC-4418: Convert CreateProductAttributeEntityFromProductPageTest to MFTF - Filter product grid before attempting to click a row --- .../AdminCreateCustomProductAttributeWithDropdownFieldTest.xml | 3 +++ .../Test/AdminCreateProductAttributeFromProductPageTest.xml | 3 +++ .../Test/AdminCreateProductAttributeRequiredTextFieldTest.xml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml index c3011e3b88256..5b6a0b7f2ab3e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml @@ -47,6 +47,9 @@ <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> <!-- Select Created Product--> + <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku"> + <argument name="product" value="$$createConfigProduct$$"/> + </actionGroup> <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createConfigProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForProductToLoad"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml index bc1f92009ec43..5badcc366ac3a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml @@ -47,6 +47,9 @@ <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> <!-- Select Created Product--> + <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku"> + <argument name="product" value="$$createSimpleProduct$$"/> + </actionGroup> <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForProductToLoad"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml index b25dd46a23518..176af624022e4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml @@ -45,6 +45,9 @@ <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> <!-- Select Created Product--> + <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku"> + <argument name="product" value="$$createSimpleProduct$$"/> + </actionGroup> <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> <waitForPageLoad stepKey="waitForProductToLoad"/> From 8483e9479885e420f92f970535362d4fb99b0207 Mon Sep 17 00:00:00 2001 From: Patrick McLain <pat@pmclain.com> Date: Fri, 8 Feb 2019 18:17:34 -0500 Subject: [PATCH 186/238] Add alt text to saved payment method for accessibility Fixes #21089 --- .../Magento/Payment/Model/CcConfigProvider.php | 5 +++-- .../Test/Unit/Model/CcConfigProviderTest.php | 14 +++++++++++--- .../view/frontend/web/template/payment/form.html | 3 ++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Payment/Model/CcConfigProvider.php b/app/code/Magento/Payment/Model/CcConfigProvider.php index 15bdd0072a51a..ba3721e6cfc2b 100644 --- a/app/code/Magento/Payment/Model/CcConfigProvider.php +++ b/app/code/Magento/Payment/Model/CcConfigProvider.php @@ -69,7 +69,7 @@ public function getIcons() } $types = $this->ccConfig->getCcAvailableTypes(); - foreach (array_keys($types) as $code) { + foreach ($types as $code => $label) { if (!array_key_exists($code, $this->icons)) { $asset = $this->ccConfig->createAsset('Magento_Payment::images/cc/' . strtolower($code) . '.png'); $placeholder = $this->assetSource->findSource($asset); @@ -78,7 +78,8 @@ public function getIcons() $this->icons[$code] = [ 'url' => $asset->getUrl(), 'width' => $width, - 'height' => $height + 'height' => $height, + 'title' => __($label), ]; } } diff --git a/app/code/Magento/Payment/Test/Unit/Model/CcConfigProviderTest.php b/app/code/Magento/Payment/Test/Unit/Model/CcConfigProviderTest.php index a8856166995fc..ff6aea44645cf 100644 --- a/app/code/Magento/Payment/Test/Unit/Model/CcConfigProviderTest.php +++ b/app/code/Magento/Payment/Test/Unit/Model/CcConfigProviderTest.php @@ -42,12 +42,14 @@ public function testGetConfig() 'vi' => [ 'url' => 'http://cc.card/vi.png', 'width' => getimagesize($imagesDirectoryPath . 'vi.png')[0], - 'height' => getimagesize($imagesDirectoryPath . 'vi.png')[1] + 'height' => getimagesize($imagesDirectoryPath . 'vi.png')[1], + 'title' => __('Visa'), ], 'ae' => [ 'url' => 'http://cc.card/ae.png', 'width' => getimagesize($imagesDirectoryPath . 'ae.png')[0], - 'height' => getimagesize($imagesDirectoryPath . 'ae.png')[1] + 'height' => getimagesize($imagesDirectoryPath . 'ae.png')[1], + 'title' => __('American Express'), ] ] ] @@ -56,11 +58,13 @@ public function testGetConfig() $ccAvailableTypesMock = [ 'vi' => [ + 'title' => 'Visa', 'fileId' => 'Magento_Payment::images/cc/vi.png', 'path' => $imagesDirectoryPath . 'vi.png', 'url' => 'http://cc.card/vi.png' ], 'ae' => [ + 'title' => 'American Express', 'fileId' => 'Magento_Payment::images/cc/ae.png', 'path' => $imagesDirectoryPath . 'ae.png', 'url' => 'http://cc.card/ae.png' @@ -68,7 +72,11 @@ public function testGetConfig() ]; $assetMock = $this->createMock(\Magento\Framework\View\Asset\File::class); - $this->ccConfigMock->expects($this->once())->method('getCcAvailableTypes')->willReturn($ccAvailableTypesMock); + $this->ccConfigMock->expects($this->once())->method('getCcAvailableTypes') + ->willReturn(array_combine( + array_keys($ccAvailableTypesMock), + array_column($ccAvailableTypesMock, 'title') + )); $this->ccConfigMock->expects($this->atLeastOnce()) ->method('createAsset') diff --git a/app/code/Magento/Vault/view/frontend/web/template/payment/form.html b/app/code/Magento/Vault/view/frontend/web/template/payment/form.html index b5593626fb15c..5f32281686a65 100644 --- a/app/code/Magento/Vault/view/frontend/web/template/payment/form.html +++ b/app/code/Magento/Vault/view/frontend/web/template/payment/form.html @@ -19,7 +19,8 @@ <img data-bind="attr: { 'src': getIcons(getCardType()).url, 'width': getIcons(getCardType()).width, - 'height': getIcons(getCardType()).height + 'height': getIcons(getCardType()).height, + 'alt': getIcons(getCardType()).title }" class="payment-icon"> <span translate="'ending'"></span> <span text="getMaskedCard()"></span> From 8bdedc57dcb23bb0945f28e29a9f7d22c82bdec0 Mon Sep 17 00:00:00 2001 From: Emipro <git@emiprotechnologies.com> Date: Sat, 9 Feb 2019 12:08:11 +0530 Subject: [PATCH 187/238] Update Code for Price Calculation --- .../Magento/Catalog/Block/Product/View/Options.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Product/View/Options.php b/app/code/Magento/Catalog/Block/Product/View/Options.php index ece517d033f87..10f73b6012f66 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options.php @@ -12,6 +12,7 @@ namespace Magento\Catalog\Block\Product\View; use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Option\Value; /** * @api @@ -20,11 +21,6 @@ */ class Options extends \Magento\Framework\View\Element\Template { - /** - * Option type percent - */ - protected static $typePercent = 'percent'; - /** * @var Product */ @@ -165,8 +161,10 @@ public function hasOptions() */ protected function _getPriceConfiguration($option) { - $option->getPriceType() == self::$typePercent ? $optionPrice = $option->getPrice(true) : - $optionPrice = $this->pricingHelper->currency($option->getPrice(true), false, false); + $optionPrice = $option->getPrice(true); + if($option->getPriceType() != Value::TYPE_PERCENT) { + $optionPrice = $this->pricingHelper->currency($optionPrice, false, false); + } $data = [ 'prices' => [ 'oldPrice' => [ From 9b46c95d503d0b8927b8f39697f936dd3baf6d3d Mon Sep 17 00:00:00 2001 From: Satya Prakash <satyaprakash@cedcoss.com> Date: Sat, 9 Feb 2019 14:50:08 +0530 Subject: [PATCH 188/238] added new line according to travis --- app/code/Magento/Ui/view/base/web/js/form/element/date.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index 299c33ba01972..088dd61ec6a53 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -124,6 +124,7 @@ define([ dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat; shiftedValue = moment(value, dateFormat); } + if (!shiftedValue.isValid()) { shiftedValue = moment(value, this.inputDateFormat); } From 3c98751d1e73b11bafa45da98186a413de9c4cb7 Mon Sep 17 00:00:00 2001 From: Chris Snedaker <df2002@gmail.com> Date: Sat, 9 Feb 2019 04:30:48 -0500 Subject: [PATCH 189/238] Removed useless sprintf, which resulted in removing additional code no longer used --- .../Downloadable/Model/ResourceModel/Link.php | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/app/code/Magento/Downloadable/Model/ResourceModel/Link.php b/app/code/Magento/Downloadable/Model/ResourceModel/Link.php index 24d1d7831c9e3..9706e1cf8be24 100644 --- a/app/code/Magento/Downloadable/Model/ResourceModel/Link.php +++ b/app/code/Magento/Downloadable/Model/ResourceModel/Link.php @@ -5,10 +5,6 @@ */ namespace Magento\Downloadable\Model\ResourceModel; -use Magento\Catalog\Api\Data\ProductInterface; -use Magento\Framework\App\ObjectManager; -use Magento\Framework\EntityManager\MetadataPool; - /** * Downloadable Product Samples resource model * @@ -17,11 +13,6 @@ */ class Link extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { - /** - * @var MetadataPool - */ - private $metadataPool; - /** * Catalog data * @@ -210,10 +201,7 @@ public function getSearchableData($productId, $storeId) [] )->join( ['cpe' => $this->getTable('catalog_product_entity')], - sprintf( - 'cpe.entity_id = m.product_id', - $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField() - ), + 'cpe.entity_id = m.product_id', [] )->joinLeft( ['st' => $this->getTable('downloadable_link_title')], @@ -234,16 +222,4 @@ protected function _createCurrency() { return $this->_currencyFactory->create(); } - - /** - * Get MetadataPool instance - * @return MetadataPool - */ - private function getMetadataPool() - { - if (!$this->metadataPool) { - $this->metadataPool = ObjectManager::getInstance()->get(MetadataPool::class); - } - return $this->metadataPool; - } } From b9421d0f083cef323d6b028147b91c49bb020b73 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Sat, 9 Feb 2019 12:19:07 +0200 Subject: [PATCH 190/238] Fixing returning types --- app/code/Magento/Backend/Block/Template/Context.php | 2 +- app/code/Magento/Backup/Model/Backup.php | 2 +- app/code/Magento/Ui/Component/Wysiwyg/Config.php | 2 +- .../Widget/Block/Adminhtml/Widget/Catalog/Category/Chooser.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Backend/Block/Template/Context.php b/app/code/Magento/Backend/Block/Template/Context.php index 6efc8d86802ce..7e78f1ad8d758 100644 --- a/app/code/Magento/Backend/Block/Template/Context.php +++ b/app/code/Magento/Backend/Block/Template/Context.php @@ -197,7 +197,7 @@ public function getFormKey() } /** - * @return \Magento\Framework\Data\Form\FormKey + * @return \Magento\Framework\Code\NameBuilder */ public function getNameBuilder() { diff --git a/app/code/Magento/Backup/Model/Backup.php b/app/code/Magento/Backup/Model/Backup.php index 3768f2bf8c8ce..1dc392920942e 100644 --- a/app/code/Magento/Backup/Model/Backup.php +++ b/app/code/Magento/Backup/Model/Backup.php @@ -242,7 +242,7 @@ public function setFile(&$content) /** * Return content of backup file * - * @return string + * @return array * @throws \Magento\Framework\Exception\LocalizedException */ public function &getFile() diff --git a/app/code/Magento/Ui/Component/Wysiwyg/Config.php b/app/code/Magento/Ui/Component/Wysiwyg/Config.php index 48014a0160c41..d88a255927876 100644 --- a/app/code/Magento/Ui/Component/Wysiwyg/Config.php +++ b/app/code/Magento/Ui/Component/Wysiwyg/Config.php @@ -13,7 +13,7 @@ class Config implements ConfigInterface /** * Return WYSIWYG configuration * - * @return \Magento\Framework\DataObject + * @return array */ public function getConfig() { diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Catalog/Category/Chooser.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Catalog/Category/Chooser.php index 7e6ba87860307..4207285860faf 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Catalog/Category/Chooser.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Catalog/Category/Chooser.php @@ -18,7 +18,7 @@ class Chooser extends \Magento\Catalog\Block\Adminhtml\Category\Widget\Chooser * * @param \Magento\Framework\Data\Tree\Node|array $node * @param int $level - * @return string + * @return array */ protected function _getNodeJson($node, $level = 0) { From b2451d021edac8e3e18e0ae43c65737899fd3adb Mon Sep 17 00:00:00 2001 From: Chris Snedaker <df2002@gmail.com> Date: Sat, 9 Feb 2019 05:22:14 -0500 Subject: [PATCH 191/238] Updated incorrect or useless sprintf usage; Simplified isset usage for readability --- .../Catalog/Model/Indexer/Category/Flat/AbstractAction.php | 4 ++-- .../Product/LinkedProductSelectBuilderByBasePrice.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php index 8b952ca844bb9..e5944e91d2e4d 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php @@ -130,7 +130,7 @@ protected function getFlatTableStructure($tableName) $table = $this->connection->newTable( $tableName )->setComment( - sprintf("Catalog Category Flat", $tableName) + 'Catalog Category Flat' ); //Adding columns @@ -378,7 +378,7 @@ protected function getAttributeValues($entityIds, $storeId) $linkField = $this->getCategoryMetadata()->getLinkField(); foreach ($attributesType as $type) { foreach ($this->getAttributeTypeValues($type, $entityIds, $storeId) as $row) { - if (isset($row[$linkField]) && isset($row['attribute_id'])) { + if (isset($row[$linkField], $row['attribute_id'])) { $attributeId = $row['attribute_id']; if (isset($attributes[$attributeId])) { $attributeCode = $attributes[$attributeId]['attribute_code']; diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByBasePrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByBasePrice.php index 8841b6059c46f..c961bf2bc893f 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByBasePrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByBasePrice.php @@ -85,7 +85,7 @@ public function build($productId) [] )->joinInner( [BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS => $productTable], - sprintf('%s.entity_id = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS, $linkField), + sprintf('%s.entity_id = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS), ['entity_id'] )->joinInner( ['t' => $priceAttribute->getBackendTable()], From e0fb77ec0c4b250e644c3c92f0987130c9e26a66 Mon Sep 17 00:00:00 2001 From: Yogesh Suhagiya <yksuhagiya@gmail.com> Date: Sat, 9 Feb 2019 16:12:15 +0530 Subject: [PATCH 192/238] Apply PHP-CS-Fixer braces fixes on if and foreach statements --- .../product/edit/tab/attributes/extend.phtml | 14 +++++++------- .../templates/product/layered/renderer.phtml | 10 ++++------ .../Ui/view/base/templates/stepswizard.phtml | 8 ++++---- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml index 224cd71538b7b..a770ae864a74c 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml @@ -20,9 +20,9 @@ $isElementReadonly = $block->getElement() ->getReadonly(); ?> -<?php if (!($attributeCode === 'price' && $block->getCanReadPrice() === false)) { ?> +<?php if (!($attributeCode === 'price' && $block->getCanReadPrice() === false)): ?> <div class="<?= /* @escapeNotVerified */ $attributeCode ?> "><?= /* @escapeNotVerified */ $elementHtml ?></div> -<?php } ?> +<?php endif; ?> <?= $block->getExtendedElement($switchAttributeCode)->toHtml() ?> @@ -43,13 +43,13 @@ $isElementReadonly = $block->getElement() } else { if ($attribute) { <?php if ($attributeCode === 'price' && !$block->getCanEditPrice() && $block->getCanReadPrice() - && $block->getProduct()->isObjectNew()) { ?> + && $block->getProduct()->isObjectNew()): ?> <?php $defaultProductPrice = $block->getDefaultProductPrice() ?: "''"; ?> $attribute.value = <?= /* @escapeNotVerified */ $defaultProductPrice ?>; - <?php } else { ?> + <?php else: ?> $attribute.disabled = false; $attribute.addClassName('required-entry'); - <?php } ?> + <?php endif; ?> } if ($('dynamic-price-warning')) { $('dynamic-price-warning').hide(); @@ -58,9 +58,9 @@ $isElementReadonly = $block->getElement() } <?php if (!($attributeCode === 'price' && !$block->getCanEditPrice() - && !$block->getProduct()->isObjectNew())) { ?> + && !$block->getProduct()->isObjectNew())): ?> $('<?= /* @escapeNotVerified */ $switchAttributeCode ?>').observe('change', <?= /* @escapeNotVerified */ $switchAttributeCode ?>_change); - <?php } ?> + <?php endif; ?> Event.observe(window, 'load', function(){ <?= /* @escapeNotVerified */ $switchAttributeCode ?>_change(); }); diff --git a/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml b/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml index 3492f83fd1828..d817000f7bc46 100644 --- a/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml +++ b/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml @@ -17,7 +17,7 @@ <a href="<?= /* @escapeNotVerified */ $label['link'] ?>" aria-label="<?= /* @escapeNotVerified */ $label['label'] ?>" class="swatch-option-link-layered"> - <?php if (isset($swatchData['swatches'][$option]['type'])) { ?> + <?php if (isset($swatchData['swatches'][$option]['type'])): ?> <?php switch ($swatchData['swatches'][$option]['type']) { case '3': ?> @@ -32,10 +32,8 @@ <?php break; case '2': ?> - <?php $swatchThumbPath = $block->getSwatchPath('swatch_thumb', - $swatchData['swatches'][$option]['value']); ?> - <?php $swatchImagePath = $block->getSwatchPath('swatch_image', - $swatchData['swatches'][$option]['value']); ?> + <?php $swatchThumbPath = $block->getSwatchPath('swatch_thumb', $swatchData['swatches'][$option]['value']); ?> + <?php $swatchImagePath = $block->getSwatchPath('swatch_image', $swatchData['swatches'][$option]['value']); ?> <div class="swatch-option image <?= /* @escapeNotVerified */ $label['custom_style'] ?>" tabindex="-1" option-type="2" @@ -69,7 +67,7 @@ ><?= /* @escapeNotVerified */ $swatchData['swatches'][$option]['value'] ?></div> <?php break; } ?> - <?php } ?> + <?php endif; ?> </a> <?php endforeach; ?> </div> diff --git a/app/code/Magento/Ui/view/base/templates/stepswizard.phtml b/app/code/Magento/Ui/view/base/templates/stepswizard.phtml index 05a537b9a6559..78e73e0cd9a69 100644 --- a/app/code/Magento/Ui/view/base/templates/stepswizard.phtml +++ b/app/code/Magento/Ui/view/base/templates/stepswizard.phtml @@ -13,14 +13,14 @@ <div data-role="steps-wizard-controls" class="steps-wizard-navigation"> <ul class="nav-bar"> - <?php foreach ($block->getSteps() as $step) { ?> + <?php foreach ($block->getSteps() as $step): ?> <li data-role="collapsible" data-bind="css: { 'active': selectedStep() == '<?= /* @escapeNotVerified */ $step->getComponentName() ?>'}"> <a href="#<?= /* @escapeNotVerified */ $step->getComponentName() ?>" data-bind="click: showSpecificStep"> <?= /* @escapeNotVerified */ $step->getCaption() ?> </a> </li> - <?php } ?> + <?php endforeach; ?> </ul> <div class="nav-bar-outer-actions"> <div class="action-wrap" data-role="closeBtn"> @@ -45,13 +45,13 @@ </div> </div> <div data-role="steps-wizard-tab"> - <?php foreach ($block->getSteps() as $step) { ?> + <?php foreach ($block->getSteps() as $step): ?> <div data-bind="visible: selectedStep() == $element.id, css: {'no-display':false}" class="content no-display" id="<?= /* @escapeNotVerified */ $step->getComponentName() ?>" data-role="content"> <?= /* @escapeNotVerified */ $step->getContent() ?> </div> - <?php } ?> + <?php endforeach; ?> </div> </div> From a4be26e54731901683c015f2e8fed915f1c9bb57 Mon Sep 17 00:00:00 2001 From: Ankit Srivastava <31412411+ankitsrivastavacedcoss@users.noreply.github.com> Date: Sat, 9 Feb 2019 17:50:14 +0530 Subject: [PATCH 193/238] Updated Cart.php Updated Deprecated functions call --- app/code/Magento/Wishlist/Controller/Index/Cart.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Wishlist/Controller/Index/Cart.php b/app/code/Magento/Wishlist/Controller/Index/Cart.php index 0e826d83a52f6..5bc4882d5e246 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Cart.php +++ b/app/code/Magento/Wishlist/Controller/Index/Cart.php @@ -195,12 +195,12 @@ public function execute() } } } catch (ProductException $e) { - $this->messageManager->addError(__('This product(s) is out of stock.')); + $this->messageManager->addErrorMessage(__('This product(s) is out of stock.')); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addNotice($e->getMessage()); + $this->messageManager->addNoticeMessage($e->getMessage()); $redirectUrl = $configureUrl; } catch (\Exception $e) { - $this->messageManager->addException($e, __('We can\'t add the item to the cart right now.')); + $this->messageManager->addExceptionMessage($e, __('We can\'t add the item to the cart right now.')); } $this->helper->calculate(); From 60e59a8240ea8a64553d72ebdd32c4009e7286bb Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Sat, 9 Feb 2019 15:56:46 +0200 Subject: [PATCH 194/238] Fixing compare block product removing action from sidebar --- .../luma/Magento_Catalog/web/css/source/_module.less | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less index f15509ceb63eb..89101c9892b5c 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less @@ -534,6 +534,15 @@ } } + .block-compare { + .action { + &.delete { + &:extend(.abs-remove-button-for-blocks all); + right: initial; + } + } + } + .action.tocart { border-radius: 0; } From 30dd664e3d7e5fbe94758cf9531de57fdb53b165 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Sat, 9 Feb 2019 16:25:39 +0200 Subject: [PATCH 195/238] Improves the UX by moving the customer to the Dashboard's Recent Orders --- .../Magento/Sales/view/frontend/templates/reorder/sidebar.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/view/frontend/templates/reorder/sidebar.phtml b/app/code/Magento/Sales/view/frontend/templates/reorder/sidebar.phtml index 9b3633fde60b4..a2ab3d02b13ea 100644 --- a/app/code/Magento/Sales/view/frontend/templates/reorder/sidebar.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/reorder/sidebar.phtml @@ -57,7 +57,7 @@ </button> </div> <div class="secondary"> - <a class="action view" href="<?= /* @escapeNotVerified */ $block->getUrl('customer/account') ?>"> + <a class="action view" href="<?= /* @escapeNotVerified */ $block->getUrl('customer/account') ?>#my-orders-table"> <span><?= /* @escapeNotVerified */ __('View All') ?></span> </a> </div> From 7db162a755838ffbabb07d0c31f281ff3c64bc5b Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun <mitry@atwix.com> Date: Sun, 10 Feb 2019 21:48:02 +0200 Subject: [PATCH 196/238] Fix static test --- app/code/Magento/Backend/Block/Template/Context.php | 8 ++++++++ app/code/Magento/Backup/Model/Backup.php | 12 +++++++++++- .../Adminhtml/Widget/Catalog/Category/Chooser.php | 5 +---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Backend/Block/Template/Context.php b/app/code/Magento/Backend/Block/Template/Context.php index 7e78f1ad8d758..e8491bd7c701a 100644 --- a/app/code/Magento/Backend/Block/Template/Context.php +++ b/app/code/Magento/Backend/Block/Template/Context.php @@ -173,6 +173,8 @@ public function getAuthorization() } /** + * Get Backend Session + * * @return \Magento\Backend\Model\Session */ public function getBackendSession() @@ -181,6 +183,8 @@ public function getBackendSession() } /** + * Get Math Random + * * @return \Magento\Framework\Math\Random */ public function getMathRandom() @@ -189,6 +193,8 @@ public function getMathRandom() } /** + * Get Form Key + * * @return \Magento\Framework\Data\Form\FormKey */ public function getFormKey() @@ -197,6 +203,8 @@ public function getFormKey() } /** + * Get Class Name Builder + * * @return \Magento\Framework\Code\NameBuilder */ public function getNameBuilder() diff --git a/app/code/Magento/Backup/Model/Backup.php b/app/code/Magento/Backup/Model/Backup.php index 1dc392920942e..1a69ad3a085ff 100644 --- a/app/code/Magento/Backup/Model/Backup.php +++ b/app/code/Magento/Backup/Model/Backup.php @@ -80,6 +80,7 @@ class Backup extends \Magento\Framework\DataObject implements \Magento\Framework * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor * @param \Magento\Framework\Filesystem $filesystem * @param array $data + * @throws \Magento\Framework\Exception\FileSystemException */ public function __construct( \Magento\Backup\Helper\Data $helper, @@ -275,8 +276,9 @@ public function deleteFile() * * @param bool $write * @return $this - * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Backup\Exception\NotEnoughPermissions + * @throws \Magento\Framework\Exception\FileSystemException + * @throws \Magento\Framework\Exception\InputException */ public function open($write = false) { @@ -330,6 +332,7 @@ protected function _getStream() * * @param int $length * @return string + * @throws \Magento\Framework\Exception\InputException */ public function read($length) { @@ -340,6 +343,7 @@ public function read($length) * Check end of file. * * @return bool + * @throws \Magento\Framework\Exception\InputException */ public function eof() { @@ -370,6 +374,7 @@ public function write($string) * Close open backup file * * @return $this + * @throws \Magento\Framework\Exception\InputException */ public function close() { @@ -383,6 +388,8 @@ public function close() * Print output * * @return string + * @return \Magento\Framework\Filesystem\Directory\ReadInterface|string|void + * @throws \Magento\Framework\Exception\FileSystemException */ public function output() { @@ -398,6 +405,8 @@ public function output() } /** + * Get Size + * * @return int|mixed */ public function getSize() @@ -419,6 +428,7 @@ public function getSize() * * @param string $password * @return bool + * @throws \Exception */ public function validateUserPassword($password) { diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Catalog/Category/Chooser.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Catalog/Category/Chooser.php index 4207285860faf..230598a7e263d 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Catalog/Category/Chooser.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Catalog/Category/Chooser.php @@ -3,14 +3,11 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +namespace Magento\Widget\Block\Adminhtml\Widget\Catalog\Category; /** * Category chooser for widget's layout updates - * - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Widget\Block\Adminhtml\Widget\Catalog\Category; - class Chooser extends \Magento\Catalog\Block\Adminhtml\Category\Widget\Chooser { /** From d3a1fd12406a37e943d9b4577e91c8c53e120e35 Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun <d.cheshun@atwix.com> Date: Sun, 10 Feb 2019 22:59:38 +0200 Subject: [PATCH 197/238] Update _module.less Code refactoring, remove the redundant rules --- .../Magento/luma/Magento_Sales/web/css/source/_module.less | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less index 815517670438a..314f0d0ee6298 100644 --- a/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less @@ -689,7 +689,6 @@ } .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) { - .order-links { .item { margin: 0 @tab-control__margin-right 0 0; @@ -699,11 +698,8 @@ } strong { - border-bottom: 0; - margin-bottom: -1px; padding: @tab-control__padding-top @tab-control__padding-right @tab-control__padding-bottom + 1 @tab-control__padding-left; } } } - -} \ No newline at end of file +} From a60ad87cef48e021b86dba6777b35b0525a4a7eb Mon Sep 17 00:00:00 2001 From: Ihor Sviziev <ihor-sviziev@users.noreply.github.com> Date: Mon, 11 Feb 2019 12:03:31 +0200 Subject: [PATCH 198/238] magento/magento2#21098 Updated Deprecated functions call Fix unit test failure --- .../Wishlist/Test/Unit/Controller/Index/CartTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/CartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/CartTest.php index d89f6e43e07be..e9061f1f3d5f8 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/CartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/CartTest.php @@ -735,7 +735,7 @@ public function testExecuteWithoutQuantityArrayAndOutOfStock() ->willThrowException(new ProductException(__('Test Phrase'))); $this->messageManagerMock->expects($this->once()) - ->method('addError') + ->method('addErrorMessage') ->with('This product(s) is out of stock.', null) ->willReturnSelf(); @@ -901,7 +901,7 @@ public function testExecuteWithoutQuantityArrayAndConfigurable() ->willThrowException(new \Magento\Framework\Exception\LocalizedException(__('message'))); $this->messageManagerMock->expects($this->once()) - ->method('addNotice') + ->method('addNoticeMessage') ->with('message', null) ->willReturnSelf(); @@ -1073,7 +1073,7 @@ public function testExecuteWithEditQuantity() ->willThrowException(new \Magento\Framework\Exception\LocalizedException(__('message'))); $this->messageManagerMock->expects($this->once()) - ->method('addNotice') + ->method('addNoticeMessage') ->with('message', null) ->willReturnSelf(); From 47f64e95a359b81fa8ea852163865c9f63628da5 Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun <d.cheshun@atwix.com> Date: Mon, 11 Feb 2019 12:10:19 +0200 Subject: [PATCH 199/238] Fix static test --- app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php b/app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php index 6e0d52c2d4f74..dd2e23e67f3d7 100644 --- a/app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php +++ b/app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php @@ -109,6 +109,8 @@ public function __construct( * * @return string {JSON encoded data} * @since 101.1.0 + * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Magento\Framework\Exception\NoSuchEntityException */ public function getCurrentProductData() { From 6e133c6aa8afa9f2da925a8305eab9818f427dcf Mon Sep 17 00:00:00 2001 From: Charaka <c.gamlath@ism-apac.com> Date: Mon, 11 Feb 2019 16:02:07 +0530 Subject: [PATCH 200/238] Remove unused reference on wishlist fromcart controller --- app/code/Magento/Wishlist/Controller/Index/Fromcart.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Controller/Index/Fromcart.php b/app/code/Magento/Wishlist/Controller/Index/Fromcart.php index 49396004427f2..9e434db4aa7ea 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Fromcart.php +++ b/app/code/Magento/Wishlist/Controller/Index/Fromcart.php @@ -8,7 +8,6 @@ use Magento\Checkout\Helper\Cart as CartHelper; use Magento\Checkout\Model\Cart as CheckoutCart; -use Magento\Customer\Model\Session; use Magento\Framework\App\Action; use Magento\Framework\Data\Form\FormKey\Validator; use Magento\Framework\Escaper; From c020b2c5a8326e4f5d738fe75a5f29f9b4825521 Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Mon, 11 Feb 2019 12:36:21 +0200 Subject: [PATCH 201/238] Fix static test. --- app/code/Magento/Downloadable/Helper/Download.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index 2b257d03a6564..6b7db3af51195 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -13,6 +13,7 @@ /** * Downloadable Products Download Helper * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class Download extends \Magento\Framework\App\Helper\AbstractHelper { @@ -261,9 +262,9 @@ public function setResource($resourceFile, $linkType = self::LINK_TYPE_FILE) */ if ($linkType === self::LINK_TYPE_URL) { $headers = array_change_key_case(get_headers($this->_resourceFile, 1), CASE_LOWER); - if(isset($headers['location'])){ - $this->_resourceFile = is_array($headers['location']) ? current($headers['location']): - $headers['location']; + if (isset($headers['location'])) { + $this->_resourceFile = is_array($headers['location']) ? current($headers['location']) + : $headers['location']; } } From 266666be309e39074918897959e7296adc61456f Mon Sep 17 00:00:00 2001 From: Charaka <c.gamlath@ism-apac.com> Date: Mon, 11 Feb 2019 16:24:59 +0530 Subject: [PATCH 202/238] Remove unused reference on wishlist ConvertSerializedData controller --- .../Magento/Wishlist/Setup/Patch/Data/ConvertSerializedData.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Setup/Patch/Data/ConvertSerializedData.php b/app/code/Magento/Wishlist/Setup/Patch/Data/ConvertSerializedData.php index 76f27756d8270..856997f66c629 100644 --- a/app/code/Magento/Wishlist/Setup/Patch/Data/ConvertSerializedData.php +++ b/app/code/Magento/Wishlist/Setup/Patch/Data/ConvertSerializedData.php @@ -10,7 +10,6 @@ use Magento\Framework\DB\DataConverter\SerializedToJson; use Magento\Framework\DB\Select\QueryModifierFactory; use Magento\Framework\DB\Query\Generator as QueryGenerator; -use Magento\Framework\App\ResourceConnection; use Magento\Framework\Setup\Patch\DataPatchInterface; use Magento\Framework\Setup\Patch\PatchVersionInterface; From 4461a29d2b8c1bb151f3020cf4dc2f7f1d7448d7 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Mon, 11 Feb 2019 13:28:03 +0200 Subject: [PATCH 203/238] ENGCOM-4084: Static test fix. --- app/code/Magento/Ui/Component/MassAction.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Ui/Component/MassAction.php b/app/code/Magento/Ui/Component/MassAction.php index c1a38a75e7fb2..4cca8d4c012bb 100644 --- a/app/code/Magento/Ui/Component/MassAction.php +++ b/app/code/Magento/Ui/Component/MassAction.php @@ -6,6 +6,8 @@ namespace Magento\Ui\Component; /** + * Mass action UI component. + * * @api * @since 100.0.2 */ From bf32a7f603af79d5ac7b0c487c887d907d169b38 Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Mon, 11 Feb 2019 13:53:02 +0200 Subject: [PATCH 204/238] Fix static tests. --- .../Catalog/Model/ResourceModel/AbstractResource.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php index f7879d7f93281..786fff611a025 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php @@ -7,6 +7,9 @@ namespace Magento\Catalog\Model\ResourceModel; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; +use Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend; +use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend; +use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; /** * Catalog entity abstract model @@ -86,16 +89,14 @@ protected function _isApplicableAttribute($object, $attribute) /** * Check whether attribute instance (attribute, backend, frontend or source) has method and applicable * - * @param AbstractAttribute|\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend - * |\Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend - * |\Magento\Eav\Model\Entity\Attribute\Source\AbstractSource $instance + * @param AbstractAttribute|AbstractBackend|AbstractFrontend|AbstractSource $instance * @param string $method * @param array $args array of arguments * @return boolean */ protected function _isCallableAttributeInstance($instance, $method, $args) { - if ($instance instanceof \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend + if ($instance instanceof AbstractBackend && ($method == 'beforeSave' || $method == 'afterSave') ) { $attributeCode = $instance->getAttribute()->getAttributeCode(); @@ -112,6 +113,7 @@ protected function _isCallableAttributeInstance($instance, $method, $args) /** * Retrieve select object for loading entity attributes values + * * Join attribute store value * * @param \Magento\Framework\DataObject $object @@ -244,6 +246,7 @@ protected function _saveAttributeValue($object, $attribute, $value) /** * Check if attribute present for non default Store View. + * * Prevent "delete" query locking in a case when nothing to delete * * @param AbstractAttribute $attribute From cffe3462bfca3a041360e6aa8ab373889b8d1eff Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Mon, 11 Feb 2019 15:14:09 +0200 Subject: [PATCH 205/238] ENGCOM-4178: Static test fix. --- .../Magento/Catalog/view/frontend/web/js/validate-product.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/frontend/web/js/validate-product.js b/app/code/Magento/Catalog/view/frontend/web/js/validate-product.js index ab848aa442f81..755e777a01f77 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/validate-product.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/validate-product.js @@ -42,7 +42,7 @@ define([ return false; } }); - $(this.options.addToCartButtonSelector).attr('disabled',false); + $(this.options.addToCartButtonSelector).attr('disabled', false); } }); From 1d9d47d00abef90e3599e214fb711860edfc6566 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@adobe.com> Date: Mon, 11 Feb 2019 10:26:55 -0600 Subject: [PATCH 206/238] MQE-1352: bug fix in dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php --- .../Mtf/Util/Protocol/CurlTransport/BackendDecorator.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php b/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php index 44ddb16a18741..d7026e9b8efb3 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php @@ -71,6 +71,8 @@ protected function authorize() $urls = []; $originalUrl = rtrim($_ENV['app_backend_url'], '/') . '/'; $urls[] = $originalUrl; + // It could be the case that the page needs a refresh, so we will try the original one twice. + $urls[] = $originalUrl; if (strpos($originalUrl, '/index.php') !== false) { $url2 = str_replace('/index.php', '', $originalUrl); } else { From 84d440d1ddb6a5eebc9af8885ec0a7d90d50d004 Mon Sep 17 00:00:00 2001 From: John S <john00ivy@gmail.com> Date: Mon, 11 Feb 2019 20:22:55 -0600 Subject: [PATCH 207/238] MC-4399: Convert AddToCartCrossSellTest to MFTF - Adding "clean up" steps in the after block. - Replaced waitForLoadingMaskToDisappear with waitForPageLoad. --- .../Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml index dc1ac7dc4d9f1..8897373e15d6a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml @@ -29,16 +29,18 @@ <createData entity="_defaultProduct" stepKey="simpleProduct3"> <requiredEntity createDataKey="category1"/> </createData> + + <actionGroup ref="LoginAsAdmin" stepKey="logInAsAdmin"/> </before> <after> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <deleteData createDataKey="simpleProduct1" stepKey="deleteSimp1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteSimp2"/> <deleteData createDataKey="simpleProduct3" stepKey="deleteSimp3"/> <deleteData createDataKey="category1" stepKey="deleteCategory"/> </after> - <actionGroup ref="LoginAsAdmin" stepKey="logInAsAdmin"/> - <!-- Go to simpleProduct1, add simpleProduct2 and simpleProduct3 as cross-sell--> <amOnPage url="{{AdminProductEditPage.url($simpleProduct1.id$)}}" stepKey="goToProduct1"/> <click stepKey="openHeader1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.sectionHeader}}"/> @@ -50,7 +52,7 @@ <argument name="sku" value="$simpleProduct3.sku$"/> </actionGroup> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave"/> - <waitForLoadingMaskToDisappear stepKey="waitForProductPageSave"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> <!-- Go to simpleProduct3, add simpleProduct1 and simpleProduct2 as cross-sell--> <amOnPage url="{{AdminProductEditPage.url($simpleProduct3.id$)}}" stepKey="goToProduct3"/> @@ -63,7 +65,7 @@ <argument name="sku" value="$simpleProduct2.sku$"/> </actionGroup> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave2"/> - <waitForLoadingMaskToDisappear stepKey="waitForProductPageSave2"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> <!-- Go to frontend, add simpleProduct1 to cart--> <actionGroup ref="AddSimpleProductToCart" stepKey="addSimp1ToCart"> From 9ad428de9165eeab759fb4966edbfe9e2d96d6f5 Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Tue, 12 Feb 2019 09:51:43 +0200 Subject: [PATCH 208/238] Fix static tests. --- .../Catalog/Model/Indexer/Category/Flat/AbstractAction.php | 7 +++++++ .../Product/LinkedProductSelectBuilderByBasePrice.php | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php index e5944e91d2e4d..1506ccf6963bf 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php @@ -8,6 +8,9 @@ use Magento\Framework\App\ResourceConnection; +/** + * Abstract action class for category flat indexers. + */ class AbstractAction { /** @@ -496,6 +499,8 @@ protected function getTableName($name) } /** + * Get category metadata instance. + * * @return \Magento\Framework\EntityManager\EntityMetadata */ private function getCategoryMetadata() @@ -509,6 +514,8 @@ private function getCategoryMetadata() } /** + * Get skip static columns instance. + * * @return array */ private function getSkipStaticColumns() diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByBasePrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByBasePrice.php index c961bf2bc893f..841fe17bdcf05 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByBasePrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByBasePrice.php @@ -11,6 +11,9 @@ use Magento\Framework\DB\Select; use Magento\Store\Model\Store; +/** + * Provide Select object for retrieve product id with minimal price. + */ class LinkedProductSelectBuilderByBasePrice implements LinkedProductSelectBuilderInterface { /** @@ -69,7 +72,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function build($productId) { From db4c00cebb227f7a5ff1846de78be4838f78759d Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Tue, 12 Feb 2019 10:44:55 +0200 Subject: [PATCH 209/238] Fix static test. --- app/code/Magento/Payment/Model/CcConfigProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Payment/Model/CcConfigProvider.php b/app/code/Magento/Payment/Model/CcConfigProvider.php index ba3721e6cfc2b..497ce93c30c71 100644 --- a/app/code/Magento/Payment/Model/CcConfigProvider.php +++ b/app/code/Magento/Payment/Model/CcConfigProvider.php @@ -44,7 +44,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function getConfig() { From 76468502c720ae637c3c61382dfd57a40c071ad1 Mon Sep 17 00:00:00 2001 From: gauravagarwal1001 <37572719+gauravagarwal1001@users.noreply.github.com> Date: Tue, 12 Feb 2019 14:38:45 +0530 Subject: [PATCH 210/238] Updated Account.php --- .../Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php index bb24d2ae15a34..f53fe4b4f745a 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php @@ -203,7 +203,7 @@ private function extractValuesFromAttributes(array $attributes, int $storeId): a if (isset($defaultValue) && !isset($formValues[$code])) { $formValues[$code] = $defaultValue; } - if ($code === 'group_id' && empty($defaultValue)) { + if ($code === 'group_id' && empty($formValues[$code])) { $formValues[$code] = $this->getDefaultCustomerGroup($storeId); } } From 37c6ae3245eec78fab5be6aafb28debeee1b9810 Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Tue, 12 Feb 2019 11:54:44 +0200 Subject: [PATCH 211/238] Fix static test. --- .../Wishlist/Controller/Index/Fromcart.php | 4 +++- .../Patch/Data/ConvertSerializedData.php | 24 +++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Wishlist/Controller/Index/Fromcart.php b/app/code/Magento/Wishlist/Controller/Index/Fromcart.php index 9e434db4aa7ea..52d0951f1670c 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Fromcart.php +++ b/app/code/Magento/Wishlist/Controller/Index/Fromcart.php @@ -18,9 +18,11 @@ use Magento\Wishlist\Helper\Data as WishlistHelper; /** + * Add cart item to wishlist and remove from cart controller. + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Fromcart extends \Magento\Wishlist\Controller\AbstractIndex +class Fromcart extends \Magento\Wishlist\Controller\AbstractIndex implements Action\HttpPostActionInterface { /** * @var WishlistProviderInterface diff --git a/app/code/Magento/Wishlist/Setup/Patch/Data/ConvertSerializedData.php b/app/code/Magento/Wishlist/Setup/Patch/Data/ConvertSerializedData.php index 856997f66c629..0e809c4703921 100644 --- a/app/code/Magento/Wishlist/Setup/Patch/Data/ConvertSerializedData.php +++ b/app/code/Magento/Wishlist/Setup/Patch/Data/ConvertSerializedData.php @@ -3,19 +3,17 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Wishlist\Setup\Patch\Data; -use Magento\Framework\DB\FieldDataConverterFactory; use Magento\Framework\DB\DataConverter\SerializedToJson; -use Magento\Framework\DB\Select\QueryModifierFactory; +use Magento\Framework\DB\FieldDataConverterFactory; use Magento\Framework\DB\Query\Generator as QueryGenerator; +use Magento\Framework\DB\Select\QueryModifierFactory; use Magento\Framework\Setup\Patch\DataPatchInterface; use Magento\Framework\Setup\Patch\PatchVersionInterface; /** - * Class ConvertSerializedData - * @package Magento\Wishlist\Setup\Patch + * Convert serialized wishlist item data. */ class ConvertSerializedData implements DataPatchInterface, PatchVersionInterface { @@ -59,7 +57,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function apply() { @@ -67,7 +65,7 @@ public function apply() } /** - * {@inheritdoc} + * @inheritdoc */ public static function getDependencies() { @@ -75,7 +73,7 @@ public static function getDependencies() } /** - * {@inheritdoc} + * @inheritdoc */ public static function getVersion() { @@ -83,13 +81,19 @@ public static function getVersion() } /** - * {@inheritdoc} + * @inheritdoc */ public function getAliases() { return []; } - + + /** + * Convert serialized whishlist item data. + * + * @throws \Magento\Framework\DB\FieldDataConversionException + * @throws \Magento\Framework\Exception\LocalizedException + */ private function convertSerializedData() { $connection = $this->moduleDataSetup->getConnection(); From 9b1d04676d14940e185682395c595a3fb10d0760 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Tue, 12 Feb 2019 14:02:06 +0200 Subject: [PATCH 212/238] ENGCOM-4194: Static test fix. --- app/code/Magento/Backend/Block/Template/Context.php | 1 + app/code/Magento/Backup/Model/Backup.php | 1 + lib/internal/Magento/Framework/Code/NameBuilder.php | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Backend/Block/Template/Context.php b/app/code/Magento/Backend/Block/Template/Context.php index e8491bd7c701a..3695c3a943106 100644 --- a/app/code/Magento/Backend/Block/Template/Context.php +++ b/app/code/Magento/Backend/Block/Template/Context.php @@ -17,6 +17,7 @@ * the classes they were introduced for. * * @api + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @since 100.0.2 */ diff --git a/app/code/Magento/Backup/Model/Backup.php b/app/code/Magento/Backup/Model/Backup.php index 1a69ad3a085ff..c3507ecf5b459 100644 --- a/app/code/Magento/Backup/Model/Backup.php +++ b/app/code/Magento/Backup/Model/Backup.php @@ -14,6 +14,7 @@ * @method string getPath() * @method string getName() * @method string getTime() + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @api * @since 100.0.2 diff --git a/lib/internal/Magento/Framework/Code/NameBuilder.php b/lib/internal/Magento/Framework/Code/NameBuilder.php index c27a896b65f04..53f1b946f4cc1 100644 --- a/lib/internal/Magento/Framework/Code/NameBuilder.php +++ b/lib/internal/Magento/Framework/Code/NameBuilder.php @@ -1,12 +1,15 @@ <?php /** - * Name builder - * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\Code; +/** + * Name builder. + * + * @api + */ class NameBuilder { /** From fde7fb1940d41214911bf3f91016f86524a0ff2b Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Tue, 12 Feb 2019 16:30:29 +0200 Subject: [PATCH 213/238] ENGCOM-4217: Static test fix. --- .../Magento/Catalog/Block/Product/View/Options.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Product/View/Options.php b/app/code/Magento/Catalog/Block/Product/View/Options.php index 10f73b6012f66..c457b20cd0904 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options.php @@ -4,17 +4,15 @@ * See COPYING.txt for license details. */ -/** - * Product options block - * - * @author Magento Core Team <core@magentocommerce.com> - */ namespace Magento\Catalog\Block\Product\View; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Option\Value; /** + * Product options block + * + * @author Magento Core Team <core@magentocommerce.com> * @api * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @since 100.0.2 @@ -122,6 +120,8 @@ public function setProduct(Product $product = null) } /** + * Get group of option. + * * @param string $type * @return string */ @@ -143,6 +143,8 @@ public function getOptions() } /** + * Check if block has options. + * * @return bool */ public function hasOptions() @@ -162,7 +164,7 @@ public function hasOptions() protected function _getPriceConfiguration($option) { $optionPrice = $option->getPrice(true); - if($option->getPriceType() != Value::TYPE_PERCENT) { + if ($option->getPriceType() !== Value::TYPE_PERCENT) { $optionPrice = $this->pricingHelper->currency($optionPrice, false, false); } $data = [ From b0fb0449bc4f50282551aaafe7cf7cf93ab986fa Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Tue, 12 Feb 2019 16:47:28 +0200 Subject: [PATCH 214/238] Fix functional test. --- .../Test/TestCase/ImportDataNegativeTest.xml | 2 +- .../Test/_files/template/pricing/advanced_incorrect.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/AdvancedPricingImportExport/Test/TestCase/ImportDataNegativeTest.xml b/dev/tests/functional/tests/app/Magento/AdvancedPricingImportExport/Test/TestCase/ImportDataNegativeTest.xml index 65b4d6e973bb3..db992e662d817 100644 --- a/dev/tests/functional/tests/app/Magento/AdvancedPricingImportExport/Test/TestCase/ImportDataNegativeTest.xml +++ b/dev/tests/functional/tests/app/Magento/AdvancedPricingImportExport/Test/TestCase/ImportDataNegativeTest.xml @@ -19,7 +19,7 @@ <item name="entity" xsi:type="string">Advanced Pricing</item> <item name="behavior" xsi:type="string">Add/Update</item> <item name="validation_strategy" xsi:type="string">Stop on Error</item> - <item name="allowed_error_count" xsi:type="string">10</item> + <item name="allowed_error_count" xsi:type="string">1</item> <item name="import_field_separator" xsi:type="string">,</item> <item name="import_multiple_value_separator" xsi:type="string">,</item> <item name="import_file" xsi:type="array"> diff --git a/dev/tests/functional/tests/app/Magento/AdvancedPricingImportExport/Test/_files/template/pricing/advanced_incorrect.php b/dev/tests/functional/tests/app/Magento/AdvancedPricingImportExport/Test/_files/template/pricing/advanced_incorrect.php index 12203222534cd..e728a87616392 100644 --- a/dev/tests/functional/tests/app/Magento/AdvancedPricingImportExport/Test/_files/template/pricing/advanced_incorrect.php +++ b/dev/tests/functional/tests/app/Magento/AdvancedPricingImportExport/Test/_files/template/pricing/advanced_incorrect.php @@ -14,5 +14,13 @@ 'tier_price' => 'text', 'tier_price_value_type' => 'Fixed', ], + 'data_1' => [ + 'sku' => '%sku%', + 'tier_price_website' => "All Websites [USD]", + 'tier_price_customer_group' => 'ALL GROUPS', + 'tier_price_qty' => '3', + 'tier_price' => 'text', + 'tier_price_value_type' => 'Fixed', + ], ], ]; From 083553c337fa891f3125057f286f2e9eed9c28ff Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Tue, 12 Feb 2019 16:54:53 +0200 Subject: [PATCH 215/238] ENGCOM-4210: Static test fix. --- app/code/Magento/Downloadable/Model/ResourceModel/Link.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Downloadable/Model/ResourceModel/Link.php b/app/code/Magento/Downloadable/Model/ResourceModel/Link.php index 9706e1cf8be24..df8427bdde652 100644 --- a/app/code/Magento/Downloadable/Model/ResourceModel/Link.php +++ b/app/code/Magento/Downloadable/Model/ResourceModel/Link.php @@ -216,6 +216,8 @@ public function getSearchableData($productId, $storeId) } /** + * Get Currency model. + * * @return \Magento\Directory\Model\Currency */ protected function _createCurrency() From bc92929a2d0835767b98a5a026463bea38011464 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Tue, 12 Feb 2019 17:22:01 +0200 Subject: [PATCH 216/238] ENGCOM-4215: Static test fix. --- .../Controller/Adminhtml/Promo/Quote/Save.php | 28 ++++++++++++++----- .../SalesRule/Model/Rule/DataProvider.php | 12 ++++---- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php index c1f540eb57d27..7d55d18b770e2 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php @@ -7,8 +7,8 @@ namespace Magento\SalesRule\Controller\Adminhtml\Promo\Quote; use Magento\Framework\App\Action\HttpPostActionInterface; -use Magento\Framework\Stdlib\DateTime\TimezoneInterface; use Magento\Framework\App\Request\DataPersistorInterface; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; /** * SalesRule save controller @@ -84,12 +84,8 @@ public function execute() $data ); $data = $inputFilter->getUnescaped(); - $id = $this->getRequest()->getParam('rule_id'); - if ($id) { - $model->load($id); - if ($id != $model->getId()) { - throw new \Magento\Framework\Exception\LocalizedException(__('The wrong rule is specified.')); - } + if (!$this->checkRuleExists($model)) { + throw new \Magento\Framework\Exception\LocalizedException(__('The wrong rule is specified.')); } $session = $this->_objectManager->get(\Magento\Backend\Model\Session::class); @@ -159,4 +155,22 @@ public function execute() } $this->_redirect('sales_rule/*/'); } + + /** + * Check if Cart Price Rule with provided id exists. + * + * @param \Magento\SalesRule\Model\Rule $model + * @return bool + */ + private function checkRuleExists(\Magento\SalesRule\Model\Rule $model): bool + { + $id = $this->getRequest()->getParam('rule_id'); + if ($id) { + $model->load($id); + if ($model->getId() != $id) { + return false; + } + } + return true; + } } diff --git a/app/code/Magento/SalesRule/Model/Rule/DataProvider.php b/app/code/Magento/SalesRule/Model/Rule/DataProvider.php index a336f62207d5c..25f0ef91eae68 100644 --- a/app/code/Magento/SalesRule/Model/Rule/DataProvider.php +++ b/app/code/Magento/SalesRule/Model/Rule/DataProvider.php @@ -5,10 +5,10 @@ */ namespace Magento\SalesRule\Model\Rule; +use Magento\Framework\App\Request\DataPersistorInterface; use Magento\SalesRule\Model\ResourceModel\Rule\Collection; use Magento\SalesRule\Model\ResourceModel\Rule\CollectionFactory; use Magento\SalesRule\Model\Rule; -use Magento\Framework\App\Request\DataPersistorInterface; /** * Class DataProvider @@ -36,7 +36,7 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider * @var \Magento\SalesRule\Model\Rule\Metadata\ValueProvider */ protected $metadataValueProvider; - + /** * @var DataPersistorInterface */ @@ -51,9 +51,9 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider * @param CollectionFactory $collectionFactory * @param \Magento\Framework\Registry $registry * @param Metadata\ValueProvider $metadataValueProvider - * @param DataPersistorInterface $dataPersistor * @param array $meta * @param array $data + * @param DataPersistorInterface $dataPersistor */ public function __construct( $name, @@ -62,9 +62,9 @@ public function __construct( CollectionFactory $collectionFactory, \Magento\Framework\Registry $registry, \Magento\SalesRule\Model\Rule\Metadata\ValueProvider $metadataValueProvider, - DataPersistorInterface $dataPersistor = null, array $meta = [], - array $data = [] + array $data = [], + DataPersistorInterface $dataPersistor = null ) { $this->collection = $collectionFactory->create(); $this->coreRegistry = $registry; @@ -88,7 +88,7 @@ protected function getMetadataValues() } /** - * {@inheritdoc} + * @inheritdoc */ public function getData() { From a764a5c2fc552b299629879fe09e717c852de5e1 Mon Sep 17 00:00:00 2001 From: Navarr Barnier <navarr@mediotype.com> Date: Tue, 12 Feb 2019 13:42:53 -0500 Subject: [PATCH 217/238] Fix tests breaking when upgrading from 2.2 to 2.3 --- .../Sales/Test/Mftf/Section/AdminOrderFormActionSection.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormActionSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormActionSection.xml index 2f6149dfa1cb7..027962282b2c3 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormActionSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormActionSection.xml @@ -12,5 +12,8 @@ <element name="SubmitOrder" type="button" selector="#submit_order_top_button" timeout="30"/> <element name="Cancel" type="button" selector="#reset_order_top_button" timeout="30"/> <element name="CreateNewCustomer" type="button" selector="#order-customer-selector .actions button.primary" timeout="30"/> + <element name="submitOrder" type="button" selector="#submit_order_top_button" timeout="30"/> + <element name="cancel" type="button" selector="#reset_order_top_button" timeout="30"/> + <element name="createNewCustomer" type="button" selector="#order-customer-selector .actions button.primary" timeout="30"/> </section> -</sections> \ No newline at end of file +</sections> From bb591412d6d620534c0eb4eaa25198476c8371a4 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Tue, 12 Feb 2019 14:54:16 -0600 Subject: [PATCH 218/238] MQE-1441: Deliver weekly PR - Add mftf_migrated:yes tag to MTF tests - Fix many incorrect testCaseIds --- .../Test/Mftf/Test/AddToCartCrossSellTest.xml | 2 +- .../Mftf/Test/AdminCreateAndSwitchProductType.xml | 2 +- .../Mftf/Test/AdminCreateAndSwitchProductType.xml | 14 +++++++------- .../Mftf/Test/AdminCreateAndSwitchProductType.xml | 2 +- .../TestCase/Product/AddToCartCrossSellTest.xml | 2 +- .../TestCase/Product/ManageProductsStockTest.xml | 3 +++ .../Product/ProductTypeSwitchingOnCreationTest.xml | 6 +++--- .../CreateAttributeSetEntityTest.xml | 1 + ...teProductAttributeEntityFromProductPageTest.xml | 4 ++++ .../DeleteSystemProductAttributeTest.xml | 1 + .../DeleteChildConfigurableProductTest.xml | 1 + 11 files changed, 24 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml index 8897373e15d6a..53bb12fda4833 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml @@ -15,7 +15,7 @@ <title value="Admin should be able to add cross-sell to products."/> <description value="Create products, add products to cross sells, and check that they appear in the Shopping Cart page."/> <severity value="MAJOR"/> - <testCaseId value="MC-113"/> + <testCaseId value="MC-9143"/> <group value="Catalog"/> </annotations> <before> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index e76ca74280e8f..4deca73504677 100755 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -67,7 +67,7 @@ <title value="Admin should be able to switch a new product from virtual to simple"/> <description value="After selecting a virtual product when adding Admin should be switch to simple implicitly"/> <severity value="CRITICAL"/> - <testCaseId value="MC-10925"/> + <testCaseId value="MC-10928"/> <group value="catalog"/> <group value="mtf_migrated"/> </annotations> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index 708b2ca2130eb..6feea577c905d 100755 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -15,7 +15,7 @@ <title value="Admin should be able to switch a new product from configurable to simple"/> <description value="After selecting a configurable product when adding Admin should be switch to simple implicitly"/> <severity value="CRITICAL"/> - <testCaseId value="MC-10925"/> + <testCaseId value="MC-10926"/> <group value="catalog"/> <group value="mtf_migrated"/> </annotations> @@ -34,7 +34,7 @@ <title value="Admin should be able to switch a new product from configurable to virtual"/> <description value="After selecting a configurable product when adding Admin should be switch to virtual implicitly"/> <severity value="CRITICAL"/> - <testCaseId value="MC-10925"/> + <testCaseId value="MC-10927"/> <group value="catalog"/> <group value="mtf_migrated"/> </annotations> @@ -43,14 +43,14 @@ </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Virtual Product" stepKey="seeProductTypeInGrid"/> </test> - <test name="AdminCreateSimpleProductSwitchToConfigurableTest" extends="AdminCreateSimpleProductSwitchToVirtualTest"> + <test name="AdminCreateVirtualProductSwitchToConfigurableTest" extends="AdminCreateSimpleProductSwitchToVirtualTest"> <annotations> <features value="Catalog"/> <stories value="Product Type Switching"/> - <title value="Admin should be able to switch a new product from simple to configurable"/> - <description value="After selecting a simple product when adding Admin should be switch to configurable implicitly"/> + <title value="Admin should be able to switch a new product from virtual to configurable"/> + <description value="After selecting a virtual product when adding Admin should be switch to configurable implicitly"/> <severity value="CRITICAL"/> - <testCaseId value="MC-10925"/> + <testCaseId value="MC-10930"/> <group value="catalog"/> <group value="mtf_migrated"/> </annotations> @@ -64,7 +64,7 @@ <deleteData stepKey="deleteAttribute" createDataKey="createConfigProductAttribute"/> </after> <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> - <argument name="productType" value="simple"/> + <argument name="productType" value="virtual"/> </actionGroup> <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> <argument name="product" value="_defaultProduct"/> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index 4d880d2f88ca1..55740af4d834f 100755 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -15,7 +15,7 @@ <title value="Admin should be able to switch a new product from downloadable to simple"/> <description value="After selecting a downloadable product when adding Admin should be switch to simple implicitly"/> <severity value="CRITICAL"/> - <testCaseId value="MC-10925"/> + <testCaseId value="MC-10929"/> <group value="catalog"/> <group value="mtf_migrated"/> </annotations> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddToCartCrossSellTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddToCartCrossSellTest.xml index 874fc3f670362..b1f093162fa4b 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddToCartCrossSellTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddToCartCrossSellTest.xml @@ -8,7 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Catalog\Test\TestCase\Product\AddToCartCrossSellTest" summary="Promote Products as Cross-Sells" ticketId="MAGETWO-12390"> <variation name="AddToCartCrossSellTestVariation1" method="test"> - <data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test</data> + <data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test, mftf_migrated:yes</data> <data name="products" xsi:type="string">simple1::catalogProductSimple::product_with_category,simple2::catalogProductSimple::product_with_category,config1::configurableProduct::two_options_with_fixed_price</data> <data name="promotedProducts" xsi:type="string">simple1:simple2,config1;config1:simple2</data> <data name="navigateProductsOrder" xsi:type="string">simple1,config1,simple2</data> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ManageProductsStockTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ManageProductsStockTest.xml index 33b578672d48b..d005c05a9cba2 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ManageProductsStockTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ManageProductsStockTest.xml @@ -15,6 +15,7 @@ <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> </variation> <variation name="ManageProductsStockTestVariation2" summary="Checking that Out of Stock products are not visible in category" ticketId="MAGETWO-13645"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="product/dataset" xsi:type="string">product_with_category</data> <data name="product/data/stock_data/manage_stock" xsi:type="string">Yes</data> <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">5</data> @@ -33,6 +34,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> </variation> <variation name="ManageProductsStockTestVariation3" summary="Add In Stock product to cart" ticketId="MAGETWO-13645"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="product/dataset" xsi:type="string">product_with_category</data> <data name="product/data/stock_data/manage_stock" xsi:type="string">Yes</data> <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">5</data> @@ -51,6 +53,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> </variation> <variation name="ManageProductsStockTestVariation4" summary="Enable displaying of out of stock products in category" ticketId="MAGETWO-13645"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="product/dataset" xsi:type="string">product_with_category</data> <data name="product/data/stock_data/manage_stock" xsi:type="string">Yes</data> <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">5</data> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml index 2871d402441d6..a563d369f95cc 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml @@ -8,10 +8,9 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Catalog\Test\TestCase\Product\ProductTypeSwitchingOnCreationTest" summary="Product Type Switching on Creation" ticketId="MAGETWO-29398"> <variation name="ProductTypeSwitchingOnCreationTestVariation1"> - <data name="tag" xsi:type="string">stable:no</data> + <data name="tag" xsi:type="string">stable:no, mftf_migrated:yes</data> <data name="createProduct" xsi:type="string">simple</data> <data name="product" xsi:type="string">configurableProduct::default</data> - <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid" /> @@ -36,6 +35,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> </variation> <variation name="ProductTypeSwitchingOnCreationTestVariation4"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="issue" xsi:type="string">MSI-1624</data> <data name="createProduct" xsi:type="string">configurable</data> <data name="product" xsi:type="string">catalogProductVirtual::required_fields</data> @@ -50,7 +50,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> </variation> <variation name="ProductTypeSwitchingOnCreationTestVariation6"> - <data name="tag" xsi:type="string">stable:no</data> + <data name="tag" xsi:type="string">stable:no, mftf_migrated:yes</data> <data name="createProduct" xsi:type="string">virtual</data> <data name="product" xsi:type="string">configurableProduct::not_virtual_for_type_switching</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateAttributeSetEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateAttributeSetEntityTest.xml index 86bacd925ba05..13e05b1d122cb 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateAttributeSetEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateAttributeSetEntityTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Catalog\Test\TestCase\ProductAttribute\CreateAttributeSetEntityTest" summary="Create Attribute Set (Attribute Set)" ticketId="MAGETWO-25104"> <variation name="CreateAttributeSetEntityTestVariation1"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="attributeSet/data/attribute_set_name" xsi:type="string">AttributeSet%isolation%</data> <data name="attributeSet/data/skeleton_set/dataset" xsi:type="string">default</data> <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeSetSuccessSaveMessage" /> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml index 73fbf556d099c..e15eab57cca01 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Catalog\Test\TestCase\ProductAttribute\CreateProductAttributeEntityFromProductPageTest" summary="Create Product Attribute from Product Page" ticketId="MAGETWO-30528"> <variation name="CreateProductAttributeEntityFromProductPageTestVariation1_Searchable_Global_Visible_Comparable_HtmlAllowed_UsedForSorting"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="attribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> <data name="attribute/data/frontend_input" xsi:type="string">Text Field</data> <data name="attribute/data/is_required" xsi:type="string">No</data> @@ -33,6 +34,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUsedInSortOnFrontend" /> </variation> <variation name="CreateProductAttributeEntityFromProductPageTestVariation2_Filterable"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="attribute/data/frontend_label" xsi:type="string">Dropdown_Admin_%isolation%</data> <data name="attribute/data/frontend_input" xsi:type="string">Dropdown</data> <data name="attribute/data/options/dataset" xsi:type="string">two_options</data> @@ -50,6 +52,7 @@ <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertProductAttributeIsConfigurable" /> </variation> <variation name="CreateProductAttributeEntityFromProductPageTestVariation3_Required"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="attribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> <data name="attribute/data/frontend_input" xsi:type="string">Text Field</data> <data name="attribute/data/is_required" xsi:type="string">Yes</data> @@ -59,6 +62,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsRequired" /> </variation> <variation name="CreateProductAttributeEntityFromProductPageTestVariation4_Unique"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="attribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> <data name="attribute/data/frontend_input" xsi:type="string">Text Field</data> <data name="attribute/data/is_required" xsi:type="string">No</data> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteSystemProductAttributeTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteSystemProductAttributeTest.xml index 7763b0fb534f4..a9a85d2472073 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteSystemProductAttributeTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteSystemProductAttributeTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Catalog\Test\TestCase\ProductAttribute\DeleteSystemProductAttributeTest" summary="Delete System Product Attribute" ticketId="MAGETWO-24771"> <variation name="DeleteSystemProductAttributeTestVariation1"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="productAttribute/data/attribute_code" xsi:type="string">news_from_date</data> <data name="productAttribute/data/is_user_defined" xsi:type="string">Yes</data> <constraint name="Magento\Catalog\Test\Constraint\AssertAbsenceDeleteAttributeButton" /> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DeleteChildConfigurableProductTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DeleteChildConfigurableProductTest.xml index 435d5aad4635d..64f9141fba962 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DeleteChildConfigurableProductTest.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DeleteChildConfigurableProductTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\ConfigurableProduct\Test\TestCase\DeleteChildConfigurableProductTest" summary="Configurable Product is not available on frontend after child products are deleted" ticketId="MAGETWO-70346"> <variation name="DeleteChildConfigurableProductTestVariation1" summary="Verify that variation's SKU based on parent SKU"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> <data name="product/data/configurable_attributes_data/dataset" xsi:type="string">two_new_options_with_empty_sku</data> <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> From 13d01162f90da79f9298d6b80b58d2f0956f8838 Mon Sep 17 00:00:00 2001 From: Mila Lesechko <l.lesechko@gmail.com> Date: Tue, 12 Feb 2019 21:25:16 -0600 Subject: [PATCH 219/238] Convert ShareWishlistEntityTest to MFTF --- .../StorefrontCustomerWishlistActionGroup.xml | 21 +++++++- .../Wishlist/Test/Mftf/Data/WishlistData.xml | 2 + .../StorefrontCustomerWishlistSharePage.xml | 15 ++++++ ...orefrontCustomerWishlistProductSection.xml | 2 + ...StorefrontCustomerWishlistShareSection.xml | 17 +++++++ .../StorefrontShareWishlistEntityTest.xml | 51 +++++++++++++++++++ 6 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Wishlist/Test/Mftf/Page/StorefrontCustomerWishlistSharePage.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistShareSection.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml index 7bb42e12d1451..8c7a0302aba20 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml @@ -28,7 +28,9 @@ <waitForElementVisible selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" stepKey="WaitForWishList"/> <click selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" stepKey="addProductToWishlistClickAddToWishlist" /> <waitForElement selector="{{StorefrontCustomerWishlistSection.successMsg}}" time="30" stepKey="addProductToWishlistWaitForSuccessMessage"/> - <see selector="{{StorefrontCustomerWishlistSection.successMsg}}" userInput="{{productVar.name}} has been added to your Wish List." stepKey="addProductToWishlistSeeProductNameAddedToWishlist"/> + <see selector="{{StorefrontCustomerWishlistSection.successMsg}}" + userInput="{{productVar.name}} has been added to your Wish List. Click here to continue shopping." + stepKey="addProductToWishlistSeeProductNameAddedToWishlist"/> <seeCurrentUrlMatches regex="~/wishlist_id/\d+/$~" stepKey="seeCurrentUrlMatches"/> </actionGroup> @@ -88,4 +90,21 @@ <click selector="{{StorefrontCustomerWishlistProductSection.ProductUpdateWishList}}" stepKey="submitUpdateWishlist"/> <see selector="{{StorefrontCustomerWishlistProductSection.ProductSuccessUpdateMessage}}" userInput="{{product.name}} has been updated in your Wish List." stepKey="successMessage"/> </actionGroup> + + <!-- Share wishlist --> + <actionGroup name="StorefrontCustomerShareWishlistActionGroup"> + <click selector="{{StorefrontCustomerWishlistProductSection.ProductShareWishList}}" + stepKey="clickMyWishListButton"/> + <amOnPage url="{{StorefrontCustomerWishlistSharePage.url}}" stepKey="amOnShareWishlist"/> + <fillField userInput="{{Wishlist.shareInfo_emails}}" + selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistEmail}}" + stepKey="fillEmailsForShare"/> + <fillField userInput="{{Wishlist.shareInfo_message}}" + selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistTextMessage}}" + stepKey="fillShareMessage"/> + <click selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistButton}}" + stepKey="sendWishlist"/> + <see selector="{{StorefrontCustomerWishlistProductSection.ProductSuccessShareMessage}}" + userInput="Your wish list has been shared." stepKey="successMessage"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Data/WishlistData.xml b/app/code/Magento/Wishlist/Test/Mftf/Data/WishlistData.xml index 811871bf685ae..c6a9704698b05 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Data/WishlistData.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Data/WishlistData.xml @@ -12,5 +12,7 @@ <var key="product" entityType="product" entityKey="id"/> <var key="customer_email" entityType="customer" entityKey="email"/> <var key="customer_password" entityType="customer" entityKey="password"/> + <data key="shareInfo_emails" entityType="customer" >JohnDoe123456789@example.com,JohnDoe987654321@example.com,JohnDoe123456abc@example.com</data> + <data key="shareInfo_message" entityType="customer">Sharing message.</data> </entity> </entities> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Page/StorefrontCustomerWishlistSharePage.xml b/app/code/Magento/Wishlist/Test/Mftf/Page/StorefrontCustomerWishlistSharePage.xml new file mode 100644 index 0000000000000..976031ae5d17f --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/Page/StorefrontCustomerWishlistSharePage.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="StorefrontCustomerWishlistSharePage" url="/wishlist/index/share/wishlist_id/{{var1}}/" + area="storefront" module="Magento_Wishlist"> + <section name="StorefrontCustomerWishlistShareSection"/> + </page> +</pages> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml index 7a767e42e82bf..4b94ce300f115 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml @@ -19,6 +19,8 @@ <element name="ProductQuantity" type="input" selector="//a[contains(text(), '{{productName}}')]/ancestor::div[@class='product-item-info']//input[@class='input-text qty']" parameterized="true"/> <element name="ProductUpdateWishList" type="button" selector=".column.main .actions-toolbar .action.update" timeout="30"/> <element name="ProductAddAllToCart" type="button" selector=".column.main .actions-toolbar .action.tocart" timeout="30"/> + <element name="ProductShareWishList" type="button" selector=".column.main .actions-toolbar .action.share" timeout="30" /> <element name="ProductSuccessUpdateMessage" type="text" selector="//div[1]/div[2]/div/div/div"/> + <element name="ProductSuccessShareMessage" type="text" selector="//main/div[1]/div[2]/div/div/div"/> </section> </sections> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistShareSection.xml b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistShareSection.xml new file mode 100644 index 0000000000000..97048ed35b798 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistShareSection.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="StorefrontCustomerWishlistShareSection"> + <element name="ProductShareWishlistEmail" type="input" selector="#email_address"/> + <element name="ProductShareWishlistTextMessage" type="input" selector="#message"/> + <element name="ProductShareWishlistButton" type="button" + selector="//*[@class='action submit primary']" timeout="30"/> + </section> +</sections> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml new file mode 100644 index 0000000000000..17d27e910b6f7 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontShareWishlistEntityTest"> + <annotations> + <features value="Wishlist"/> + <stories value="Customer should be able to share a persistent wishlist"/> + <title value="Customer should be able to share a persistent wishlist"/> + <description value="Customer should be able to share a persistent wishlist"/> + <severity value="AVERAGE"/> + <group value="wishlist"/> + <testCaseId value="MAGETWO-23394"/> + </annotations> + <before> + <createData entity="SimpleSubCategory" stepKey="category"/> + <createData entity="SimpleProduct" stepKey="product"> + <requiredEntity createDataKey="category"/> + </createData> + <createData entity="Simple_US_Customer" stepKey="customer"/> + </before> + <after> + <deleteData createDataKey="category" stepKey="deleteCategory"/> + <deleteData createDataKey="product" stepKey="deleteProduct"/> + <deleteData createDataKey="customer" stepKey="deleteCustomer"/> + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + </after> + + <!-- Sign in as customer --> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount"> + <argument name="Customer" value="$$customer$$"/> + </actionGroup> + + <actionGroup ref="OpenProductFromCategoryPageActionGroup" stepKey="openProductFromCategory"> + <argument name="category" value="$$category$$"/> + <argument name="product" value="$$product$$"/> + </actionGroup> + + <actionGroup ref="StorefrontCustomerAddProductToWishlistActionGroup" stepKey="addToWishlistProduct"> + <argument name="productVar" value="$$product$$"/> + </actionGroup> + + <actionGroup ref="StorefrontCustomerShareWishlistActionGroup" stepKey="shareWishlist"/> + </test> +</tests> From 9e3eca54b74386ba7841afff82ea393149328264 Mon Sep 17 00:00:00 2001 From: Mila Lesechko <l.lesechko@gmail.com> Date: Tue, 12 Feb 2019 23:10:36 -0600 Subject: [PATCH 220/238] Convert ShareWishlistEntityTest to MFTF --- .../StorefrontCustomerWishlistActionGroup.xml | 20 ++++++------------- .../StorefrontCustomerWishlistSharePage.xml | 3 +-- ...orefrontCustomerWishlistProductSection.xml | 4 ++-- ...StorefrontCustomerWishlistShareSection.xml | 3 +-- .../StorefrontShareWishlistEntityTest.xml | 7 +++++-- .../Test/TestCase/ShareWishlistEntityTest.xml | 1 + 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml index 8c7a0302aba20..b0fd23f8b359c 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml @@ -28,9 +28,7 @@ <waitForElementVisible selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" stepKey="WaitForWishList"/> <click selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" stepKey="addProductToWishlistClickAddToWishlist" /> <waitForElement selector="{{StorefrontCustomerWishlistSection.successMsg}}" time="30" stepKey="addProductToWishlistWaitForSuccessMessage"/> - <see selector="{{StorefrontCustomerWishlistSection.successMsg}}" - userInput="{{productVar.name}} has been added to your Wish List. Click here to continue shopping." - stepKey="addProductToWishlistSeeProductNameAddedToWishlist"/> + <see selector="{{StorefrontCustomerWishlistSection.successMsg}}" userInput="{{productVar.name}} has been added to your Wish List. Click here to continue shopping." stepKey="addProductToWishlistSeeProductNameAddedToWishlist"/> <seeCurrentUrlMatches regex="~/wishlist_id/\d+/$~" stepKey="seeCurrentUrlMatches"/> </actionGroup> @@ -93,18 +91,12 @@ <!-- Share wishlist --> <actionGroup name="StorefrontCustomerShareWishlistActionGroup"> - <click selector="{{StorefrontCustomerWishlistProductSection.ProductShareWishList}}" + <click selector="{{StorefrontCustomerWishlistProductSection.productShareWishList}}" stepKey="clickMyWishListButton"/> <amOnPage url="{{StorefrontCustomerWishlistSharePage.url}}" stepKey="amOnShareWishlist"/> - <fillField userInput="{{Wishlist.shareInfo_emails}}" - selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistEmail}}" - stepKey="fillEmailsForShare"/> - <fillField userInput="{{Wishlist.shareInfo_message}}" - selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistTextMessage}}" - stepKey="fillShareMessage"/> - <click selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistButton}}" - stepKey="sendWishlist"/> - <see selector="{{StorefrontCustomerWishlistProductSection.ProductSuccessShareMessage}}" - userInput="Your wish list has been shared." stepKey="successMessage"/> + <fillField userInput="{{Wishlist.shareInfo_emails}}" selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistEmail}}" stepKey="fillEmailsForShare"/> + <fillField userInput="{{Wishlist.shareInfo_message}}" selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistTextMessage}}" stepKey="fillShareMessage"/> + <click selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistButton}}" stepKey="sendWishlist"/> + <see selector="{{StorefrontCustomerWishlistProductSection.productSuccessShareMessage}}" userInput="Your wish list has been shared." stepKey="successMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Page/StorefrontCustomerWishlistSharePage.xml b/app/code/Magento/Wishlist/Test/Mftf/Page/StorefrontCustomerWishlistSharePage.xml index 976031ae5d17f..6d6151648c5ee 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Page/StorefrontCustomerWishlistSharePage.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Page/StorefrontCustomerWishlistSharePage.xml @@ -8,8 +8,7 @@ <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> - <page name="StorefrontCustomerWishlistSharePage" url="/wishlist/index/share/wishlist_id/{{var1}}/" - area="storefront" module="Magento_Wishlist"> + <page name="StorefrontCustomerWishlistSharePage" url="/wishlist/index/share/wishlist_id/{{wishlistId}}/" area="storefront" module="Magento_Wishlist"> <section name="StorefrontCustomerWishlistShareSection"/> </page> </pages> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml index 4b94ce300f115..ef619726b76ab 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml @@ -19,8 +19,8 @@ <element name="ProductQuantity" type="input" selector="//a[contains(text(), '{{productName}}')]/ancestor::div[@class='product-item-info']//input[@class='input-text qty']" parameterized="true"/> <element name="ProductUpdateWishList" type="button" selector=".column.main .actions-toolbar .action.update" timeout="30"/> <element name="ProductAddAllToCart" type="button" selector=".column.main .actions-toolbar .action.tocart" timeout="30"/> - <element name="ProductShareWishList" type="button" selector=".column.main .actions-toolbar .action.share" timeout="30" /> + <element name="productShareWishList" type="button" selector="button.action.share" timeout="30" /> <element name="ProductSuccessUpdateMessage" type="text" selector="//div[1]/div[2]/div/div/div"/> - <element name="ProductSuccessShareMessage" type="text" selector="//main/div[1]/div[2]/div/div/div"/> + <element name="productSuccessShareMessage" type="text" selector="div.message-success"/> </section> </sections> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistShareSection.xml b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistShareSection.xml index 97048ed35b798..76b99ba56a327 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistShareSection.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistShareSection.xml @@ -11,7 +11,6 @@ <section name="StorefrontCustomerWishlistShareSection"> <element name="ProductShareWishlistEmail" type="input" selector="#email_address"/> <element name="ProductShareWishlistTextMessage" type="input" selector="#message"/> - <element name="ProductShareWishlistButton" type="button" - selector="//*[@class='action submit primary']" timeout="30"/> + <element name="ProductShareWishlistButton" type="button" selector=".action.submit.primary" timeout="30"/> </section> </sections> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml index 17d27e910b6f7..9b63abd4bd511 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml @@ -16,7 +16,9 @@ <description value="Customer should be able to share a persistent wishlist"/> <severity value="AVERAGE"/> <group value="wishlist"/> - <testCaseId value="MAGETWO-23394"/> + <testCaseId value="MC-13976"/> + <group value="wishlist"/> + <group value="mtf_migrated"/> </annotations> <before> <createData entity="SimpleSubCategory" stepKey="category"/> @@ -29,7 +31,6 @@ <deleteData createDataKey="category" stepKey="deleteCategory"/> <deleteData createDataKey="product" stepKey="deleteProduct"/> <deleteData createDataKey="customer" stepKey="deleteCustomer"/> - <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> </after> <!-- Sign in as customer --> @@ -47,5 +48,7 @@ </actionGroup> <actionGroup ref="StorefrontCustomerShareWishlistActionGroup" stepKey="shareWishlist"/> + + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/> </test> </tests> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.xml index ec01f57202b26..cbf5ba392844e 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Wishlist\Test\TestCase\ShareWishlistEntityTest" summary="Share wishlist" ticketId="MAGETWO-23394"> <variation name="ShareWishlistEntityTestVariation1"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="sharingInfo/emails" xsi:type="string">JohnDoe123456789@example.com,JohnDoe987654321@example.com,JohnDoe123456abc@example.com</data> <data name="sharingInfo/message" xsi:type="string">Sharing message.</data> <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistShareMessage" /> From 385aa601f8977816d6c27cad9eb16398d649e10e Mon Sep 17 00:00:00 2001 From: Satya Prakash <satyaprakash@cedcoss.com> Date: Wed, 13 Feb 2019 13:09:55 +0530 Subject: [PATCH 221/238] removed space --- app/code/Magento/Ui/view/base/web/js/form/element/date.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index 088dd61ec6a53..4e532c9d48cc6 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -124,7 +124,7 @@ define([ dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat; shiftedValue = moment(value, dateFormat); } - + if (!shiftedValue.isValid()) { shiftedValue = moment(value, this.inputDateFormat); } From 0863c4bb0b8f3a4bcf6223692d18c9495e988b96 Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Wed, 13 Feb 2019 11:43:01 +0200 Subject: [PATCH 222/238] Fix static tests. --- app/code/Magento/Wishlist/Controller/Index/Cart.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Wishlist/Controller/Index/Cart.php b/app/code/Magento/Wishlist/Controller/Index/Cart.php index 5bc4882d5e246..da37609d688e7 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Cart.php +++ b/app/code/Magento/Wishlist/Controller/Index/Cart.php @@ -3,16 +3,19 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Wishlist\Controller\Index; -use Magento\Framework\App\Action; use Magento\Catalog\Model\Product\Exception as ProductException; +use Magento\Framework\App\Action; use Magento\Framework\Controller\ResultFactory; /** + * Add wishlist item to shopping cart and remove from wishlist controller. + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Cart extends \Magento\Wishlist\Controller\AbstractIndex +class Cart extends \Magento\Wishlist\Controller\AbstractIndex implements Action\HttpPostActionInterface { /** * @var \Magento\Wishlist\Controller\WishlistProviderInterface From a3d809c4f9920888acadfc7f16849849041f4fb2 Mon Sep 17 00:00:00 2001 From: Ievgenii Gryshkun <i.gryshkun@gmail.com> Date: Wed, 13 Feb 2019 15:01:04 +0200 Subject: [PATCH 223/238] The requested qty is not available" should be received instead of Internal server error --- .../Model/Resolver/AddSimpleProductsToCart.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php index f4335b262c854..481fb8a2839e8 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php @@ -79,7 +79,12 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value $currentUserId = $context->getUserId(); $cart = $this->getCartForUser->execute((string)$cartHash, $currentUserId); - $this->addProductsToCart->execute($cart, $cartItems); + try { + $this->addProductsToCart->execute($cart, $cartItems); + } catch (\Exception $exception) { + throw new GraphQlInputException(__($exception->getMessage())); + } + $cartData = $this->extractDataFromCart->execute($cart); return [ From 867c13473d94b6a7a1c2b6b4554071ebc3c1ccf9 Mon Sep 17 00:00:00 2001 From: Valerii Naida <vnayda@adobe.com> Date: Wed, 13 Feb 2019 14:18:35 -0600 Subject: [PATCH 224/238] GraphQL-46: [Query] My Account > Stored Payment Methods -- Update composer lock --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 48aef8b603d4a..677ac1766b1e3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f22c780b1ed27ba951c0562e20078a70", + "content-hash": "8094d9cb504698da62351046929d4b8f", "packages": [ { "name": "braintree/braintree_php", From 3c8d954668053b0dfca62bb76ad18451145d5fe2 Mon Sep 17 00:00:00 2001 From: Valerii Naida <vnayda@adobe.com> Date: Wed, 13 Feb 2019 14:46:20 -0600 Subject: [PATCH 225/238] GraphQL-145: [Cart Operations] Add virtual product to Cart --- .../Resolver/AddVirtualProductsToCart.php | 90 ------------------- .../Magento/QuoteGraphQl/etc/schema.graphqls | 2 +- 2 files changed, 1 insertion(+), 91 deletions(-) delete mode 100644 app/code/Magento/QuoteGraphQl/Model/Resolver/AddVirtualProductsToCart.php diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/AddVirtualProductsToCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/AddVirtualProductsToCart.php deleted file mode 100644 index 54221e3d79bd5..0000000000000 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/AddVirtualProductsToCart.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\QuoteGraphQl\Model\Resolver; - -use Magento\Framework\GraphQl\Config\Element\Field; -use Magento\Framework\GraphQl\Exception\GraphQlInputException; -use Magento\Framework\GraphQl\Query\ResolverInterface; -use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; -use Magento\Framework\Stdlib\ArrayManager; -use Magento\QuoteGraphQl\Model\Cart\AddProductsToCart; -use Magento\QuoteGraphQl\Model\Cart\ExtractDataFromCart; -use Magento\QuoteGraphQl\Model\Cart\GetCartForUser; - -/** - * Add virtual products to cart GraphQl resolver - * - * {@inheritdoc} - */ -class AddVirtualProductsToCart implements ResolverInterface -{ - /** - * @var ArrayManager - */ - private $arrayManager; - - /** - * @var GetCartForUser - */ - private $getCartForUser; - - /** - * @var AddProductsToCart - */ - private $addProductsToCart; - - /** - * @var ExtractDataFromCart - */ - private $extractDataFromCart; - - /** - * @param ArrayManager $arrayManager - * @param GetCartForUser $getCartForUser - * @param AddProductsToCart $addProductsToCart - * @param ExtractDataFromCart $extractDataFromCart - */ - public function __construct( - ArrayManager $arrayManager, - GetCartForUser $getCartForUser, - AddProductsToCart $addProductsToCart, - ExtractDataFromCart $extractDataFromCart - ) { - $this->arrayManager = $arrayManager; - $this->getCartForUser = $getCartForUser; - $this->addProductsToCart = $addProductsToCart; - $this->extractDataFromCart = $extractDataFromCart; - } - - /** - * @inheritdoc - */ - public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) - { - $cartHash = $this->arrayManager->get('input/cart_id', $args); - $cartItems = $this->arrayManager->get('input/cartItems', $args); - - if (!isset($cartHash)) { - throw new GraphQlInputException(__('Missing key "cart_id" in cart data')); - } - - if (!isset($cartItems) || !is_array($cartItems) || empty($cartItems)) { - throw new GraphQlInputException(__('Missing key "cartItems" in cart data')); - } - - $currentUserId = $context->getUserId(); - $cart = $this->getCartForUser->execute((string)$cartHash, $currentUserId); - - $this->addProductsToCart->execute($cart, $cartItems); - $cartData = $this->extractDataFromCart->execute($cart); - - return [ - 'cart' => $cartData, - ]; - } -} diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index d2cfccf1683c3..0a86315382aee 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -15,7 +15,7 @@ type Mutation { setBillingAddressOnCart(input: SetBillingAddressOnCartInput): SetBillingAddressOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetBillingAddressOnCart") setShippingMethodsOnCart(input: SetShippingMethodsOnCartInput): SetShippingMethodsOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetShippingMethodsOnCart") addSimpleProductsToCart(input: AddSimpleProductsToCartInput): AddSimpleProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart") - addVirtualProductsToCart(input: AddVirtualProductsToCartInput): AddVirtualProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddVirtualProductsToCart") + addVirtualProductsToCart(input: AddVirtualProductsToCartInput): AddVirtualProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart") } input SetShippingAddressesOnCartInput { From 7884a96b854c546330df6518d692efbc85261726 Mon Sep 17 00:00:00 2001 From: Alex Kolesnyk <kolesnyk@adobe.com> Date: Wed, 13 Feb 2019 16:08:14 -0600 Subject: [PATCH 226/238] MQE-1441: Deliver weekly PR --- .../Test/Mftf/Test/AdminCreateAndSwitchProductType.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index 6feea577c905d..d5f309b075727 100755 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -53,6 +53,9 @@ <testCaseId value="MC-10930"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MQE-1445" /> + </skip> </annotations> <before> <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> From a2d9381001e00fc2a2106b0fb95b8bc6622da979 Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko <serg.ivashchenko@gmail.com> Date: Thu, 14 Feb 2019 11:31:08 +0000 Subject: [PATCH 227/238] magento/magento2#21095: Reverted added API annotation --- lib/internal/Magento/Framework/Code/NameBuilder.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Code/NameBuilder.php b/lib/internal/Magento/Framework/Code/NameBuilder.php index 53f1b946f4cc1..1884f460b5eeb 100644 --- a/lib/internal/Magento/Framework/Code/NameBuilder.php +++ b/lib/internal/Magento/Framework/Code/NameBuilder.php @@ -7,8 +7,6 @@ /** * Name builder. - * - * @api */ class NameBuilder { From 320848dd317d304f51ca725e03a88fbc2e6d87fd Mon Sep 17 00:00:00 2001 From: Ievgenii Gryshkun <i.gryshkun@gmail.com> Date: Thu, 14 Feb 2019 16:53:14 +0200 Subject: [PATCH 228/238] The requested qty is not available" should be received instead of Internal server error --- .../addConfigurableProductsToCartTest.php | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/addConfigurableProductsToCartTest.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/addConfigurableProductsToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/addConfigurableProductsToCartTest.php new file mode 100644 index 0000000000000..6629820766a1c --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/addConfigurableProductsToCartTest.php @@ -0,0 +1,112 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\GraphQl\Quote; + +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\TestCase\GraphQlAbstract; +use Magento\Quote\Model\Quote; +use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface; +use Magento\Quote\Model\ResourceModel\Quote as QuoteResource; + +class addConfigurableProductsToCartTest extends GraphQlAbstract +{ + /** + * @var QuoteResource + */ + private $quoteResource; + /** + * @var Quote + */ + private $quote; + + /** + * @var QuoteIdToMaskedQuoteIdInterface + */ + private $quoteIdToMaskedId; + + /** + * @inheritdoc + */ + protected function setUp() + { + $objectManager = Bootstrap::getObjectManager(); + $this->quoteResource = $objectManager->create(QuoteResource::class); + $this->quote = $objectManager->create(Quote::class); + $this->quoteIdToMaskedId = $objectManager->create(QuoteIdToMaskedQuoteIdInterface::class); + } + + /** + * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php + * @magentoApiDataFixture Magento/Catalog/_files/multiple_mixed_products_2.php + */ + public function testAddConfigurableProductsToCart() + { + $variantSku = 'simple_41'; + $qty = 200; + $expectedMessage = 'GraphQL response contains errors: The requested qty is not available +'; + $this->quoteResource->load( + $this->quote, + 'test_order_with_simple_product_without_address', + 'reserved_order_id' + ); + $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId()); + $query = $this->prepareAddConfigurableProductsToCartQuery($maskedQuoteId, $variantSku, $qty); + + try { + $this->graphQlQuery($query); + } catch (\Exception $exception) { + $this->assertEquals( + $expectedMessage, + $exception->getMessage() + ); + } + } + + /** + * @param string $maskedQuoteId + * @param string $variantSku + * @param int $qty + * + * @return string + */ + public function prepareAddConfigurableProductsToCartQuery(string $maskedQuoteId, string $variantSku, int $qty) + { + return <<<QUERY +mutation { + + addConfigurableProductsToCart( + input: { + cart_id: "$maskedQuoteId", + cartItems: [ + { + variant_sku: "$variantSku" + data: { + qty: $qty + sku: "$variantSku" + } + } + ] + } + ) { + cart { + items { + id + qty + product { + name + sku + } + } + } + } +} + +QUERY; + } +} From 047f9ccff9e7383ee826c632c4b028e912a60492 Mon Sep 17 00:00:00 2001 From: Mila Lesechko <26227105+MilaLesechko@users.noreply.github.com> Date: Thu, 14 Feb 2019 10:24:33 -0600 Subject: [PATCH 229/238] Update StorefrontCustomerWishlistActionGroup.xml amOnPage removed --- .../ActionGroup/StorefrontCustomerWishlistActionGroup.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml index b0fd23f8b359c..a1c5b9eae5c49 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml @@ -91,9 +91,7 @@ <!-- Share wishlist --> <actionGroup name="StorefrontCustomerShareWishlistActionGroup"> - <click selector="{{StorefrontCustomerWishlistProductSection.productShareWishList}}" - stepKey="clickMyWishListButton"/> - <amOnPage url="{{StorefrontCustomerWishlistSharePage.url}}" stepKey="amOnShareWishlist"/> + <click selector="{{StorefrontCustomerWishlistProductSection.productShareWishList}}" stepKey="clickMyWishListButton"/> <fillField userInput="{{Wishlist.shareInfo_emails}}" selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistEmail}}" stepKey="fillEmailsForShare"/> <fillField userInput="{{Wishlist.shareInfo_message}}" selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistTextMessage}}" stepKey="fillShareMessage"/> <click selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistButton}}" stepKey="sendWishlist"/> From 105dbe04b2283e989fb59b99e5706a78ca789ace Mon Sep 17 00:00:00 2001 From: Mila Lesechko <26227105+MilaLesechko@users.noreply.github.com> Date: Thu, 14 Feb 2019 10:25:23 -0600 Subject: [PATCH 230/238] Update StorefrontShareWishlistEntityTest.xml --- .../Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml index 9b63abd4bd511..87c5ed950949f 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml @@ -11,7 +11,7 @@ <test name="StorefrontShareWishlistEntityTest"> <annotations> <features value="Wishlist"/> - <stories value="Customer should be able to share a persistent wishlist"/> + <stories value="Customer wishlist"/> <title value="Customer should be able to share a persistent wishlist"/> <description value="Customer should be able to share a persistent wishlist"/> <severity value="AVERAGE"/> From b18c97931434a3cac158482f5faba64a4f2b8095 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov <sidolov@magento.com> Date: Thu, 14 Feb 2019 11:49:51 -0600 Subject: [PATCH 231/238] magento-engcom/magento2ce#2571: Fixed static test failures --- lib/internal/Magento/Framework/Code/NameBuilder.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/internal/Magento/Framework/Code/NameBuilder.php b/lib/internal/Magento/Framework/Code/NameBuilder.php index 1884f460b5eeb..53f1b946f4cc1 100644 --- a/lib/internal/Magento/Framework/Code/NameBuilder.php +++ b/lib/internal/Magento/Framework/Code/NameBuilder.php @@ -7,6 +7,8 @@ /** * Name builder. + * + * @api */ class NameBuilder { From a9d51e0c1f164131566193ddb34acf37fc559678 Mon Sep 17 00:00:00 2001 From: Alex Kolesnyk <kolesnyk@adobe.com> Date: Thu, 14 Feb 2019 13:16:55 -0600 Subject: [PATCH 232/238] MQE-1441: Deliver weekly PR --- app/code/Magento/Cms/Test/Mftf/Page/CmsPageEditPage.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Cms/Test/Mftf/Page/CmsPageEditPage.xml b/app/code/Magento/Cms/Test/Mftf/Page/CmsPageEditPage.xml index 885310d9399ae..d38d0b023f44b 100644 --- a/app/code/Magento/Cms/Test/Mftf/Page/CmsPageEditPage.xml +++ b/app/code/Magento/Cms/Test/Mftf/Page/CmsPageEditPage.xml @@ -7,7 +7,7 @@ --> <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> - <page name="CmsPageEditPage" area="admin" url="admin/cms_page/edit/page_id/{{var}}" parameterized="true"> + <page name="CmsPageEditPage" area="admin" url="admin/cms_page/edit/page_id/{{var}}" module="Magento_Cms" parameterized="true"> <section name="CmsNewPagePageActionsSection"/> <section name="CmsNewPagePageBasicFieldsSection"/> <section name="CmsNewPagePageContentSection"/> From a9cf09d559053e70912845f04f5a0bfc0cc1734c Mon Sep 17 00:00:00 2001 From: Alex Kolesnyk <kolesnyk@adobe.com> Date: Thu, 14 Feb 2019 14:42:38 -0600 Subject: [PATCH 233/238] MQE-1441: Deliver weekly PR --- .../Test/Mftf/ActionGroup/ConfigSalesTaxClassActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigSalesTaxClassActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigSalesTaxClassActionGroup.xml index 1a7b641070ad8..593bf95392633 100644 --- a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigSalesTaxClassActionGroup.xml +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigSalesTaxClassActionGroup.xml @@ -33,7 +33,7 @@ <argument name="userInput" type="string"/> </arguments> <conditionalClick selector="{{AdminConfigureTaxSection.taxCalculationSettings}}" dependentSelector="{{AdminConfigureTaxSection.taxCalculationAlgorithm}}" visible="false" stepKey="openTaxCalcSettingsSection"/> - <scrollTo selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" stepKey="goToCheckbox"/> + <scrollTo selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" x="0" y="-80" stepKey="goToCheckbox"/> <uncheckOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" stepKey="enableApplyTaxOnSetting"/> <selectOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOn}}" userInput="{{userInput}}" stepKey="setApplyTaxOn"/> <scrollTo selector="{{SalesConfigSection.TaxClassesTab}}" stepKey="scrollToTop"/> From 2fa4f1f207b182e9c64913007b52d64333dadc82 Mon Sep 17 00:00:00 2001 From: Valerii Naida <vnayda@adobe.com> Date: Thu, 14 Feb 2019 14:50:28 -0600 Subject: [PATCH 234/238] GraphQL-285: [Shipping methods] Get list of available shipping methods for current cart --- .../Cart/Address/AddressDataProvider.php | 136 ------------------ .../Address/BillingAddressDataProvider.php | 72 ---------- .../Address/ShippingAddressesDataProvider.php | 76 ---------- ...Address.php => ExtractDataFromAddress.php} | 32 +++-- .../Model/Resolver/BillingAddress.php | 24 ++-- .../Resolver/CartAddressShippingMethods.php | 46 ------ .../Model/Resolver/CartAddresses.php | 48 ------- .../Model/Resolver/ShippingAddresses.php | 26 ++-- .../AvailableShippingMethods.php} | 28 ++-- .../Magento/QuoteGraphQl/etc/schema.graphqls | 11 +- .../Quote/GetAvailableShippingMethodsTest.php | 123 ++++++++++++++++ 11 files changed, 201 insertions(+), 421 deletions(-) delete mode 100644 app/code/Magento/QuoteGraphQl/Model/Cart/Address/AddressDataProvider.php delete mode 100644 app/code/Magento/QuoteGraphQl/Model/Cart/Address/BillingAddressDataProvider.php delete mode 100644 app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingAddressesDataProvider.php rename app/code/Magento/QuoteGraphQl/Model/Cart/{Address/Mapper/Address.php => ExtractDataFromAddress.php} (64%) delete mode 100644 app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressShippingMethods.php delete mode 100644 app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddresses.php rename app/code/Magento/QuoteGraphQl/Model/{Cart/Address/ShippingMethodsDataProvider.php => Resolver/ShippingAdress/AvailableShippingMethods.php} (72%) create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetAvailableShippingMethodsTest.php diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/AddressDataProvider.php b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/AddressDataProvider.php deleted file mode 100644 index 73183ea903fc6..0000000000000 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/AddressDataProvider.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\QuoteGraphQl\Model\Cart\Address; - -use Magento\Framework\Api\ExtensibleDataObjectConverter; -use Magento\Quote\Api\Data\AddressInterface; -use Magento\Quote\Api\Data\CartInterface; -use Magento\Quote\Api\Data\ShippingMethodInterface; -use Magento\Quote\Model\Quote\Address as QuoteAddress; -use Magento\Quote\Model\Cart\ShippingMethodConverter; - -/** - * Class AddressDataProvider - * - * Collect and return information about cart shipping and billing addresses - */ -class AddressDataProvider -{ - /** - * @var ExtensibleDataObjectConverter - */ - private $dataObjectConverter; - - /** - * @var ShippingMethodConverter - */ - private $shippingMethodConverter; - - /** - * AddressDataProvider constructor. - * - * @param ExtensibleDataObjectConverter $dataObjectConverter - * @param ShippingMethodConverter $shippingMethodConverter - */ - public function __construct( - ExtensibleDataObjectConverter $dataObjectConverter, - ShippingMethodConverter $shippingMethodConverter - ) { - $this->dataObjectConverter = $dataObjectConverter; - $this->shippingMethodConverter = $shippingMethodConverter; - } - - /** - * Collect and return information about shipping and billing addresses - * - * @param CartInterface $cart - * @return array - */ - public function getCartAddresses(CartInterface $cart): array - { - $addressData = []; - $shippingAddress = $cart->getShippingAddress(); - $billingAddress = $cart->getBillingAddress(); - - if ($shippingAddress) { - $shippingData = $this->dataObjectConverter->toFlatArray($shippingAddress, [], AddressInterface::class); - $shippingData['address_type'] = 'SHIPPING'; - $addressData[] = array_merge($shippingData, $this->extractAddressData($shippingAddress)); - } - - if ($billingAddress) { - $billingData = $this->dataObjectConverter->toFlatArray($billingAddress, [], AddressInterface::class); - $billingData['address_type'] = 'BILLING'; - $addressData[] = array_merge($billingData, $this->extractAddressData($billingAddress)); - } - - return $addressData; - } - - /** - * Extract the necessary address fields from address model - * - * @param QuoteAddress $address - * @return array - */ - private function extractAddressData(QuoteAddress $address): array - { - $addressData = [ - 'model' => $address, - 'country' => [ - 'code' => $address->getCountryId(), - 'label' => $address->getCountry() - ], - 'region' => [ - 'code' => $address->getRegionCode(), - 'label' => $address->getRegion() - ], - 'street' => $address->getStreet(), - 'selected_shipping_method' => [ - 'code' => $address->getShippingMethod(), - 'label' => $address->getShippingDescription(), - 'free_shipping' => $address->getFreeShipping(), - 'amount' => $address->getShippingAmount(), - 'base_amount' => $address->getBaseShippingAmount(), - 'amount_incl_tax' => $address->getShippingInclTax(), - 'base_amount_incl_tax' => $address->getBaseShippingInclTax(), - ], - 'items_weight' => $address->getWeight(), - 'customer_notes' => $address->getCustomerNotes(), - 'quote_id' => $address->getQuoteId(), - ]; - - return $addressData; - } - - private function extractAvailableShippingRateData(CartInterface $cart, QuoteAddress $address): array - { - $output = []; - - // Allow shipping rates by setting country id for new addresses - if (!$address->getCountryId() && $address->getCountryCode()) { - $address->setCountryId($address->getCountryCode()); - } - - $address->setCollectShippingRates(true); - $address->collectShippingRates(); - - $shippingRates = $address->getGroupedAllShippingRates(); - foreach ($shippingRates as $carrierRates) { - foreach ($carrierRates as $rate) { - $output[] = $this->dataObjectConverter->toFlatArray( - $this->shippingMethodConverter->modelToDataObject($rate, $cart->getQuoteCurrencyCode()), - [], - ShippingMethodInterface::class - ); - } - } - - return $output; - } -} diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/BillingAddressDataProvider.php b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/BillingAddressDataProvider.php deleted file mode 100644 index bcd781025a6d6..0000000000000 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/BillingAddressDataProvider.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\QuoteGraphQl\Model\Cart\Address; - -use Magento\Framework\Api\ExtensibleDataObjectConverter; -use Magento\Quote\Api\CartRepositoryInterface; -use Magento\Quote\Api\Data\AddressInterface; -use Magento\Quote\Api\Data\CartInterface; -use Magento\QuoteGraphQl\Model\Cart\Address\Mapper\Address; - -/** - * Collect and return information about a billing address - */ -class BillingAddressDataProvider -{ - /** - * @var CartRepositoryInterface - */ - private $cartRepository; - - /** - * @var Address - */ - private $addressMapper; - - /** - * @var ExtensibleDataObjectConverter - */ - private $dataObjectConverter; - - /** - * AddressDataProvider constructor. - * - * @param CartRepositoryInterface $cartRepository - * @param Address $addressMapper - * @param ExtensibleDataObjectConverter $dataObjectConverter - */ - public function __construct( - CartRepositoryInterface $cartRepository, - Address $addressMapper, - ExtensibleDataObjectConverter $dataObjectConverter - ) { - $this->cartRepository = $cartRepository; - $this->addressMapper = $addressMapper; - $this->dataObjectConverter = $dataObjectConverter; - } - - /** - * Collect and return information about a billing addresses - * - * @param CartInterface $cart - * @return null|array - */ - public function getCartAddresses(CartInterface $cart): ?array - { - $cart = $this->cartRepository->get($cart->getId()); - $billingAddress = $cart->getBillingAddress(); - - if (!$billingAddress) { - return null; - } - $billingData = $this->dataObjectConverter->toFlatArray($billingAddress, [], AddressInterface::class); - $addressData = array_merge($billingData, $this->addressMapper->toNestedArray($billingAddress)); - - return $addressData; - } -} diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingAddressesDataProvider.php b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingAddressesDataProvider.php deleted file mode 100644 index eb9d760809594..0000000000000 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingAddressesDataProvider.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\QuoteGraphQl\Model\Cart\Address; - -use Magento\Framework\Api\ExtensibleDataObjectConverter; -use Magento\Quote\Api\CartRepositoryInterface; -use Magento\Quote\Api\Data\AddressInterface; -use Magento\Quote\Api\Data\CartInterface; -use Magento\QuoteGraphQl\Model\Cart\Address\Mapper\Address; - -/** - * Class AddressDataProvider - * - * Collect and return information about cart shipping and billing addresses - */ -class ShippingAddressesDataProvider -{ - /** - * @var ExtensibleDataObjectConverter - */ - private $dataObjectConverter; - - /** - * @var CartRepositoryInterface - */ - private $cartRepository; - - /** - * @var Address - */ - private $addressMapper; - - /** - * AddressDataProvider constructor. - * - * @param ExtensibleDataObjectConverter $dataObjectConverter - * @param CartRepositoryInterface $cartRepository - * @param Address $addressMapper - */ - public function __construct( - ExtensibleDataObjectConverter $dataObjectConverter, - CartRepositoryInterface $cartRepository, - Address $addressMapper - ) { - $this->dataObjectConverter = $dataObjectConverter; - $this->cartRepository = $cartRepository; - $this->addressMapper = $addressMapper; - } - - /** - * Collect and return information about shipping addresses - * - * @param CartInterface $cart - * @return array - */ - public function getCartAddresses(CartInterface $cart): array - { - $cart = $this->cartRepository->get($cart->getId()); - $addressData = []; - $shippingAddresses = $cart->getAllShippingAddresses(); - - if ($shippingAddresses) { - foreach ($shippingAddresses as $shippingAddress) { - $shippingData = $this->dataObjectConverter->toFlatArray($shippingAddress, [], AddressInterface::class); - $addressData[] = array_merge($shippingData, $this->addressMapper->toNestedArray($shippingAddress)); - } - } - - return $addressData; - } -} diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/Mapper/Address.php b/app/code/Magento/QuoteGraphQl/Model/Cart/ExtractDataFromAddress.php similarity index 64% rename from app/code/Magento/QuoteGraphQl/Model/Cart/Address/Mapper/Address.php rename to app/code/Magento/QuoteGraphQl/Model/Cart/ExtractDataFromAddress.php index 64ac407e2692a..b0e5070315d87 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/Mapper/Address.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/ExtractDataFromAddress.php @@ -5,26 +5,42 @@ */ declare(strict_types=1); -namespace Magento\QuoteGraphQl\Model\Cart\Address\Mapper; +namespace Magento\QuoteGraphQl\Model\Cart; +use Magento\Framework\Api\ExtensibleDataObjectConverter; +use Magento\Quote\Api\Data\AddressInterface; use Magento\Quote\Model\Quote\Address as QuoteAddress; /** - * Class Address - * * Extract the necessary address fields from an Address model */ -class Address +class ExtractDataFromAddress { /** - * Converts Address model data to nested array + * @var ExtensibleDataObjectConverter + */ + private $dataObjectConverter; + + /** + * @param ExtensibleDataObjectConverter $dataObjectConverter + */ + public function __construct(ExtensibleDataObjectConverter $dataObjectConverter) + { + $this->dataObjectConverter = $dataObjectConverter; + } + + /** + * Converts Address model to flat array * * @param QuoteAddress $address * @return array */ - public function toNestedArray(QuoteAddress $address): array + public function execute(QuoteAddress $address): array { - $addressData = [ + $addressData = $this->dataObjectConverter->toFlatArray($address, [], AddressInterface::class); + $addressData['model'] = $address; + + $addressData = array_merge($addressData, [ 'country' => [ 'code' => $address->getCountryId(), 'label' => $address->getCountry() @@ -41,7 +57,7 @@ public function toNestedArray(QuoteAddress $address): array ], 'items_weight' => $address->getWeight(), 'customer_notes' => $address->getCustomerNotes() - ]; + ]); if (!$address->hasItems()) { return $addressData; diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/BillingAddress.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/BillingAddress.php index 7de5a4ac05c24..a03533ecefffa 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/BillingAddress.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/BillingAddress.php @@ -11,7 +11,7 @@ use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; -use Magento\QuoteGraphQl\Model\Cart\Address\BillingAddressDataProvider; +use Magento\QuoteGraphQl\Model\Cart\ExtractDataFromAddress; /** * @inheritdoc @@ -19,17 +19,16 @@ class BillingAddress implements ResolverInterface { /** - * @var BillingAddressDataProvider + * @var ExtractDataFromAddress */ - private $addressDataProvider; + private $extractDataFromAddress; /** - * @param BillingAddressDataProvider $addressDataProvider + * @param ExtractDataFromAddress $extractDataFromAddress */ - public function __construct( - BillingAddressDataProvider $addressDataProvider - ) { - $this->addressDataProvider = $addressDataProvider; + public function __construct(ExtractDataFromAddress $extractDataFromAddress) + { + $this->extractDataFromAddress = $extractDataFromAddress; } /** @@ -40,9 +39,14 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value if (!isset($value['model'])) { throw new LocalizedException(__('"model" value should be specified')); } - $cart = $value['model']; - return $this->addressDataProvider->getCartAddresses($cart); + $billingAddress = $cart->getBillingAddress(); + if (null === $billingAddress) { + return null; + } + + $addressData = $this->extractDataFromAddress->execute($billingAddress); + return $addressData; } } diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressShippingMethods.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressShippingMethods.php deleted file mode 100644 index e3c250237ad15..0000000000000 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressShippingMethods.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\QuoteGraphQl\Model\Resolver; - -use Magento\Framework\Exception\LocalizedException; -use Magento\Framework\GraphQl\Config\Element\Field; -use Magento\Framework\GraphQl\Query\ResolverInterface; -use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; -use Magento\QuoteGraphQl\Model\Cart\Address\ShippingMethodsDataProvider; - -/** - * @inheritdoc - */ -class CartAddressShippingMethods implements ResolverInterface -{ - /** - * @var ShippingMethodsDataProvider - */ - private $shippingMethodsDataProvider; - - /** - * @param ShippingMethodsDataProvider $shippingMethodsDataProvider - */ - public function __construct( - ShippingMethodsDataProvider $shippingMethodsDataProvider - ) { - $this->shippingMethodsDataProvider = $shippingMethodsDataProvider; - } - - /** - * @inheritdoc - */ - public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) - { - if (!isset($value['model'])) { - throw new LocalizedException(__('"model" values should be specified')); - } - - return $this->shippingMethodsDataProvider->getAvailableShippingMethods($value['model']); - } -} diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddresses.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddresses.php deleted file mode 100644 index 69544672bf12e..0000000000000 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddresses.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\QuoteGraphQl\Model\Resolver; - -use Magento\Framework\Exception\LocalizedException; -use Magento\Framework\GraphQl\Config\Element\Field; -use Magento\Framework\GraphQl\Query\ResolverInterface; -use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; -use Magento\QuoteGraphQl\Model\Cart\Address\AddressDataProvider; - -/** - * @inheritdoc - */ -class CartAddresses implements ResolverInterface -{ - /** - * @var AddressDataProvider - */ - private $addressDataProvider; - - /** - * @param AddressDataProvider $addressDataProvider - */ - public function __construct( - AddressDataProvider $addressDataProvider - ) { - $this->addressDataProvider = $addressDataProvider; - } - - /** - * @inheritdoc - */ - public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) - { - if (!isset($value['model'])) { - throw new LocalizedException(__('"model" value should be specified')); - } - - $cart = $value['model']; - - return $this->addressDataProvider->getCartAddresses($cart); - } -} diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddresses.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddresses.php index caa0eee22d702..3a55ef9ae25a8 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddresses.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddresses.php @@ -11,7 +11,7 @@ use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; -use Magento\QuoteGraphQl\Model\Cart\Address\ShippingAddressesDataProvider; +use Magento\QuoteGraphQl\Model\Cart\ExtractDataFromAddress; /** * @inheritdoc @@ -19,17 +19,16 @@ class ShippingAddresses implements ResolverInterface { /** - * @var ShippingAddressesDataProvider + * @var ExtractDataFromAddress */ - private $addressDataProvider; + private $extractDataFromAddress; /** - * @param ShippingAddressesDataProvider $addressDataProvider + * @param ExtractDataFromAddress $extractDataFromAddress */ - public function __construct( - ShippingAddressesDataProvider $addressDataProvider - ) { - $this->addressDataProvider = $addressDataProvider; + public function __construct(ExtractDataFromAddress $extractDataFromAddress) + { + $this->extractDataFromAddress = $extractDataFromAddress; } /** @@ -40,9 +39,16 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value if (!isset($value['model'])) { throw new LocalizedException(__('"model" value should be specified')); } - $cart = $value['model']; - return $this->addressDataProvider->getCartAddresses($cart); + $addressesData = []; + $shippingAddresses = $cart->getAllShippingAddresses(); + + if (count($shippingAddresses)) { + foreach ($shippingAddresses as $shippingAddress) { + $addressesData[] = $this->extractDataFromAddress->execute($shippingAddress); + } + } + return $addressesData; } } diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingMethodsDataProvider.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAdress/AvailableShippingMethods.php similarity index 72% rename from app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingMethodsDataProvider.php rename to app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAdress/AvailableShippingMethods.php index fd9540194b421..7804b8defe378 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingMethodsDataProvider.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAdress/AvailableShippingMethods.php @@ -5,14 +5,20 @@ */ declare(strict_types=1); -namespace Magento\QuoteGraphQl\Model\Cart\Address; +namespace Magento\QuoteGraphQl\Model\Resolver\ShippingAdress; -use Magento\Quote\Api\Data\ShippingMethodInterface; use Magento\Framework\Api\ExtensibleDataObjectConverter; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\GraphQl\Config\Element\Field; +use Magento\Framework\GraphQl\Query\ResolverInterface; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\Quote\Api\Data\ShippingMethodInterface; use Magento\Quote\Model\Cart\ShippingMethodConverter; -use Magento\Quote\Model\Quote\Address as QuoteAddress; -class ShippingMethodsDataProvider +/** + * @inheritdoc + */ +class AvailableShippingMethods implements ResolverInterface { /** * @var ExtensibleDataObjectConverter @@ -25,8 +31,6 @@ class ShippingMethodsDataProvider private $shippingMethodConverter; /** - * AddressDataProvider constructor. - * * @param ExtensibleDataObjectConverter $dataObjectConverter * @param ShippingMethodConverter $shippingMethodConverter */ @@ -38,9 +42,15 @@ public function __construct( $this->shippingMethodConverter = $shippingMethodConverter; } - public function getAvailableShippingMethods(QuoteAddress $address): array + /** + * @inheritdoc + */ + public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) { - $methods = []; + if (!isset($value['model'])) { + throw new LocalizedException(__('"model" values should be specified')); + } + $address = $value['model']; // Allow shipping rates by setting country id for new addresses if (!$address->getCountryId() && $address->getCountryCode()) { @@ -51,6 +61,7 @@ public function getAvailableShippingMethods(QuoteAddress $address): array $address->collectShippingRates(); $cart = $address->getQuote(); + $methods = []; $shippingRates = $address->getGroupedAllShippingRates(); foreach ($shippingRates as $carrierRates) { foreach ($carrierRates as $rate) { @@ -61,7 +72,6 @@ public function getAvailableShippingMethods(QuoteAddress $address): array ); } } - return $methods; } } diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index c34adb08a17ab..c52bd52fb3227 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -2,7 +2,7 @@ # See COPYING.txt for license details. type Query { - Cart(cart_id: String!): Cart @resolver (class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\Cart") @doc(description:"Returns information about shopping cart") + cart(cart_id: String!): Cart @resolver (class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\Cart") @doc(description:"Returns information about shopping cart") } type Mutation { @@ -117,8 +117,8 @@ type CartAddress { country: CartAddressCountry telephone: String address_type: AdressTypeEnum - selected_shipping_method: CheckoutShippingMethod - available_shipping_methods: [CheckoutAvailableShippingMethod] @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartAddressShippingMethods") + selected_shipping_method: ShippingMethod + available_shipping_methods: [AvailableShippingMethod] @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ShippingAdress\\AvailableShippingMethods") items_weight: Float customer_notes: String cart_items: [CartItemQuantity] @@ -139,7 +139,7 @@ type CartAddressCountry { label: String } -type CheckoutShippingMethod { +type ShippingMethod { code: String label: String free_shipping: Boolean! @@ -150,7 +150,7 @@ type CheckoutShippingMethod { base_amount_incl_tax: Float! } -type CheckoutAvailableShippingMethod { +type AvailableShippingMethod { carrier_code: String! carrier_title: String! method_code: String! @@ -160,7 +160,6 @@ type CheckoutAvailableShippingMethod { base_amount: Float! price_excl_tax: Float! price_incl_tax: Float! - available: Boolean! } enum AdressTypeEnum { diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetAvailableShippingMethodsTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetAvailableShippingMethodsTest.php new file mode 100644 index 0000000000000..7b72afa157018 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetAvailableShippingMethodsTest.php @@ -0,0 +1,123 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\GraphQl\Quote; + +use Magento\Integration\Api\CustomerTokenServiceInterface; +use Magento\Quote\Model\Quote; +use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface; +use Magento\Quote\Model\ResourceModel\Quote as QuoteResource; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\TestCase\GraphQlAbstract; + +/** + * Test for get available shipping methods + */ +class GetAvailableShippingMethodsTest extends GraphQlAbstract +{ + /** + * @var CustomerTokenServiceInterface + */ + private $customerTokenService; + + /** + * @var QuoteResource + */ + private $quoteResource; + + /** + * @var Quote + */ + private $quote; + + /** + * @var QuoteIdToMaskedQuoteIdInterface + */ + private $quoteIdToMaskedId; + + protected function setUp() + { + $objectManager = Bootstrap::getObjectManager(); + $this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class); + $this->quoteResource = $objectManager->create(QuoteResource::class); + $this->quote = $objectManager->create(Quote::class); + $this->quoteIdToMaskedId = $objectManager->create(QuoteIdToMaskedQuoteIdInterface::class); + } + + /** + * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php + */ + public function testGetAvailableShippingMethods() + { + $this->quoteResource->load( + $this->quote, + 'test_order_1', + 'reserved_order_id' + ); + $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId()); + + $query = <<<QUERY +query { + cart (cart_id: "{$maskedQuoteId}") { + cart_id + shipping_addresses { + available_shipping_methods { + amount + base_amount + carrier_code + carrier_title + error_message + method_code + method_title + price_excl_tax + price_incl_tax + } + } + } +} +QUERY; + $response = $this->graphQlQuery( + $query, + [], + '', + $this->getCustomerAuthHeaders('customer@example.com', 'password') + ); + self::assertArrayHasKey('cart', $response); + self::assertEquals($maskedQuoteId, $response['cart']['cart_id']); + self::assertArrayHasKey('shipping_addresses', $response['cart']); + self::assertCount(1, $response['cart']['shipping_addresses']); + self::assertArrayHasKey('available_shipping_methods', $response['cart']['shipping_addresses'][0]); + self::assertCount(1, $response['cart']['shipping_addresses'][0]['available_shipping_methods']); + + $expectedAddressData = [ + 'amount' => 10, + 'base_amount' => 10, + 'carrier_code' => 'flatrate', + 'carrier_title' => 'Flat Rate', + 'error_message' => '', + 'method_code' => 'flatrate', + 'method_title' => 'Fixed', + 'price_incl_tax' => 10, + 'price_excl_tax' => 10, + ]; + self::assertEquals( + $expectedAddressData, + $response['cart']['shipping_addresses'][0]['available_shipping_methods'][0] + ); + } + + /** + * @param string $email + * @param string $password + * @return array + */ + private function getCustomerAuthHeaders(string $email, string $password): array + { + $customerToken = $this->customerTokenService->createCustomerAccessToken($email, $password); + return ['Authorization' => 'Bearer ' . $customerToken]; + } +} From 506b9d27fabc4c218791d746d68f2b6de419e00b Mon Sep 17 00:00:00 2001 From: Patrick McLain <pat@pmclain.com> Date: Thu, 14 Feb 2019 16:32:54 -0500 Subject: [PATCH 235/238] Remove `available` property from available shipping method test --- .../Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php index f4aaabc0876be..5bf5f3e03707d 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php @@ -91,7 +91,6 @@ public function testSetNewGuestShippingAddressOnCart() telephone available_shipping_methods { amount - available base_amount carrier_code carrier_title @@ -369,7 +368,6 @@ public function testSetNewRegisteredCustomerShippingAddressOnCart() telephone available_shipping_methods { amount - available base_amount carrier_code carrier_title @@ -440,7 +438,6 @@ public function testSetSavedRegisteredCustomerShippingAddressOnCart() telephone available_shipping_methods { amount - available base_amount carrier_code carrier_title @@ -517,7 +514,6 @@ private function assertAvailableShippingRates(array $shippingAddressResponse): v $assertionMap = [ ['response_field' => 'amount', 'expected_value' => 5], - ['response_field' => 'available', 'expected_value' => true], ['response_field' => 'base_amount', 'expected_value' => 5], ['response_field' => 'carrier_code', 'expected_value' => 'flatrate'], ['response_field' => 'carrier_title', 'expected_value' => 'Flat Rate'], From 3cc39cd07da6fa9b510133810ff4fd93af7e0a19 Mon Sep 17 00:00:00 2001 From: Valerii Naida <vnayda@adobe.com> Date: Thu, 14 Feb 2019 16:58:42 -0600 Subject: [PATCH 236/238] GraphQL-350: "The requested qty is not available" should be received instead of Internal server error --- .../Model/Cart/AddSimpleProductToCart.php | 8 +- .../Resolver/AddSimpleProductsToCart.php | 7 +- .../Quote/AddSimpleProductToCartTest.php | 86 ++++++++++++++ .../addConfigurableProductsToCartTest.php | 112 ------------------ 4 files changed, 94 insertions(+), 119 deletions(-) create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php delete mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/addConfigurableProductsToCartTest.php diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php index 2303d2aa14f03..6c65e42c292fc 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php @@ -75,7 +75,13 @@ public function execute(Quote $cart, array $cartItemData): void throw new GraphQlNoSuchEntityException(__('Could not find a product with SKU "%sku"', ['sku' => $sku])); } - $result = $cart->addProduct($product, $this->createBuyRequest($qty, $customizableOptions)); + try { + $result = $cart->addProduct($product, $this->createBuyRequest($qty, $customizableOptions)); + } catch (\Exception $e) { + throw new GraphQlInputException( + __('Shopping cart error with SKU \'%sku\': %message', ['sku' => $sku, 'message' => $e->getMessage()]) + ); + } if (is_string($result)) { throw new GraphQlInputException(__($result)); diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php index 481fb8a2839e8..f4335b262c854 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php @@ -79,12 +79,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value $currentUserId = $context->getUserId(); $cart = $this->getCartForUser->execute((string)$cartHash, $currentUserId); - try { - $this->addProductsToCart->execute($cart, $cartItems); - } catch (\Exception $exception) { - throw new GraphQlInputException(__($exception->getMessage())); - } - + $this->addProductsToCart->execute($cart, $cartItems); $cartData = $this->extractDataFromCart->execute($cart); return [ diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php new file mode 100644 index 0000000000000..4cbc614e1b8dc --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php @@ -0,0 +1,86 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\GraphQl\Quote; + +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\TestCase\GraphQlAbstract; +use Magento\Quote\Model\Quote; +use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface; +use Magento\Quote\Model\ResourceModel\Quote as QuoteResource; + +class AddSimpleProductToCartTest extends GraphQlAbstract +{ + /** + * @var QuoteResource + */ + private $quoteResource; + + /** + * @var Quote + */ + private $quote; + + /** + * @var QuoteIdToMaskedQuoteIdInterface + */ + private $quoteIdToMaskedId; + + /** + * @inheritdoc + */ + protected function setUp() + { + $objectManager = Bootstrap::getObjectManager(); + $this->quoteResource = $objectManager->get(QuoteResource::class); + $this->quote = $objectManager->create(Quote::class); + $this->quoteIdToMaskedId = $objectManager->get(QuoteIdToMaskedQuoteIdInterface::class); + } + + /** + * @magentoApiDataFixture Magento/Catalog/_files/products.php + * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php + * @expectedException \Exception + * @expectedExceptionMessage The requested qty is not available + */ + public function testAddProductIfQuantityIsNotAvailable() + { + $sku = 'simple'; + $qty = 200; + + $this->quoteResource->load( + $this->quote, + 'test_order_1', + 'reserved_order_id' + ); + $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId()); + + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_id: "{$maskedQuoteId}", + cartItems: [ + { + data: { + qty: $qty + sku: "$sku" + } + } + ] + } + ) { + cart { + cart_id + } + } +} +QUERY; + + $this->graphQlQuery($query); + } +} diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/addConfigurableProductsToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/addConfigurableProductsToCartTest.php deleted file mode 100644 index 6629820766a1c..0000000000000 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/addConfigurableProductsToCartTest.php +++ /dev/null @@ -1,112 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\GraphQl\Quote; - -use Magento\TestFramework\Helper\Bootstrap; -use Magento\TestFramework\TestCase\GraphQlAbstract; -use Magento\Quote\Model\Quote; -use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface; -use Magento\Quote\Model\ResourceModel\Quote as QuoteResource; - -class addConfigurableProductsToCartTest extends GraphQlAbstract -{ - /** - * @var QuoteResource - */ - private $quoteResource; - /** - * @var Quote - */ - private $quote; - - /** - * @var QuoteIdToMaskedQuoteIdInterface - */ - private $quoteIdToMaskedId; - - /** - * @inheritdoc - */ - protected function setUp() - { - $objectManager = Bootstrap::getObjectManager(); - $this->quoteResource = $objectManager->create(QuoteResource::class); - $this->quote = $objectManager->create(Quote::class); - $this->quoteIdToMaskedId = $objectManager->create(QuoteIdToMaskedQuoteIdInterface::class); - } - - /** - * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php - * @magentoApiDataFixture Magento/Catalog/_files/multiple_mixed_products_2.php - */ - public function testAddConfigurableProductsToCart() - { - $variantSku = 'simple_41'; - $qty = 200; - $expectedMessage = 'GraphQL response contains errors: The requested qty is not available -'; - $this->quoteResource->load( - $this->quote, - 'test_order_with_simple_product_without_address', - 'reserved_order_id' - ); - $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId()); - $query = $this->prepareAddConfigurableProductsToCartQuery($maskedQuoteId, $variantSku, $qty); - - try { - $this->graphQlQuery($query); - } catch (\Exception $exception) { - $this->assertEquals( - $expectedMessage, - $exception->getMessage() - ); - } - } - - /** - * @param string $maskedQuoteId - * @param string $variantSku - * @param int $qty - * - * @return string - */ - public function prepareAddConfigurableProductsToCartQuery(string $maskedQuoteId, string $variantSku, int $qty) - { - return <<<QUERY -mutation { - - addConfigurableProductsToCart( - input: { - cart_id: "$maskedQuoteId", - cartItems: [ - { - variant_sku: "$variantSku" - data: { - qty: $qty - sku: "$variantSku" - } - } - ] - } - ) { - cart { - items { - id - qty - product { - name - sku - } - } - } - } -} - -QUERY; - } -} From 5ef26f7dcf5322c65886c435645e550c1606981f Mon Sep 17 00:00:00 2001 From: Patrick McLain <pat@pmclain.com> Date: Thu, 14 Feb 2019 18:02:01 -0500 Subject: [PATCH 237/238] Adjust test for change in cart query casing --- .../testsuite/Magento/GraphQl/Quote/GetCartTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetCartTest.php index f0038351bcdcf..44cd2ef526bd5 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetCartTest.php @@ -68,9 +68,9 @@ public function testGetOwnCartForRegisteredCustomer() $response = $this->sendRequestWithToken($query); - self::assertArrayHasKey('Cart', $response); - self::assertNotEmpty($response['Cart']['items']); - self::assertNotEmpty($response['Cart']['shipping_addresses']); + self::assertArrayHasKey('cart', $response); + self::assertNotEmpty($response['cart']['items']); + self::assertNotEmpty($response['cart']['shipping_addresses']); } /** @@ -110,7 +110,7 @@ public function testGetCartForGuest() $response = $this->graphQlQuery($query); - self::assertArrayHasKey('Cart', $response); + self::assertArrayHasKey('cart', $response); } public function testGetNonExistentCart() @@ -134,7 +134,7 @@ private function prepareGetCartQuery( ) : string { return <<<QUERY { - Cart(cart_id: "$maskedQuoteId") { + cart(cart_id: "$maskedQuoteId") { applied_coupon { code } From 851df6d2bc944d952ebf0711677041bb7d4eff5f Mon Sep 17 00:00:00 2001 From: Valerii Naida <vnayda@adobe.com> Date: Thu, 14 Feb 2019 17:06:55 -0600 Subject: [PATCH 238/238] GraphQL-350: "The requested qty is not available" should be received instead of Internal server error --- .../QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php index 6c65e42c292fc..1b32866ed883c 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php @@ -79,7 +79,10 @@ public function execute(Quote $cart, array $cartItemData): void $result = $cart->addProduct($product, $this->createBuyRequest($qty, $customizableOptions)); } catch (\Exception $e) { throw new GraphQlInputException( - __('Shopping cart error with SKU \'%sku\': %message', ['sku' => $sku, 'message' => $e->getMessage()]) + __( + 'Could not add the product with SKU %sku to the shopping cart: %message', + ['sku' => $sku, 'message' => $e->getMessage()] + ) ); }