ATF Test Step
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
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>
