Subscribe Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security. Subscribe

UI script to check if no step is empty

Hi,
I 'm trying to write a UI script. What I want : when a user is adding or editing a new test case, after clicking on “Save” button, a function is called to verify that each step of test case contains text (step description AND expected resul). And if it’s not the case, display a messge and highlight empty steps.
My problem : I can’t retrieve steps value when form is submitted and I don’t understand why. My script

Blockquote
name: AddEditTestCase
description: Check steps are not empty
author: Me
version: 1.0
includes: ^(cases/edit|cases/add)
excludes:

js:
(document).ready( function() { var form = (‘input[name=“title”]’).closest(‘form’);

    // Hook up on form submit
    form.on('submit', function()
    {
            var stepsList = document.getElementById("custom_steps_separated");
            var stepsListValue = document.getElementById("custom_steps_separated").value;
            console.log(stepsList); // I can see wanted input with filled steps
            console.log(stepsListValue); /// empty is displayed
    });
}

);

Thank in advance for your help!