Fix GrowWindowToShowInvertButton

This commit is contained in:
Matt Cooley 2022-07-20 08:39:43 -07:00
commit a3f4a2bb73

View file

@ -143,11 +143,11 @@ namespace CalculatorUITestFramework
} }
/// <summary> /// <summary>
/// Increases the size of the window until History label for the History panel is visible /// Increases the height of the window until invert button is visible
/// </summary> /// </summary>
private void GrowWindowToShowInvertButton(int height) private void GrowWindowToShowInvertButton(int height)
{ {
if (height > 1000) if (height > 700)
{ {
throw new NotFoundException("Could not find the Invert Button"); throw new NotFoundException("Could not find the Invert Button");
} }
@ -158,45 +158,7 @@ namespace CalculatorUITestFramework
WinAppDriver.Instance.CalculatorSession.Manage().Window.Size = new Size(width, height); WinAppDriver.Instance.CalculatorSession.Manage().Window.Size = new Size(width, height);
//give window time to render new size //give window time to render new size
System.Threading.Thread.Sleep(10); System.Threading.Thread.Sleep(10);
GrowWindowToShowInvertButton(width + 100); GrowWindowToShowInvertButton(height + 100);
}
}
/// <summary>
/// If the Invert button is not displayed, resize the window
/// Two attempts are made, the the button is not found a "not found" exception is thrown
/// </summary>
public void ResizeAoTWindowToDiplayInvertButton()
{
Point newWindowPostion = new Point(8, 8);
WinAppDriver.Instance.CalculatorSession.Manage().Window.Position = newWindowPostion;
string source0 = this.session.PageSource;
if (source0.Contains("invertButton"))
{
return;
}
else
{
Size newWindowSize = new Size(502, 502);
WinAppDriver.Instance.CalculatorSession.Manage().Window.Size = newWindowSize;
string source1 = this.session.PageSource;
if (source1.Contains("invertButton"))
{
return;
}
else
{
Size newWindowSize2 = new Size(750, 750);
WinAppDriver.Instance.CalculatorSession.Manage().Window.Size = newWindowSize2;
}
string source2 = this.session.PageSource;
if (source2.Contains("invertButton"))
{
return;
}
else
{
throw new NotFoundException("Could not find the Invert Button");
}
} }
} }
} }