Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. QA Tools
  3. Squish
  4. [Squish for Mac] setHookSubprocesses breaks AUT

[Squish for Mac] setHookSubprocesses breaks AUT

Scheduled Pinned Locked Moved Solved Squish
2 Posts 2 Posters 603 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    squisher
    wrote on last edited by squisher
    #1

    Hi there, maybe someone knows how to fix the hooking subprocess.

    The main issue is attaching it to the subprocess. And I'm trying to resolve it.

    I'm writing autotests for a plugin. The plugin's window starts as a subprocess.
    I can attach Squish to any process or window (by title) on Windows, so it works well.
    But for Mac, Squish does not have such functionality to attach Squish to an already existing process.

    In Squish IDE hooking subprocess works well on Mac. But I'm using PycCharm.

    Simple code in Squish IDE:

    def walk_children(parent: object, depth: int = 1000):
        for child in object.children(parent):
            yield child
            if depth:
                yield from walk_children(child, depth - 1)
    
    def main():
        startApplication("SketchUp path_to_project.skp")
       """ Then I manually start the plugin (just because I don't have handlers for now to 
        start it in a script)
        And then the script below works well. Click on the button on the plugin's 
        window worse well """
        for obj in walk_children(waitForObject(names.plugin_main_window)):
            if obj.identifier == "My_Buttont":
                mouseClick(obj)
        pass
    

    In Pycharm I tested two methods to start AUT:

    • subprocess.Popen + attach
    • squish.startApplication

    Before starting any tests I set the hooking subprocess:
    squishtest.setHookSubprocesses(True)

    So with setHookSubprocesses(True) and squish.startApplication, the plugin is not working. I can not start it. I understand it is a plugin's issue, not a squish issue, but maybe if someone knows deeply how the hooking works, I will resolve the issue from my side because devs are super busy as usual.

    For other cases:

    • setHookSubprocesses(False) and squish.startApplication
    • setHookSubprocesses(False) and subprocess.Popen
    • setHookSubprocesses(True) and subprocess.Popen
    • the plugin works well, but elements and the plugin's window are not visible (LookupError)

    I will be happy to see any ideas to attach to Squish to the existing process/window

    C 1 Reply Last reply
    0
    • S squisher

      Hi there, maybe someone knows how to fix the hooking subprocess.

      The main issue is attaching it to the subprocess. And I'm trying to resolve it.

      I'm writing autotests for a plugin. The plugin's window starts as a subprocess.
      I can attach Squish to any process or window (by title) on Windows, so it works well.
      But for Mac, Squish does not have such functionality to attach Squish to an already existing process.

      In Squish IDE hooking subprocess works well on Mac. But I'm using PycCharm.

      Simple code in Squish IDE:

      def walk_children(parent: object, depth: int = 1000):
          for child in object.children(parent):
              yield child
              if depth:
                  yield from walk_children(child, depth - 1)
      
      def main():
          startApplication("SketchUp path_to_project.skp")
         """ Then I manually start the plugin (just because I don't have handlers for now to 
          start it in a script)
          And then the script below works well. Click on the button on the plugin's 
          window worse well """
          for obj in walk_children(waitForObject(names.plugin_main_window)):
              if obj.identifier == "My_Buttont":
                  mouseClick(obj)
          pass
      

      In Pycharm I tested two methods to start AUT:

      • subprocess.Popen + attach
      • squish.startApplication

      Before starting any tests I set the hooking subprocess:
      squishtest.setHookSubprocesses(True)

      So with setHookSubprocesses(True) and squish.startApplication, the plugin is not working. I can not start it. I understand it is a plugin's issue, not a squish issue, but maybe if someone knows deeply how the hooking works, I will resolve the issue from my side because devs are super busy as usual.

      For other cases:

      • setHookSubprocesses(False) and squish.startApplication
      • setHookSubprocesses(False) and subprocess.Popen
      • setHookSubprocesses(True) and subprocess.Popen
      • the plugin works well, but elements and the plugin's window are not visible (LookupError)

      I will be happy to see any ideas to attach to Squish to the existing process/window

      C Offline
      C Offline
      clanhuth
      wrote on last edited by clanhuth
      #2

      @squisher, one can inject the Squish for Mac support into a running application (may require removing or adjusting the Hardened Runtime, if set for the application), via...

      squish_for_mac_dir/examples/mac/injection/injectMacWrapper.py
      

      It requires XCode to be installed on that computer.

      Usage:

      injectMacWrapper.py [--squish-dir=the_dir] --port=the_port aut_name_without_.app_postfix
      

      aut_name_without_.app_postfix can be an absolute or relative path to an app bundle. The app must already be running.

      Example (which explicitly launches SquishAddressBook.app beforehand):

      cd "/Users/myuser/Squish for Mac/examples/mac/injection"
      open ../addressbook/SquishAddressBook.app
      ./injectMacWrapper.py --port=4444 ../addressbook/SquishAddressBook
      

      The --squish-dir option has be left out; injectMacWrapper.py cycles through the parent directory, trying to find the Squish installation folder. This will not work when moving the .py file out of the Squish folder.

      Best regards,
      Clemens Anhuth

      1 Reply Last reply
      0
      • C clanhuth has marked this topic as solved on

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved