Forum Discussion

andygough1974's avatar
andygough1974
New Contributor
10 years ago

Changing screen layout slightly changes coordinates, tests fail

Hi All



I have a WPF application with a charting window in it, in this window are certain "Grips" which I can drag around the chart and it will draw best fitting lines etc.



I recorded the test as a keyword and converted to script and got the follwoing function:




function FreqResp_LPF_1000Hz()


{


  //Clicks the 'ButtonDefault' button.


  //Drags from point (69, 250) of the 'Polygon' object to offset (-2, -164).


  //Drags from point (210, 246) of the 'EqPlot' object to offset (145, -160).


  //Drags from point (354, 248) of the 'Path' object to offset (147, -163).


  


  Aliases.VEParameterTool.HwndSource_LvTuningTool.LvTuningTool.ScrollViewer.DockPanel.DockPanel.tabControlMainTab.EQControl.EqTabs.DockPanel.DockPanel.Border.StackPanel.StackPanel.ButtonDefault.ClickButton();


  Aliases.VEParameterTool.HwndSource_LvTuningTool.LvTuningTool.ScrollViewer.DockPanel.DockPanel.tabControlMainTab.EQControl.EqTabs.DockPanel.Grid.EqPlot.Canvas.Polygon.Drag(69, 250, -2, -164);


  Aliases.VEParameterTool.HwndSource_LvTuningTool.LvTuningTool.ScrollViewer.DockPanel.DockPanel.tabControlMainTab.EQControl.EqTabs.DockPanel.Grid.EqPlot.Drag(210, 246, 145, -160);


  Aliases.VEParameterTool.HwndSource_LvTuningTool.LvTuningTool.ScrollViewer.DockPanel.DockPanel.tabControlMainTab.EQControl.EqTabs.DockPanel.Grid.EqPlot.Canvas.Path.Drag(354, 248, 147, -163);


}



Now that works fine, but i found a small thing in my layout that wasnt right and had to change the size of another UI element, which slightly changed the position of the chart, and now this test fails because it cant find the object its looking for.



The exact error is:



There was an attempt to perform an action at point (354, 248) which is invisible or out of the window bounds.



And the Additional Info is:




Tested object:

Aliases.VEParameterTool.HwndSource_LvTuningTool.LvTuningTool.ScrollViewer.DockPanel.DockPanel.tabControlMainTab.EQControl.EqTabs.DockPanel.Grid.EqPlot.Canvas.Path

(Sys.Process("VEParameterTool").WPFObject("HwndSource: LvTuningTool").WPFObject("LvTuningTool").WPFObject("ScrollViewer", "", 1).WPFObject("DockPanel", "", 1).WPFObject("DockPanel", "", 1).WPFObject("tabControlMainTab").WPFObject("EQControl", "", 1).WPFObject("EqTabs").WPFObject("DockPanel", "", 1).WPFObject("Grid", "", 1).WPFObject("EqPlot").WPFObject("Canvas", "", 1).WPFObject("Path", "", 13))



Also, I have attached a picture top show you the "Grips" I can no longer access (I made the UC on the right huge to show the issue), therte are 4 "Grip Points" labeled in Black.



Does anyone have any idea how i can fix my tests so that small UI changes dont break my tests?



Many thanks in advace




1 Reply

  • rgratis's avatar
    rgratis
    Frequent Contributor
    If there are internal application methods that you can use to determine the position of the grips, then you could use those to determine start point.  A developer might be able to help if TestComplete has access to the application's internal methods.  You could also do math to determine how far to drag, etc.



    Neither of these solutions will help if you're going to do a Picture comparison on the plot though, as the change in layout would cause that to fail.