[1.1.4] Mac: Problems with App.focus() and App.isRunning() --- fixed end 2018

Bug #1808849 reported by Chris Kosieracki
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
Critical
RaiMan

Bug Description

Running 1.1.4 12-14-2018 build on Mac OS Mojave 10.14.2

It appears that isRunning() is having a problem on my Mac.
When the app being tested is not running, then the isRunning() command returns False in a couple of seconds.
When the app being test is running, then the command hangs for about 16 seconds. It does eventually return True.
I think this is also causing the App.focus() command to not actually set focus to the designated app.
I did not have these problems in my scripts prior to upgrading to 1.1.4

Revision history for this message
Chris Kosieracki (cckozie) wrote :

App.open() is not working either.

Revision history for this message
RaiMan (raimund-hocke) wrote :

please paste the sample code

Revision history for this message
Chris Kosieracki (cckozie) wrote :

# TEST CASE 1
from time import ctime

Settings.ActionLogs=0

print('start', time.ctime())
tc = ('translationCore')
tC = App(tc)
running = tC.isRunning()
print('running', running, time.ctime())
App.focus(tc)
print('focus', running, time.ctime())

SIKULIX 1.1.4 RESULTS WHEN APP IS ALREADY RUNNING (15 seconds to execute isRunning):
('start', 'Tue Dec 18 09:32:37 2018')

('running', True, 'Tue Dec 18 09:32:52 2018')
('focus', True, 'Tue Dec 18 09:32:52 2018')

SIKULIX 1.1.3 RESULTS WHEN APP IS ALREADY RUNNING (6 seconds to execute isRunning):
('start', 'Tue Dec 18 09:37:52 2018')

('running', True, 'Tue Dec 18 09:37:58 2018')

('focus', True, 'Tue Dec 18 09:37:59 2018')

# TEST CASE 2
from time import ctime

Settings.ActionLogs=0

print('start', time.ctime())
myApp = App('Digital Color Meter')
myApp.open()
print('open',time.ctime())

running = myApp.isRunning()
print('running', running, time.ctime())

myApp.focus()
print('focus',time.ctime())

SIKULIX 1.1.4 RESULTS WHEN APP IS NOT RUNNING:
('start', 'Tue Dec 18 09:41:33 2018')

[error] App.open: not found in taskList after 0 secs (Digital Color Meter)
('open', 'Tue Dec 18 09:41:34 2018')

('running', False, 'Tue Dec 18 09:41:36 2018')

[error] App.focus failed: not running: [-1:Digital Color Meter (???)] Digital Color Meter
('focus', 'Tue Dec 18 09:41:37 2018')

SIKULIX 1.1.3 RESULTS WHEN APP IS NOT RUNNING:
('start', 'Tue Dec 18 09:39:13 2018')

('open', 'Tue Dec 18 09:39:15 2018')
('running', True, 'Tue Dec 18 09:39:15 2018')

('focus', 'Tue Dec 18 09:39:17 2018')

Revision history for this message
RaiMan (raimund-hocke) wrote :

Thanks for the details - very helpful :-)

I will check.

--- # TEST CASE 2
this problem is already known:
bug 1808573

Revision history for this message
Chris Kosieracki (cckozie) wrote :

Just noticed that there is also a related (I assume) response problem with closeApp.

from time import ctime

print(time.ctime())
tc = ('translationCore')
closeApp(tc)
print(time.ctime())

Tue Dec 18 11:40:10 2018

Tue Dec 18 11:40:27 2018

RaiMan (raimund-hocke)
Changed in sikuli:
status: New → Fix Committed
importance: Undecided → Critical
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.1.4
summary: - Problems with isRunning() and App.focus() on Mac in 12-14 build
+ [1.1.4] Mac: Problems with App.focus() and App.isRunning()
Changed in sikuli:
importance: Critical → High
Revision history for this message
RaiMan (raimund-hocke) wrote : Re: [1.1.4] Mac: Problems with App.focus() and App.isRunning()

The main problems with standard apps like TextEdit (not having a space in name - to be fixed) should be fixed now.

There are 3 items to identify a running app (samples for TextEdit)
 1- displayed name (that shows up in the top menu bar) = TextEdit
 2- process name (currently used to find the app) = TextEdit
 3- file name (that was used to start the app) = /Applications/TextEdit.app

So for apps like TextEdit the names are somehow homogenous.

But there are apps, that show up in-homogenous:
JetBrain's IntelliJ IDEA:
1- IntelliJ IDEA
2- idea
3- /Applications/IntelliJ IDEA CE.app

I will now trigger a build, that uses 1- (displayed name) to identify running apps, since that might be the most intuitiv identifier.

Revision history for this message
RaiMan (raimund-hocke) wrote :

BTW: about timing: I never saw elapsed times beyond 2 seconds for a not running app.

Revision history for this message
RaiMan (raimund-hocke) wrote :

... and the problem with App.focus() is fixed.

RaiMan (raimund-hocke)
Changed in sikuli:
importance: High → Critical
summary: - [1.1.4] Mac: Problems with App.focus() and App.isRunning()
+ [1.1.4] Mac: Problems with App.focus() and App.isRunning() --- fixed end
+ 2018
RaiMan (raimund-hocke)
Changed in sikuli:
status: Fix Committed → Fix Released
milestone: 1.1.4 → 2.0.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.