metasfresh / metasfresh-webui-frontend-legacy

metasfresh Webui Frontend
GNU General Public License v2.0
57 stars 35 forks source link

frontend patches too much in quick input field #2325

Closed metas-ts closed 5 years ago

metas-ts commented 5 years ago

Is this a bug or feature request?

Bug

This bug blocks

What is the current behavior?

Quickentry in cypress tests

There is one "wrong" empty string patch and we don't know where it's coming from:

Screenshot

![image](https://user-images.githubusercontent.com/1264789/61876909-34a21e00-aeee-11e9-9c9c-6ac4d787cbe4.png)

Screenshot-related notes:

payload of 1st "35" PATCH (OK) [{op: "replace", path: "Qty", value: "222"}]

payload of 2nd "35" PATCH payload (NOK) [{op: "replace", path: "Qty", value: ""}]

The following "complete" patch then fails because of the preceeding value: "" PATCH payload

Also note that

Which are the steps to reproduce?

What is the expected or desired behavior?

TheBestPessimist commented 5 years ago

Also related: https://github.com/metasfresh/metasfresh-webui-frontend/issues/2322

metas-ts commented 5 years ago

@siemiatj @TheBestPessimist

Also related: #2322

Right, issue #2322 adds even more information about what is aparently the same bug

siemiatj commented 5 years ago

I'm having hard time reproducing this. For me no matter if I run this against local or dev618 it always works (at least this part as the test crashes later). I always have just one request with proper value both in cypress as well as when doing this manually.

Screen Shot 2019-07-29 at 14 54 57

Furthermore, the quickinput (and actually all Integer/Amount/Quantity) widget has a min value of 0, which prevents from typing negative values. So I'm not even sure how you can get #2322 happening.

Screen Shot 2019-07-29 at 14 57 31

But let's say it's OSX that's smart enough to respect that, and Windows doesn't give a sh*t. If I disable that I'm getting an error from the backend.

Screen Shot 2019-07-29 at 15 00 29
{
  "timestamp": "2019-07-29T14:00:20.849+02:00[Europe/Berlin]",
  "status": 500,
  "error": "Internal Server Error",
  "exception": "org.adempiere.exceptions.AdempiereException",
  "message": "IllegalArgumentException: new or null rowId is not accepted: null",
  "trace": [
    "org.adempiere.exceptions.AdempiereException: IllegalArgumentException: new or null rowId is not accepted: null",
    "\tat org.adempiere.exceptions.AdempiereException.wrapIfNeeded(AdempiereException.java:89)",
    "\tat org.adempiere.ad.trx.api.impl.AbstractTrxManager.call0(AbstractTrxManager.java:863)",
    "\tat org.adempiere.ad.trx.api.impl.AbstractTrxManager.call(AbstractTrxManager.java:687)",
    "\tat org.adempiere.ad.trx.api.impl.AbstractTrxManager.call(AbstractTrxManager.java:588)",
    "\tat org.adempiere.ad.trx.api.impl.AbstractTrxManager.call(AbstractTrxManager.java:519)",
    "\tat org.adempiere.ad.trx.api.impl.AbstractTrxManager.call(AbstractTrxManager.java:497)",
    "\tat org.adempiere.ad.trx.api.impl.AbstractTrxManager.call(AbstractTrxManager.java:474)",
    "\tat de.metas.ui.web.window.controller.Execution$ExecutionBuilder.lambda$execute$0(Execution.java:194)",
    "\tat de.metas.ui.web.window.controller.Execution$ExecutionBuilder.lambda$execute$2(Execution.java:237)",
    "\tat de.metas.ui.web.window.controller.Execution$ExecutionBuilder.execute(Execution.java:260)",
    "\tat de.metas.ui.web.window.controller.Execution.callInNewExecution(Execution.java:88)",
    "\tat de.metas.ui.web.quickinput.WindowQuickInputRestController.complete(WindowQuickInputRestController.java:327)",
    "\tat sun.reflect.GeneratedMethodAccessor436.invoke(Unknown Source)",
    "\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)",
    "\tat java.lang.reflect.Method.invoke(Method.java:498)",
    "\tat org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)",
    "\tat org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)",
    "\tat org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)",
    "\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)",
    "\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)",
    "\tat org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)",
    "\tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)",
    "\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)",
    "\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)",
    "\tat org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)",
    "\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:661)",
    "\tat org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)",
    "\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:742)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)",
    "\tat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)",
    "\tat org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)",
    "\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)",
    "\tat de.metas.ui.web.config.WebConfig$1.doFilter(WebConfig.java:82)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)",
    "\tat de.metas.ui.web.config.ServletLoggingFilter.doFilter(ServletLoggingFilter.java:89)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)",
    "\tat de.metas.ui.web.config.CORSFilter.doFilter(CORSFilter.java:79)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)",
    "\tat org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:110)",
    "\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)",
    "\tat org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)",
    "\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)",
    "\tat org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105)",
    "\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)",
    "\tat org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)",
    "\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)",
    "\tat org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:167)",
    "\tat org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)",
    "\tat org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)",
    "\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)",
    "\tat org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106)",
    "\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)",
    "\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)",
    "\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)",
    "\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)",
    "\tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)",
    "\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)",
    "\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)",
    "\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)",
    "\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)",
    "\tat org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)",
    "\tat org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)",
    "\tat org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)",
    "\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)",
    "\tat org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)",
    "\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)",
    "\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)",
    "\tat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)",
    "\tat java.lang.Thread.run(Thread.java:748)",
    "Caused by: java.lang.IllegalArgumentException: new or null rowId is not accepted: null",
    "\tat de.metas.ui.web.window.datatypes.DocumentPath.createChildPath(DocumentPath.java:424)",
    "\tat de.metas.ui.web.window.model.HighVolumeReadWriteIncludedDocumentsCollection.getDocumentById(HighVolumeReadWriteIncludedDocumentsCollection.java:205)",
    "\tat de.metas.ui.web.window.model.Document.getIncludedDocument(Document.java:1519)",
    "\tat de.metas.ui.web.quickinput.QuickInput.complete(QuickInput.java:249)",
    "\tat de.metas.ui.web.quickinput.WindowQuickInputRestController.lambda$null$9(WindowQuickInputRestController.java:329)",
    "\tat de.metas.ui.web.quickinput.WindowQuickInputRestController.lambda$forQuickInputWritable$3(WindowQuickInputRestController.java:230)",
    "\tat de.metas.ui.web.window.model.DocumentCollection.forRootDocumentWritable(DocumentCollection.java:308)",
    "\tat de.metas.ui.web.quickinput.WindowQuickInputRestController.forQuickInputWritable(WindowQuickInputRestController.java:223)",
    "\tat de.metas.ui.web.quickinput.WindowQuickInputRestController.lambda$complete$10(WindowQuickInputRestController.java:328)",
    "\tat org.adempiere.ad.trx.api.impl.TrxCallableWrappers$4.call(TrxCallableWrappers.java:193)",
    "\tat org.adempiere.ad.trx.api.impl.TrxCallableWrappers$5.call(TrxCallableWrappers.java:222)",
    "\tat org.adempiere.ad.trx.api.impl.AbstractTrxManager.call0(AbstractTrxManager.java:774)",
    "\t... 88 more",
    ""
  ],
  "path": "/rest//api/window/540322/1000037/AD_Tab-540779/quickInput/74/complete"
}

To actually add anything I have to add a legitimate row first. But then again I only get the required requests and everything works fine. I'm gonna try it on Windows, maybe that's the case.

https://recordit.co/ZJcQoe8Izh

TheBestPessimist commented 5 years ago

This happens for me running on windows and using electron, not chrome. cypress version is 3.4.0

TheBestPessimist commented 5 years ago

Tried with cypress 3.4.1 and it still fails.

Request 1:

image

Request 2:

image

TheBestPessimist commented 5 years ago

Also retried with 3.3.2 and it still fails:

curl 'https://dev618.metasfresh.com/rest/api/window/540322/1000049/AD_Tab-540779/quickInput/90' -X PATCH       -H 'Referer: https://dev618.metasfresh.com/window/540322/1000049'   --data-binary '[{"op":"replace","path":"M_HU_PackingMaterial_ID","value":{"key":"3000989","caption":"Product1 30T07:51:54.024"}}]' 
curl 'https://dev618.metasfresh.com/rest/api/window/540322/1000049/AD_Tab-540779/quickInput/90' -X PATCH       -H 'Referer: https://dev618.metasfresh.com/window/540322/1000049'   --data-binary '[{"op":"replace","path":"Qty","value":"222"}]' 
curl 'https://dev618.metasfresh.com/rest/api/window/540322/1000049/AD_Tab-540779/quickInput/90' -X PATCH       -H 'Referer: https://dev618.metasfresh.com/window/540322/1000049'   --data-binary '[{"op":"replace","path":"Qty","value":""}]' 
curl 'https://dev618.metasfresh.com/rest/api/window/540322/1000049/AD_Tab-540779/quickInput/90/complete' -X POST     -H 'Accept: application/json, text/plain, */*'  -H 'Referer: https://dev618.metasfresh.com/window/540322/1000049'