Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to insert value into Prompt box in ATF (Automated Testing Framework) ( is it possible OR Not )

chanikya
Kilo Sage

Hi,

when i click on UI action it will displays one Prompt box for user input, Now how can i pass value into Prompt box  In ATF.

Any suggestions recommended .

find_real_file.png

 

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@chanikya 

Javascript prompt boxes, alert and confirm box cannot be tested via ATF

Regards
Ankur

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

View solution in original post

20 REPLIES 20

Shubham Kakade
Giga Guru

Hello chanikya,

Automated Testing Framework  does provide a way to test popups generated using GlideDialogWindow call that uses a UI Page to present the content of the pop-up or modal. The modal can be tested using the 'Click Modal Button' action. Please see this article for usage details: Form test step: Click Modal Button .

Form test step: Click a UI Action

 

Thank you

Mark it as correct/helpful if this helps you.

Regards,

Shubham

while we are not using any UI page script here,

So now how can i proceed with steps... 

 

UI Actions Script is:

function AssignAsset(){
var openedFor = g_form.getReference('assigned_to');

if(!openedFor.sys_id > ''){
alert('Assigned to must be filled in before assigning assets.');
return;

} else {
var serNo = prompt("Enter the asset serial number");
if(serNo != null){
var asset = new GlideRecord('alm_hardware');
asset.addQuery('serial_number',serNo);
asset.query();

if(asset.next()){
asset.install_status = 1;
asset.update();
// double update to workaround existing rules that blank assigned to on state change
asset.assigned_to = openedFor.sys_id;
asset.update();
g_form.setValue('u_asset',asset.sys_id);
alert(serNo + " assigned to " + openedFor.u_display_name);

} else {
alert(serNo + " not found.");
}
}
}
}

Try this,

prompt('Text you want to display','default_text'/variable)

do i have to use Server side script as a Step3?