ATF does not work even if sn-atf-id is set for a custom UI button on Workspace

Hayato
Tera Contributor

When creating a test in ATF to click a button on the Workspace, I use the "Click Component (Custom UI)" step.

However, the button's internal ID changes each time I restart the test runner, causing ATF to be unable to identify the target component and resulting in the test failing.

While investigating this issue, I found the following official documentation:

Develop Testable Components (Yokohama)

Custom UI Test Steps (Zurich)

Based on the above, I created a custom button component using npm with sn-atf-clickable and sn-atf-id (see image below).

Hayato_1-1754359627421.png

 

When I select this button in ATF, the sn-atf-id is also displayed in the hover text, confirming that the attributes are set correctly.

 

Hayato_0-1754359396589.png

Despite this, the "Click Component (Custom UI)" step fails when I restart the test runner.

If anyone has any ideas as to why this is happening, please let me know.

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Hayato 

Custom UI steps are not always reliable as it relies on HTML component for that

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hemanth M1
Giga Sage
Giga Sage

Hi @Hayato ,

 

Can you try this 

1)

HemanthM1_0-1754367199129.png

2)Have you checked UI in the Page inspector? https://www.servicenow.com/docs/bundle/zurich-application-development/page/administer/auto-test-fram...

 

3)If none of these working and if i need to execute this step using ATF, you may do the same action what "Click Me" button using server script.

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Shaqeel
Mega Sage

Hi @Hayato 

 

Try Manual Page Inspector to identify the correct element. You are not using the right one.

 

Regards

Shaql


***********************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

***********************************************************************************************************************





Regards

Shaqeel