Forum Discussion

nastester's avatar
nastester
Regular Contributor
4 years ago

Running tests on laptop screen vs monitor screen

Hello!

My team has a TestComplete project, for testing a web application, mostly comprised of keyword tests but also some scripts. 

We have found that some tests are failing when ran on a laptop screen but work fine on a monitor screen. What can be done to fix this? 

 

The projects object tree model is to set to "tree" currently. Is there a setting or way that this can be changed for all? Or do individual objects need to be modified to allow for more recognition tolerance maybe? (if that's a thing)

 

As an example, I attached two pictures that show the display difference of two objects on a laptop screen vs a monitor screen. On laptop screen, the test clicks the wrong object and thus fails the test.

  • In this case, it makes no sense that the object was zero as it is visible on both the laptop screen and monitor screen. 

    What I found is that by default, when you keyword record a Click event, a coordinate pair is given to the action (not sure if this is a setting that can be disabled or not).  Changing the coordinates to the default value of  (-1, -1) or using a script click without coordinates like obj.Click(); the item is able to be clicked on both screen resolutions 

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    What error is posted to test log?

    How problematic object is identified when the tested application is displayed on both laptop and desktop monitors?

     

    • nastester's avatar
      nastester
      Regular Contributor

      Hi Alex,

       So for one of the tests, an icon is clicked to open a modal. On a laptop screen, the "click" is performed but it's not on the object, so nothing is opened and the next test step fails:

        The window size is (0, 0); the screen rectangle: the left top corner is (72, 154), the right bottom corner is (72, 154).
       
      Is there a way I can have the test be purely object based instead of positioning? Because of course that would vary on different screen sizes.
       
      thanks for your help 
      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        The window size is (0, 0)

        This means that the sought for object (UI element) was found but its size is zero. Obviously, zero-sized UI element cannot be clicked.

        The reason why element size is zero depends on your tested application and how developers manipulate with UI (depending on screen size/resolution).

         

         test be purely object based instead of positioning?

        No coordinate-dependent positioning occurred in this case, but just the target UI element is of zero size and thus cannot be clicked.