Uploaded image for project: 'ZATS'
  1. ZATS
  2. ZATS-34

Additional script tag causes exception to occur

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 1.2.1
    • 1.2.0
    • Mimic
    • Security Level: Jimmy
    • None

      Run the TestNG based test to see the exception

      org.zkoss.zats.ZatsException: missing ] after element list
      at org.zkoss.zats.mimic.impl.au.AuUtility.parseAuResponseFromLayout(AuUtility.java:201)
      at org.zkoss.zats.mimic.impl.response.DownloadHandler.process(DownloadHandler.java:87)
      at org.zkoss.zats.mimic.impl.EmulatorClient.connect(EmulatorClient.java:115)
      at test.Test3Test.test(Test3Test.java:36)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      at org.testng.TestRunner.privateRun(TestRunner.java:767)
      at org.testng.TestRunner.run(TestRunner.java:617)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
      at org.testng.SuiteRunner.run(SuiteRunner.java:240)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
      at org.testng.TestNG.run(TestNG.java:1057)
      at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
      Caused by: org.mozilla.javascript.EvaluatorException: missing ] after element list
      at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:77)
      at org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:64)
      at org.mozilla.javascript.Parser.addError(Parser.java:188)
      at org.mozilla.javascript.Parser.addError(Parser.java:166)
      at org.mozilla.javascript.Parser.reportError(Parser.java:223)
      at org.mozilla.javascript.Parser.reportError(Parser.java:210)
      at org.mozilla.javascript.Parser.reportError(Parser.java:203)
      at org.mozilla.javascript.Parser.arrayLiteral(Parser.java:2928)
      at org.mozilla.javascript.Parser.primaryExpr(Parser.java:2764)
      at org.mozilla.javascript.Parser.memberExpr(Parser.java:2406)
      at org.mozilla.javascript.Parser.unaryExpr(Parser.java:2304)
      at org.mozilla.javascript.Parser.mulExpr(Parser.java:2229)
      at org.mozilla.javascript.Parser.addExpr(Parser.java:2213)
      at org.mozilla.javascript.Parser.shiftExpr(Parser.java:2194)
      at org.mozilla.javascript.Parser.relExpr(Parser.java:2169)
      at org.mozilla.javascript.Parser.eqExpr(Parser.java:2141)
      at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:2130)
      at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:2119)
      at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:2108)
      at org.mozilla.javascript.Parser.andExpr(Parser.java:2097)
      at org.mozilla.javascript.Parser.orExpr(Parser.java:2086)
      at org.mozilla.javascript.Parser.condExpr(Parser.java:2062)
      at org.mozilla.javascript.Parser.assignExpr(Parser.java:2033)
      at org.mozilla.javascript.Parser.variables(Parser.java:1870)
      at org.mozilla.javascript.Parser.statementHelper(Parser.java:986)
      at org.mozilla.javascript.Parser.statement(Parser.java:901)
      at org.mozilla.javascript.Parser.parse(Parser.java:540)
      at org.mozilla.javascript.Parser.parse(Parser.java:478)
      at org.zkoss.zats.mimic.impl.au.AuUtility.filterNonJSON(AuUtility.java:212)
      at org.zkoss.zats.mimic.impl.au.AuUtility.parseAuResponseFromLayout(AuUtility.java:174)
      ... 27 more

      Test.java
      public class Test {
          @BeforeClass
          public static void init() {
              Zats.init("./WebContent");
          }
      
          @AfterClass
          public static void end() {
              Zats.end();
          }
      
          @AfterMethod
          public void cleanup() {
              Zats.cleanup();
          }
      
          @Test
          public void test() {
              DesktopAgent desktop = Zats.newClient().connect("/test.zul");
      
              desktop.query("#btn").as(ClickAgent.class).click();
      
              List<ComponentAgent> windows = desktop.queryAll("window");
      
              Label label = null;
              for (ComponentAgent window : windows) {
                  if (window.is(MessageboxDlg.class)) {
                      MessageboxDlg dlg = window.as(MessageboxDlg.class);
                      // window -> hbox -> div, div -> label
                      label = (Label) ((HtmlBasedComponent) dlg.getFirstChild()
                                          .getChildren().get(1))
                                          .getFirstChild();
                  }
              }
      
              Assert.assertNotNull(label);
              Assert.assertEquals("test", label.getValue());
          }
      }
      
      test.zul
      <window title="Messagebox error log" border="normal">
          <button id="btn" label="Click me">
          <attribute name="onClick">
          Messagebox.show("test", "test", Messagebox.OK, Messagebox.INFORMATION);
          </attribute>
          </button>
          <script>
          alert('test');
          </script>
      </window>
      

            paowang paowang
            neillee neillee
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: