Forum Discussion

Petewilson's avatar
Petewilson
Contributor
7 years ago
Solved

Running on a specific device, when 2 are connected, defaults back to the 1st connected.

I have a script that  tests a mobile application on 2 different iPads. It is all run through Jenkins and basically the parameters are passed from Jenkins to a text file and TC reads that text file into its Temporary Variables.

 

One of these Variables is called 'Device' and is the name of the, you guessed it, Device. I have 3 devices and if i connect device A to the pc and select it to run from Jenkins it runs fine. It is the same for devices B and C, as long as i only have 1 device connected.

 

It gets a bit more interesting if i have multiple devices connected,say in order A then B. Device A connected and run through jenkins runs fine, but if i select device B, 2nd connected, in Jenkins and run, it installs the application on device B, but then continues running on device A.

 

My code is written in Delphi and i set the Current Device straight from the name in the Variable, which is named the same.

 

procedure SetMobileDevice;
begin
  Mobile.SetCurrent(Project.Variables.Device, 1);
end;

And this is the code that stops running on the device selected and reverts back to the 1st device connected. This is in a different script, but same project than the code above.

procedure OpenAboutScreen;
var 
  TopNav                            : OleVariant;
begin
  TopNav := Aliases.Device.processApplication.window0.toolbar0;
  Topnav.Button('About').Click;
end;

I have connected the devices in a different order to prove it is reverting back to the 1st connected.

 

Any pointers or guidance would be appreciated