public void SendKeysElementCombination(string actionRule) { // execute ExecuteAction <SendKeys>(MockBy.Positive(), actionRule); // assertion (no assertion here, expected is no exception) Assert.IsTrue(true); }
public void KeyboardElementInvalidKeyName(string actionRule) { // execute ExecuteAction <Keyboard>(MockBy.Positive(), actionRule); // assertion (no assertion here, expected is no exception) Assert.IsTrue(true); }
public void ContextClickElementRelativeNoElement(string actionRule) { // execute ExecuteAction <ContextClick>(MockBy.Positive(), actionRule); // assertion (no assertion here, expected is no exception) Assert.IsTrue(true); }
public void AttributesNull(string attribute, string expected) { // actual var actual = new MockWebDriver().FindElement(MockBy.Positive()).GetAttribute(attribute); // assertion Assert.AreEqual(expected, actual); }
public void ClickElementFlat() { // execute ExecuteAction <Click>(MockBy.Positive()); // assertion (no assertion here, expected is no exception) Assert.IsTrue(true); }
public void SendKeysElementInterval(string actionRule) { // execute ExecuteAction <SendKeys>(MockBy.Positive(), actionRule); // assertion (no assertion here, expected is no exception) Assert.IsTrue(Stopwatch.Elapsed.TotalMilliseconds > 1000); }
public void ClickElementAbsolutePositive(string actionRule) { // execute ExecuteAction <Click>(MockBy.Positive(), actionRule); // assertion (no assertion here, expected is no exception) Assert.IsTrue(true); }
public void ExecuteScriptElementNoSemicolon(string actionRule) { // execute ExecuteAction <ExecuteScript>(MockBy.Positive(), actionRule); // assertion (no assertion here, expected is no exception) Assert.IsTrue(true); }
public void Attributes(string attribute, string expected) { // actual var actual = new MockWebDriver().FindElement(MockBy.Positive()).GetAttribute(attribute); // assertion Assert.IsTrue(Regex.IsMatch(actual, expected)); }
public void RegisterParameterElementText(string actionRule) { // execute ExecuteAction <RegisterParameter>(MockBy.Positive(), actionRule); // assertion Assert.AreEqual("Mock: Positive Element", $"{AutomationEnvironment.SessionParams["test-key"]}"); }
public void AttributesException(string attribute) { // actual new MockWebDriver().FindElement(MockBy.Positive()).GetAttribute(attribute); // assertion Assert.IsTrue(false); }
public void RegisterParameterElementRegex(string actionRule) { // execute ExecuteAction <RegisterParameter>(MockBy.Positive(), actionRule); // assertion var actual = $"{AutomationEnvironment.SessionParams["test-key"]}"; Assert.IsTrue(Regex.IsMatch(actual, "^\\d+$")); }
public void SendKeysElementAppiumInvalidState(string actionRule) { // set new mock driver for mobile device WebDriver = new MockAppiumDriver <IWebElement>(); // execute ExecuteAction <SendKeys>(MockBy.Positive(), actionRule); // assertion (no assertion here, expected is no exception) Assert.IsTrue(true); }
public void GetScreenshotElementPositiveTiff(string actionRule) { // execute var screenshot = ExecuteAction <GetScreenshot>(MockBy.Positive(), actionRule) .ExtractionResults[0] .Entities[0] .EntityContentEntries["screenshot"]; // assertion (no assertion here, expected is no exception) Assert.IsTrue(File.Exists($"{OutputDir}/image-b.png")); Assert.IsTrue(screenshot.Contains("image-b.png")); }
public void AttributesValue(string attribute, string expected) { // setup var element = new MockWebDriver().FindElement(MockBy.Positive()); element.SendKeys(expected); // get actual var actual = element.GetAttribute(attribute); // assertion Assert.AreEqual(expected, actual); }
public void RegisterParameterElementNonElementText(string actionRule) { try { // execute ExecuteAction <RegisterParameter>(MockBy.Positive(), actionRule); } catch (Exception) { // assertion var actual = $"{AutomationEnvironment.SessionParams["test-key"]}"; Assert.IsTrue(Regex.IsMatch(actual, "^\\d{4}-\\d{2}-\\d{2}$")); throw; } }
public void ScrollElement(string script) { // setup var driver = new MockWebDriver(); var element = driver.FindElement(MockBy.Positive()); // execute driver.ExecuteScript(script, element); // actuals var scrollTop = (string)driver.ExecuteScript("return arguments[0].scrollTop;", element); var scrollLeft = (string)driver.ExecuteScript("return arguments[0].scrollLeft;", element); // assert Assert.IsTrue(scrollLeft == "400"); Assert.IsTrue(scrollTop == "500"); }
public void RandomNull() => Execute(attempts: 5, test: () => { // setup var iterations = 0; // generate element var onElement = MockWebElement.GetElement(new MockWebDriver(), MockBy.Positive()); // iterate while (onElement != null) { iterations++; onElement = MockWebElement.GetElement(new MockWebDriver(), MockBy.RandomNull()); } // assertion Assert.IsTrue(iterations > 0); });
public void ExecuteScriptElementInvalidScript(string actionRule) { // execute ExecuteAction <ExecuteScript>(MockBy.Positive(), actionRule); }