public void AttributesNull(string attribute, string expected) { // actual var actual = new MockWebDriver().FindElement(MockBy.Positive()).GetAttribute(attribute); // assertion Assert.AreEqual(expected, actual); }
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 AttributesException(string attribute) { // actual new MockWebDriver().FindElement(MockBy.Positive()).GetAttribute(attribute); // assertion Assert.IsTrue(false); }
public void ExecuteScriptElementNoSemicolon(string actionRule) { // execute ExecuteAction <ExecuteScript>(MockBy.Positive(), actionRule); // 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 ClickElementFlat() { // execute ExecuteAction <Click>(MockBy.Positive()); // 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 ClickElementFlatNullElement(string actionRule) { // execute ExecuteAction <Click>(MockBy.Null(), actionRule); // assertion (no assertion here, expected is no exception) Assert.IsTrue(true); }
public void ClickElementAbsolutePositive(string actionRule) { // execute ExecuteAction <Click>(MockBy.Positive(), actionRule); // assertion (no assertion here, expected is no exception) Assert.IsTrue(true); }
public void RegisterParameterElementText(string actionRule) { // execute ExecuteAction <RegisterParameter>(MockBy.Positive(), actionRule); // assertion Assert.AreEqual("Mock: Positive Element", $"{AutomationEnvironment.SessionParams["test-key"]}"); }
public void DoubleClickElementFlatNull() { // execute ExecuteAction <DoubleClick>(MockBy.Null()); // assertion (no assertion here, expected is no exception) Assert.IsTrue(true); }
public void FileElement() { // generate element var onElement = MockWebElement.GetElement(new MockWebDriver(), MockBy.InputFile()); // assertion Assert.IsTrue(onElement.TagName == "INPUT"); Assert.IsTrue(onElement.GetAttribute("type") == "file"); }
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 GetScreenshotElementNone(string actionRule) { // execute var screenshot = ExecuteAction <GetScreenshot>(MockBy.None(), 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 RegisterParameterElementNullElement(string actionRule) { try { // execute ExecuteAction <RegisterParameter>(MockBy.Null(), actionRule); } catch (Exception) { // assertion var actual = $"{AutomationEnvironment.SessionParams["test-key"]}"; Assert.AreEqual("//null", actual); throw; } }
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 RandomStale() => Execute(attempts: 5, test: () => { // setup var iterations = 0; // iterate while (iterations < 1) { try { MockWebElement.GetElement(new MockWebDriver(), MockBy.RandomStale()); } catch (Exception e) when(e is StaleElementReferenceException) { iterations++; } } // assertion Assert.IsTrue(iterations > 0); });
public void ExecuteScriptElementInvalidScript(string actionRule) { // execute ExecuteAction <ExecuteScript>(MockBy.Positive(), actionRule); }