After seeking answers, I stumbled upon this question where a similar script was attempted:
class viewerTest extends LoginLoader{
public function testNewViewer(){
$this->url('new-viewer.php');
$this->byName('viewers_streetname')->value('street');
$script = file_get_contents("./viewerScript.js");
$this->execute(array(
'script' => $script,
'args' => array()
));
}}
Unfortunately, the expected outcome did not materialize. The intention was to validate mandatory inputs and display the names of unfilled inputs, but no names were displayed.
Could there be an error in my approach?
PS: The function file_get_contents() is functioning properly.
Below is the content of viewerScript.js :
function valid_viewer_submit(){
var datastring = $("#edit-viewer").serialize();
...
...
...
error_div.innerHTML = error;
};