This step failed because a client-side Javascript error was detected on the page being tested. See the logs and screenshots on the test result for details.

Geet Rana
Giga Contributor

Hi All,

Using automated testing framework I have created tests for Change Management and in a case where an Approver has to open an existing record from sysapproval_approver table so that he/she can approve/reject it, I am facing this particular issue

Below is the screenshot where you can see what output and what test logs I am getting.find_real_file.pngfind_real_file.png

 

In the test log the output for failure record says "Uncaught SyntaxError : Unexpected token ;"

 

I have tried to inspect the web page also from where I came to know this error is coming from "Style" folder.

In  demo instance tooI am facing the same issue. One interesting thing about this issue is the error doesn't come all the time, means in a random manner it fails or passes that particular step.

Note : This issue occurs only for "Open Existing Record" of "sysapproval_approver" table.

Raised HI ticket  for which they answered in London release this issue wont be there anymore. 

Currently I am in Jakarta and this is dead end for me. If I could get some workaround it would be highly appreciated.

 

Edit 1 : Error is not in the style folder. Below is the screenshot : 

find_real_file.png

1 ACCEPTED SOLUTION

Austen Harriso1
Tera Contributor

Hey Geet! Not sure if you're still working on this problem, but it recently came up as an issue for me and I think I found a decent workaround. Like you mentioned ServiceNow is currently working on this issue and it should be fixed in the next Kingston/London patch: https://hi.service-now.com/kb_view.do?sysparm_article=KB0692731

 

After some testing, it looks like the culprit is the UI Macro "approval_summarizer_default". This makes sense because the Javascript Unexpected Token error comes up when you have a poorly formatted Client Script or UI Macro running on a page. Deactivating it would likely resolve the issue, but then it would leave you without the "Approval for" record information on the Approval form! Here's what I'd suggest as an alternative: Include a few steps in your Test to mark the UI Macro inactive temporarily before reactivating it at the end!

 

1. Add a record query at the beginning of your test for the UI Macro

2. Add a record update to mark it as "Active=False"

3. At the very end of your Test, re-impersonate an admin user, or user with the ability to modify the UI Macro

4. Add a record update for the record discovered in the query of step 1 (The UI Macro). Mark the record as "Active=True" (This step not necessarily required if ATF does its job properly and rolls back changes, but good to include it just in case)

 

This is a bit of a funny workaround since it involves modifying an important system UI Macro. Furthermore, if you cancel the Test while it's in progress, you'll likely need to go back manually and reactivate the UI Macro as ATF will sometimes not roll back changes for a cancelled Test.

 

I've got this currently set up in our Tests for Change Management (lots of approvals) and it seems to be working so far. Hoping ServiceNow will come out with a fix soon, but this should work in the meantime. Let me know if it does the trick for you!

View solution in original post

3 REPLIES 3

Austen Harriso1
Tera Contributor

Hey Geet! Not sure if you're still working on this problem, but it recently came up as an issue for me and I think I found a decent workaround. Like you mentioned ServiceNow is currently working on this issue and it should be fixed in the next Kingston/London patch: https://hi.service-now.com/kb_view.do?sysparm_article=KB0692731

 

After some testing, it looks like the culprit is the UI Macro "approval_summarizer_default". This makes sense because the Javascript Unexpected Token error comes up when you have a poorly formatted Client Script or UI Macro running on a page. Deactivating it would likely resolve the issue, but then it would leave you without the "Approval for" record information on the Approval form! Here's what I'd suggest as an alternative: Include a few steps in your Test to mark the UI Macro inactive temporarily before reactivating it at the end!

 

1. Add a record query at the beginning of your test for the UI Macro

2. Add a record update to mark it as "Active=False"

3. At the very end of your Test, re-impersonate an admin user, or user with the ability to modify the UI Macro

4. Add a record update for the record discovered in the query of step 1 (The UI Macro). Mark the record as "Active=True" (This step not necessarily required if ATF does its job properly and rolls back changes, but good to include it just in case)

 

This is a bit of a funny workaround since it involves modifying an important system UI Macro. Furthermore, if you cancel the Test while it's in progress, you'll likely need to go back manually and reactivate the UI Macro as ATF will sometimes not roll back changes for a cancelled Test.

 

I've got this currently set up in our Tests for Change Management (lots of approvals) and it seems to be working so far. Hoping ServiceNow will come out with a fix soon, but this should work in the meantime. Let me know if it does the trick for you!

Thanks a lot Austen !!

 

Thank you very much!!!