ATF - How access hamburger options or templates in automated test framework?

ruthmosman
Kilo Contributor

Does anyone have input as to how to use the ATF for applying templates to a form?

Manual action requires that the user click on the hamburger and from the options selects "Templates" and then "Apply Template" and then selecting the specific template.

find_real_file.png

I'm looking to write automated tests that use templates for testing different forms and application areas (screenshot above is for Project) and need help to know how to apply templates to an automated test.

Has anyone tried this or know if this is functionality is available and I'm just missing it, or if it is absent, when it might be available?

Thanks in advance for the input!

1 ACCEPTED SOLUTION

1. Go to 'Step Configurations'. New. Fill out the form as follows:


find_real_file.png



Description generation script:


(function generateDescription(step) {


  var descriptionGenerator = new ATFStepDescriptionGenerator();


  var description = gs.getMessage("Insert a record into '{0}' and apply template", step.inputs.u_table);


  description += descriptionGenerator.getConditionDescription(step.inputs.u_table);


  return description;


})(step);


Step execution script:


(function executeStep(inputs, outputs, stepResult) {


  //check template and get template name


  var template_name = '-';


  var t = new GlideRecord('sys_template');


  if(t.get(inputs.u_template)){


  template_name=t.name;


  //check if template exists for the selected table


  if(t.table != inputs.u_table){


  stepResult.setOutputMessage("Template: "+template_name+" doesn't exist for this table: "+inputs.u_table);


  stepResult.setFailed();


  }


  else{


  //Create record and apply template.


  var inc = new GlideRecord(inputs.u_table);


  inc.initialize();


  inc.applyTemplate(template_name);


  var id = inc.insert();


  outputs.u_record_id = id;


  stepResult.setOutputMessage("Record Created: "+id);


  stepResult.setSuccess();


  }


  }


  else{


  stepResult.setOutputMessage("Could not find name of the template with sys_id: "+inputs.u_template);


  stepResult.setFailed();


  }


}(inputs, outputs, stepResult));



2. Save.



3. Add Input Variables on the Step Configuration form:


find_real_file.png



find_real_file.png



4. Add Output Variables on the Step Configuration form:


find_real_file.png



5. Test it.



Let me know if you have any questions.


View solution in original post

14 REPLIES 14

ruthmosman
Kilo Contributor

Hi, Masha.



The final resolution for getting the tabs to show:


Navigate to System UI > Views


In "UI Views," select "advanced."


In "Forms" tab, select "atf_input_variable."


In hamburger, select "Configure" > "Related Lists"


Add "Form Section->Sys UI Form" to "Selected" pane.



Thanks again for all your help!


rohanhd
Kilo Contributor

Hello Masha,



I wondering if there is a way to open the list view in ATF. I need to test the List banner button which is available only in the list view and not on the form.



The API is not clear regarding how open form is working other than using Testexecutor AJAX but thats of no use to me since I already know the URL.



thanks


Hi Masha.

I was able to add step for creating template as you did above. But while running the test i came across issues.

 

find_real_file.png

 

find_real_file.png Please let me know if i am missing something.

 

 

Thanks,

Sai

maria03
Tera Contributor

I have the same issue in New York version and submitted a case with HI. The tech was able to replicate the issue and created a problem ticket PRB1427888. He also found a way to solve the issue and documented his work on CS4815696. 

Adding the information here in case someone is trying the steps on this article.

Hi @maria03 ,

I am facing the similar issue. I can attach the template when I try to query the record It says "no record found" I tried opening the problem record you have mentioned but I couldnt open. 

It would be great If you could let me know the steps here, so I can try it out. Already logged a ticket with 'Hi' but no response yet.

Attached the screenshots for your reference.

Thanks,

Rini