diff --git a/cocoa/tests_backend/app.py b/cocoa/tests_backend/app.py index 31ff9ae92f..076274830a 100644 --- a/cocoa/tests_backend/app.py +++ b/cocoa/tests_backend/app.py @@ -64,11 +64,16 @@ def _menu_item(self, path): while True: label, path = path[0], path[1:] item = menu.itemWithTitle(label) + if item is None: + raise AttributeError() menu = item.submenu except IndexError: pass except AttributeError: - raise AssertionError(f"Menu {' > '.join(orig_path)} not found") + raise AssertionError( + f"Menu {' > '.join(orig_path)} not found; menu {menu.title} has items " + + ",".join(f"{item.title!r}" for item in menu.itemArray) + ) return item