The ServiceNow Nerd

The musings of a ServiceNow platform developer and enthusiast

The SN Nerd

Exploring ATF Support for Configurable Workspaces in Washington DC Release

by snnerd
595 views

In this article, you will learn how ATF support for configurable workspace support stacks up, and how I used my automated testing tool Regress to validate this in patch 0.

ATF Support in Washington DC

The ServiceNow User Interface has been evolving rapidly, thanks to the continued investment in NextExperience and Configurable Workspaces. The reporting engine has also made major strides in migrating to the new experience. However, ATF has fallen behind – it did not support workspace until the Washington DC release, rendering existing UI tests useless for customers who migrated. We are glad that ServiceNow has finally added this long-awaited feature of ATF support for configurable workspace.

Support looks quite limited at this stage, with only two new Test Steps that test the new capabilities in configurable workspaces – declarative actions. So there isn’t much above and beyond what we could already achieve in the classic UI, in terms of test steps. However, there is a way to automate the creation of test steps for both the classic and service portal UI, using a tool that I wrote called Regress. Regress is an app that generates test steps for you in ATF, saving you time and effort.

Regress

What is Regress

Regress ATF Recorder is a custom application that automatically generates Tests & Test Steps for the Automated Test Framework in ServiceNow. Think of it as an add-on that records the state of forms and the action taken, for forms in Classic UI and Catalog Items in the Service Portal. Test steps are automatically generated and populated based on user actions and a snapshot of the form when the form was submitted. It continues to track the different records you navigate to, joining them together where relationships can be found.

Creating a comprehensive ATF test in a few clicks using Regress

The application offers features like Recording Levels, Record Tracking, Record Snapshot, Email Notification Capture, and Order Guides. It also automatically creates a test step to impersonate a user with the same fields and roles as the user used to record the test.

To learn more about Regress’ features, see regress-atf-recorder.com. The app can be downloaded for free on ServiceNow Share, where it is the 8th most downloaded project of all time.

Since the announcement of support for ATF in configurable workspaces, I ported all my UI and Client Scripts across to work with near-feature parity to the Classic UI. This port is not publically available but please inquire if you would like to be a beta tester.

Porting regress to WEP

Knowing that configurable workspaces were the way forward, I never ported Regress to work with legacy workspaces, which was supported by ATF. While ATF did not support configurable workspaces, and potentially never would, I was not going to spend any time and effort supporting this myself. Despite this, I was asked several times why Regress didn’t support configurable workspaces!

I was lucky enough to attend Knowledge last year, where I learned that ATF support for configurable workspaces was planned for the Washington DC release. Two major roadblocks for porting Regress were getting UI scripts to work in configurable workspaces, and dealing with the shadow DOM. I was forced to work out how to get UI scripts to work in configurable workspaces and when doing a Service Operations Workspace migration for a client and eventually stumbled upon the querySelectorShadowDom API. I also learned how to make UI scripts work in both configurable workspaces and the classic UI to avoid a total rewrite.

Still, UI actions proved extremely challenging to deal with. After weeks of trial and error, and a few additional quality-of-life features along the way, I was able to port Regress to work in the configurable workspace with near feature parity. Many hours were spent that perhaps should have gone towards wedding or honeymoon planning – but hey – everyone needs a break from planning. Regress 2.0 was ready to test ATF support for configurable workspaces.

ATF support for WEP Findings

It was time to put Configurable Workspace through its paces using Service Operations Workspace, recording ATF tests using my recently ported version of Regress, tested in my PDI using washingtondc-12-20-2023__patch0-01-17-2024_01-25-2024_1625. Some of these issues may already be fixed in EA or planned for GA. At the time of writing this blog, there is no guarantee that this feature will even make it to the final release (safe harbor).

Observations

This is not the tab you are looking for

Given the option, the Client Runner appears to avoid showing the Details tab (the tab with the actual form we are populating) at all costs!

ATF client runner showing the Overview tab

It is not just the first tab that is selected, if given the choice it will pick the last tab over the one we want to see!

ATF client runner showing the Related Records tab

The only time it would show the form is when creating new records that only had one tab.

ATF client runner showing the form

This may not be an issue if you are using the CloudRunner, but could still obfuscate screenshots.

Luckily there is a simple workaround for this – the GlideScreenshot feature.

The new GlideScreenshot feature

With this enabled, other than some UI action text formatting issues, your test results will have great screenshots.

Screenshot from client runner using GlideScreenshot feature

Script errors

Even in a completely OOB instance, tests may fail due to browser errors. This is not a big deal as they can be easily ignored, and will not come up again.

Allowing a client error so tests can continue

Declarative actions

Much like UI actions, Declarative action Test Steps only provide the option to click and assert submission. Many declarative actions are client-side that show popups or other funky things, which you can’t do much within ATF. The ones that do operate server-side work as expected.

Declarative Action Visibility works much the same as UI actions and works as expected.

Test Step generated by Regress for Declarative Action Visibility

Bugs

Observations aside, we now have to talk about bugs. Where possible, I confirmed defects were not present in tests run in the classic environment and used manually created test steps to confirm that my test recording tool was not the issue.

I must re-iterate that this is tested on patch 0, and is not indicative of the final product.

Field state visibility

Using Regress, I can automatically generate a Field State Validation Test Step that auto-populates all mandatory, visible, and read-only field states.

Generating a full regression test using Regress

‘On hold reason’ failed its validation of ‘Not Visible’.

Failure on Test Step in Configurable Workspace

But we can see clearly on the form, ironically, that it is hidden.

No ‘On hold reason’ to be found

When testing the opposite (is visible) it is correctly identified as visible.

The same issue was found with the ‘Active’ flag.

Regress used the g_form.getVisible() API to determine visibility, which gives the correct results. Not sure what has gone wrong here!

Fields not on the form are correctly identified as hidden.

Variable state and values

The Variable State Validation test step was not working.

Variable State Validation test step failing without reason

The duplicated Variable State Validation was generated by Regress, with the first one manually created.

No summary or output was given for test step failure

No summary or output is given.

Set Variable Values were also broken, with some failure details provided.

g_form is not defined

Anything to do with variables seems to be completely broken at this stage.

This is not a huge issue if you are using Regress, as you can just toggle that functionality off:

However, I couldn’t do any tests that required populating variable values, as that just didn’t work.

To nerd out for just a moment, in the classic UI there is a global object called g_sc_form which I relied on for my test generation for variables. This appears to no longer exist in configurable workspaces, but everything I needed was in g_form to generate the test steps – it was just unfortunate it doesn’t work yet.

My automatically generated test step that won’t pass

If I can reverse engineer what is on the form, ServiceNow will be able to do the required state and value population given enough time. This does not concern me too much.

Final thoughts

Bugs are to be expected in patch 0 of a new release, which is not even generally available. Everything else I tested worked fine, so even if it went to GA as-is, the only thing you can’t do is an E2E request where the population of variables is required to drive workflow. For Patch 0, I was impressed by how functional it was.

Conclusion

  • With a few tweaks ATF is usable in configurable workspaces in Washington DC
  • There are some patch 0 bugs for field visibility and variables
  • Hopefully, bugs will be fixed by GA, but there is no guarantee this feature will even ship with GA
  • If you are interested in beta testing Regress for WEP, please send me an email

Related Posts

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More