- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
For this catalog item, we have a custom button below that needs to be clicked before launching the request form where it contains all of the fields you need to fill out and I am stuck in this step cause I am not sure what would be appropriate. I have tried Click UI Action or Click Modal Action but none of them seems to fit.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I just realised that your custom button might actually just be a multi-row variable set. In that case you don't need to create your own step config. You just need to add the below steps in this order to fill in rows to the set.
When on page:
- Add row to multi-row variable set (SP)
- Set Variable Values (SP)
- Save current row of multi-row variable set (SP)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
For portal in general I believe Click Component (Custom UI) would be the correct step to use but it doesn't seem to work with service catalog in the portal, the ATF manual page inspector also shows a message implying this when you inspect the catalog item page.
The simplest way to achieve this would be to create a new ATF step config [sys_atf_step_config]. You want the step environment to be UI but OOB there is a BR that prevents setting that so you can insert the config with this script.
var atfStepConfig = new GlideRecord("sys_atf_step_config");
atfStepConfig.newRecord()
atfStepConfig.setValue("order", "1000")
atfStepConfig.setValue("step_env", "d2cb02e1870312009dccc9ded0e3ec7c")
atfStepConfig.setValue("name", "click button")
atfStepConfig.setValue("html_description", "placeholder")
atfStepConfig.setWorkflow(false);
atfStepConfig.insert();
Below is a mvp for a custom button click step which finds the button by a hardcoded id and clicks it and just asserts success unless it errors. You can check the existing configs for a more dynamic step as needed and there are some posts on the community for further guidance.
(function (step, stepResult, assertionObject) {
assertionObject.executeStep = function (step, stepResult) {
function assert(button) {
button.click();
stepResult.message = "successful click";
stepResult.success = true;
step.defer.resolve();
}
var testFrameWindow = g_ui_testing_util.getTestIFrameWindow();
var document = jQuery(testFrameWindow.document);
var button = document.find("#clicketyclack");
assert(button)
};
assertionObject.canMutatePage = step.can_mutate_page;
})(step, stepResult, assertionObject);Widget variable with template
<button ng-click="click()" id="clicketyclack" class="btn btn-default">click me</button>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thanks for your response. As I am still learning about ATFs, if you don't mind to please give me some details on how you have created this sample ATF step you have created? Appreciate it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
I attached an update set that has the test config, a test and a catalog item with a widget variable that showcases the configuration. I made it a little bit more dynamic than above but it still is just a mvp, adjust as needed. You can commit this to your pdi to see how it works.
How to create your custom steps
- Create sys_atf_step_config record that defines what your test does. To use the UI environment run the script from my first reply in the scripts background module.
- Now when you create a test step inside your test, you can select the test step as defined in step 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I just realised that your custom button might actually just be a multi-row variable set. In that case you don't need to create your own step config. You just need to add the below steps in this order to fill in rows to the set.
When on page:
- Add row to multi-row variable set (SP)
- Set Variable Values (SP)
- Save current row of multi-row variable set (SP)
