I have set up Jenkins to periodically run iphone UI automation tests.
When the first test script for the automation is run, OS X prompts for a username and password for security reasons.
So I made a perl script which spawns the command from Expect and send the username and password.
For some reason the username is sent but not the password.
The password does eventually get sent but its after my command times out.
Code below:
my $cmdString = "instruments -t $traceTemplatePath $AppFolder -e UIASCRIPT $escapedTest " .
"-e UIARESULTSPATH Logs";
if ($isFirst == 1) {
$isFirst = 0;
$password = `cat /Users/\$USER/.password`;
# Actually spawn the command from Expect.
my $exp = Expect->spawn($cmdString)
or die "Failed to spawn command in Expect: $! \n";
#change delay if necessary
$exp->expect(30, [qr/Name .*/]);
$exp->send("\n");
$exp->expect(undef, [qr/Password/]);
$exp->send("$password\n");
}
What I want to do is send the password before my command times out so it runs the test script.
Try to combine the queries and use exp_continue as: