Take the boundary of signed negative values into account( Fix issue 1301) (#1336)

* Take the high boundary of signed negative values into account

* UI unit tests for the Copy/Paste menu are added

* Additional corner case for the number notations without negative values
This commit is contained in:
Jack Rainy
2020-09-15 01:11:17 +03:00
committed by GitHub
parent c508cc29ed
commit d256fb6c19
4 changed files with 151 additions and 7 deletions

View File

@@ -3,6 +3,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Appium.Windows;
using System;
using OpenQA.Selenium.Interactions;
namespace CalculatorUITestFramework
{
@@ -12,6 +13,8 @@ namespace CalculatorUITestFramework
private WindowsElement CalculatorAlwaysOnTopResults => this.session.TryFindElementByAccessibilityId("CalculatorAlwaysOnTopResults");
private WindowsElement CalculatorResult => this.session.TryFindElementByAccessibilityId("CalculatorResults");
private WindowsElement CalculatorExpression => this.session.TryFindElementByAccessibilityId("CalculatorExpression");
private WindowsElement MenuItemCopy => this.session.TryFindElementByAccessibilityId("CopyMenuItem");
private WindowsElement MenuItemPaste => this.session.TryFindElementByAccessibilityId("PasteMenuItem");
/// <summary>
/// Gets the text from the display control in AoT mode and removes the narrator text that is not displayed in the UI.
@@ -61,5 +64,33 @@ namespace CalculatorUITestFramework
throw new Exception("The Calculator Expression is not clear");
}
}
/// <summary>
/// Opens the context menu in order to be able to click its items
/// </summary>
private void OpenContextMenu()
{
Actions actions = new Actions(CalculatorResult.WrappedDriver);
// It is important to move not to the centre in order to avoid click on the text
actions.MoveToElement(CalculatorResult, 1,1).ContextClick().Perform();
}
/// <summary>
/// Opens the context menu and clicks the "Copy" item there
/// </summary>
public void ContextMenuItemCopyClick()
{
OpenContextMenu();
MenuItemCopy.Click();
}
/// <summary>
/// Opens the context menu and clicks the "Paste" item there
/// </summary>
public void ContextMenuItemPasteClick()
{
OpenContextMenu();
MenuItemPaste.Click();
}
}
}