<script custom-tag="" type="application/ld+json">{"@context":"https://schema.org","@type":"TechArticle","headline":"ATF Custom UI steps can hang the client test runner or cause test failures if the page contains invalid HTML","image":"http://support.servicenow.com/29f1d2661baf6010cafa53d8624bcb43.iix","author":{"name":"ServiceNow Support","url":"http://support.servicenow.com/now"},"keywords":"ServiceNow, NowSupport public Knowledge Base articles, Known Error,KB1001141,","wordcount":"407","publisher":"ServiceNow","url":"https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1001141","datePublished":"2021-12-13","dateCreated":"2021-12-13","dateModified":"2023-03-22","description":"<h2>ATF Custom UI steps can hang the client test runner or cause test failures if the page contains invalid HTML</h2><br/><div style=\"overflow-x:auto\"><h2>Description</h2><div><p>When using ATF Custom","articleBody":"<h2>ATF Custom UI steps can hang the client test runner or cause test failures if the page contains invalid HTML</h2><br/><div style=\"overflow-x:auto\"><h2>Description</h2><div><p>When using ATF Custom UI steps to test a page that contains invalid HTML (for example, an invalid truncated tag like &lt;sp...&gt;), the test might fail unexpectedly.</p>\r\n<p>This issue only affects certain older Custom UI steps, and should not affect new steps created in Rome or later.</p></div><h2>Steps to Reproduce</h2><div> <p></p><p>Prerequisite: Have an instance with the &#34;sn_atf.custom_ui.mugshot_version&#34; sys_property set to &#34;18.0&#34; (e.g. an instance on the Paris release); or have a test that was created on such an instance</p>\r\n<p><br />Steps to reproduce:<br />1) Navigate to System UI &gt; UI Pages module and click New<br />2) Input any name<br />3) For HTML, paste the following:<br />&lt;?xml version&#61;&#34;1.0&#34; encoding&#61;&#34;utf-8&#34; ?&gt;<br />&lt;j:jelly trim&#61;&#34;false&#34; xmlns:j&#61;&#34;jelly:core&#34; xmlns:g&#61;&#34;glide&#34; xmlns:j2&#61;&#34;null&#34; xmlns:g2&#61;&#34;null&#34;&gt;<br /><br />&lt;button&gt;Click me&lt;/button&gt;<br />&lt;div id&#61;&#34;myDiv&#34;&gt;&lt;/div&gt;<br /><br />&lt;/j:jelly&gt;<br /><br />4) For Client Script, paste the following:<br />gel(&#34;myDiv&#34;).innerHTML &#61; &#34;&lt;sp...&gt;&lt;div&gt;Hello&lt;/div&gt;&lt;/sp...&gt;&#34;;<br /><br />5) Submit the record<br />6) Navigate to Automated Test Framework (ATF) &gt; Tests module and click New<br />7) Input any Name and click Save<br />8) In the Test Steps related list, click &#34;Add Test Step&#34;<br />9) Choose the Form &gt; Open an Existing Record step and click &#34;Next&#34;<br />10) Set &#34;Table&#34; to &#34;UI Page [sys_ui_page]&#34; and &#34;Record&#34; to the UI page created in steps 1-5, then click &#34;Submit&#34;<br />11) Click &#34;Add Test Step&#34; again and choose &#34;Form &gt; Click a UI Action&#34;, then click &#34;Next&#34;<br />12) Set &#34;UI Action&#34; to &#34;Try It&#34; and click &#34;Submit&#34;<br />13) Click &#34;Add Test Step&#34; again and choose &#34;Custom UI &gt; Click Component (Custom UI)&#34;, then click &#34;Next&#34;<br />14) The &#34;Retrieve Page Components&#34; modal should now be displayed. Click &#34;Retrieve Components&#34; to continue<br />15) A new client test runner window should open (if one wasn&#39;t open already). Watch the test run<br />Expected: Test runs to completion and page components are retrieved successfully<br />Observed: Test starts running but eventually hangs with status message &#34;Taking snapshot of the current page&#34;</p>\r\n<p> </p>\r\n<p>Creating a Custom UI step on a valid HTML page and then updating the page to include invalid HTML (e.g. by removing the Client Script in Step 4, then adding it back in after creating the test) will cause the test to fail unexpectedly instead</p></div><h2>Workaround</h2><div><p>One workaround is to remove the invalid HTML from the page being tested.</p>\r\n<p>Alternatively, on a Rome or later instance, deleting the old Custom UI step and replacing it with a new one will also resolve the issue.</p></div><div><br /><strong>Related Problem: PRB1542484</strong></div></div>"}</script>
  Loading...