Forum Discussion

luciano_santos_'s avatar
luciano_santos_
Occasional Contributor
10 years ago
Solved

Display Resolution in Web Test

Good Morning, 

 


My test architecture is divided into PCs (monitor resolution "X") and virtual machines (monitor resolution "Y"). 


 


When I create a project on my PC and distribute VMs, the test fails because of monitor resolution. 


 


To deal with this problem, what is the best practice to be adopted? 


 


 


Thank you, 


Luciano

  • Take a look at the online documentation for any methods that are used by your test steps  that involve screen co-ordinates. I see you have the HoverMouse method in the screenshot you posted. Looking at the Test Complete Documentation

    I see that setting the x and y values to -1 will place the mouse in the center of the object. So, try setting your HoverMouse values to -1,-1. With the current values you have in there Test Complete is not using the centre of the object.

5 Replies

  • chrisb's avatar
    chrisb
    Regular Contributor
    Which parts of your tests are failing? Tell us that and you might get a more tailored response to your issue.

    I am guessing it is areas that use screen co-ordinates. As the previous poster mentioned I would avoid practices that are dependent on screen resolution if you can.
  • chrisb's avatar
    chrisb
    Regular Contributor
    Take a look at the online documentation for any methods that are used by your test steps  that involve screen co-ordinates. I see you have the HoverMouse method in the screenshot you posted. Looking at the Test Complete Documentation

    I see that setting the x and y values to -1 will place the mouse in the center of the object. So, try setting your HoverMouse values to -1,-1. With the current values you have in there Test Complete is not using the centre of the object.
  • You can perhaps try something like the following (if you really have to rely on coordinates):



    Given the screen coordinates for a touch (or whichever event) touch_x, touch_y and the screen resolution screen_x, screen_y (on which the test was developed), you first need to normalize the coordinates.



    A JScript example: 





    function normalizeCoordinates(touch_x, touch_y, screen_x, screen_y){

    //normalize the coordinates

    var x = touch_x / screen_x;

    var y = touch_y / screen_y;

     

    //Get the new coordinates to touch

    x = Math.round(x * <current_screen_x>);

    y = Math.round(y * <current_screen_y>);

     

    //Send back the values (as an array)

    return [x,y];

    }



    What then is returned is the x,y coordinates that relate to the new screen resolution which you can use in whichever way you wish :)



    Hope this is of some help

  • karkadil's avatar
    karkadil
    Valued Contributor
    The best practice is to create tests which do not depend on screen resolution.

    Everything else is workaround.
  • luciano_santos_'s avatar
    luciano_santos_
    Occasional Contributor
    Hello, it really would be great to create tests coordinates, even more than I'll use very dristribuidos tests. 

     


    Although I have been testing in our web application, I did the same tests with a Web Site and any realized that some elements he seeks to coordinate and not the object. I can not tell if this is random, but I'd really like to learn how to handle this situation. 


     


    I took a print of the situation I'm dealing with, sometimes I'm even doing the wrong procedures. 



     


     


    I read that in TestComplete 10:40, natively supports Chrome and Firefox today. I'm still tilizando version 10:30 because I always wait a few days before putting the latest version. Perhaps this solves the problem, but not sure. 


     


    I am grateful for the support of the community