public void CanSelectNullableGuid_InitiallySelected() { var paragraph = Browser.FindElement(By.Id("select-nullable-guid-initially-selected")); var select = new SelectElement(paragraph.FindElement(By.TagName("select"))); var result = paragraph.FindElement(By.Id("select-nullable-guid-initially-selected-result")); WaitAssert.Equal("413a7c18-b190-4f58-a967-338cd1566e97", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("413a7c18-b190-4f58-a967-338cd1566e97", () => result.Text); select.SelectByIndex(2); WaitAssert.Equal("00cd0391-5e22-4729-855a-fec86267722c", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("00cd0391-5e22-4729-855a-fec86267722c", () => result.Text); select.SelectByValue("bca8ef46-abb7-4aec-b700-90b2b730a382"); WaitAssert.Equal("bca8ef46-abb7-4aec-b700-90b2b730a382", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("bca8ef46-abb7-4aec-b700-90b2b730a382", () => result.Text); }
public void CanSelectGuid_InitiallySelected() { var paragraph = Browser.FindElement(By.Id("select-guid-initially-selected")); var select = new SelectElement(paragraph.FindElement(By.TagName("select"))); var result = paragraph.FindElement(By.Id("select-guid-initially-selected-result")); WaitAssert.Equal("413a7c18-b190-4f58-a967-338cd1566e97", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("413a7c18-b190-4f58-a967-338cd1566e97", () => result.Text); select.SelectByValue("00cd0391-5e22-4729-855a-fec86267722c"); WaitAssert.Equal("00cd0391-5e22-4729-855a-fec86267722c", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("00cd0391-5e22-4729-855a-fec86267722c", () => result.Text); select.SelectByValue("00000000-0000-0000-0000-000000000000"); WaitAssert.Equal("00000000-0000-0000-0000-000000000000", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("00000000-0000-0000-0000-000000000000", () => result.Text); }
public void CanSelectNullableInt_InitiallySelected() { var paragraph = Browser.FindElement(By.Id("select-nullable-int-initially-selected")); var select = new SelectElement(paragraph.FindElement(By.TagName("select"))); var result = paragraph.FindElement(By.Id("select-nullable-int-initially-selected-result")); WaitAssert.Equal("1", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("1", () => result.Text); select.SelectByIndex(2); WaitAssert.Equal("2", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("2", () => result.Text); select.SelectByValue("3"); WaitAssert.Equal("3", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("3", () => result.Text); }
public void InputSelectInteractsWithEditContext() { var appElement = MountTestComponent <TypicalValidationComponent>(); var ticketClassInput = new SelectElement(appElement.FindElement(By.ClassName("ticket-class")).FindElement(By.TagName("select"))); var select = ticketClassInput.WrappedElement; var messagesAccessor = CreateValidationMessagesAccessor(appElement); // Validates on edit WaitAssert.Equal("valid", () => select.GetAttribute("class")); ticketClassInput.SelectByText("First class"); WaitAssert.Equal("modified valid", () => select.GetAttribute("class")); // Can become invalid ticketClassInput.SelectByText("(select)"); WaitAssert.Equal("modified invalid", () => select.GetAttribute("class")); WaitAssert.Equal(new[] { "The TicketClass field is not valid." }, messagesAccessor); }
public void CanUpdateValuesMatchedByType() { var currentCount = Browser.FindElement(By.Id("current-count")); var incrementButton = Browser.FindElement(By.Id("increment-count")); // We have the correct initial value WaitAssert.Equal("100", () => currentCount.Text); // Updates are propagated incrementButton.Click(); WaitAssert.Equal("101", () => currentCount.Text); incrementButton.Click(); WaitAssert.Equal("102", () => currentCount.Text); // Didn't re-render unrelated descendants Assert.Equal("1", Browser.FindElement(By.Id("receive-by-interface-num-renders")).Text); }
public void CanBindTextboxDecimal() { var target = Browser.FindElement(By.Id("textbox-decimal")); var boundValue = Browser.FindElement(By.Id("textbox-decimal-value")); var mirrorValue = Browser.FindElement(By.Id("textbox-decimal-mirror")); Assert.Equal("0.0000000000000000000000000001", target.GetAttribute("value")); Assert.Equal("0.0000000000000000000000000001", boundValue.Text); Assert.Equal("0.0000000000000000000000000001", mirrorValue.GetAttribute("value")); // Modify target; verify value is updated and that textboxes linked to the same data are updated // Decimal should preserve trailing zeros target.Clear(); target.SendKeys("0.010\t"); WaitAssert.Equal("0.010", () => boundValue.Text); Assert.Equal("0.010", mirrorValue.GetAttribute("value")); }
public void CanTypeNumberWithCommaDecimalSeparator() { var paragraph = Browser.FindElement(By.Id("decimal-separator-with-comma")); var numeric = paragraph.FindElement(By.TagName("input")); var result = paragraph.FindElement(By.Id("decimal-separator-with-comma-result")); WaitAssert.Equal("42,5", () => result.Text); numeric.SendKeys("6"); WaitAssert.Equal("42,56", () => result.Text); numeric.SendKeys(Keys.Backspace); numeric.SendKeys(Keys.Backspace); WaitAssert.Equal("42", () => result.Text); numeric.SendKeys(",3"); WaitAssert.Equal("42,3", () => result.Text); }
public void CanUpdateValuesMatchedByName() { var currentFlag1Value = Browser.FindElement(By.Id("flag-1")); var currentFlag2Value = Browser.FindElement(By.Id("flag-2")); WaitAssert.Equal("False", () => currentFlag1Value.Text); WaitAssert.Equal("False", () => currentFlag2Value.Text); // Observe that the correct cascading parameter updates Browser.FindElement(By.Id("toggle-flag-1")).Click(); WaitAssert.Equal("True", () => currentFlag1Value.Text); WaitAssert.Equal("False", () => currentFlag2Value.Text); Browser.FindElement(By.Id("toggle-flag-2")).Click(); WaitAssert.Equal("True", () => currentFlag1Value.Text); WaitAssert.Equal("True", () => currentFlag2Value.Text); // Didn't re-render unrelated descendants Assert.Equal("1", Browser.FindElement(By.Id("receive-by-interface-num-renders")).Text); }
public void InputComponentsCauseContainerToRerenderOnChange() { var appElement = MountTestComponent <TypicalValidationComponent>(); var ticketClassInput = new SelectElement(appElement.FindElement(By.ClassName("ticket-class")).FindElement(By.TagName("select"))); var selectedTicketClassDisplay = appElement.FindElement(By.Id("selected-ticket-class")); var messagesAccessor = CreateValidationMessagesAccessor(appElement); // Shows initial state WaitAssert.Equal("Economy", () => selectedTicketClassDisplay.Text); // Refreshes on edit ticketClassInput.SelectByValue("Premium"); WaitAssert.Equal("Premium", () => selectedTicketClassDisplay.Text); // Leaves previous value unchanged if new entry is unparseable ticketClassInput.SelectByText("(select)"); WaitAssert.Equal(new[] { "The TicketClass field is not valid." }, messagesAccessor); WaitAssert.Equal("Premium", () => selectedTicketClassDisplay.Text); }
public void CanBindCheckbox_InitiallyChecked() { var target = Browser.FindElement(By.Id("checkbox-initially-checked")); var boundValue = Browser.FindElement(By.Id("checkbox-initially-checked-value")); var invertButton = Browser.FindElement(By.Id("checkbox-initially-checked-invert")); Assert.True(target.Selected); Assert.Equal("True", boundValue.Text); // Modify target; verify value is updated target.Click(); WaitAssert.False(() => target.Selected); WaitAssert.Equal("False", () => boundValue.Text); // Modify data; verify checkbox is updated invertButton.Click(); WaitAssert.True(() => target.Selected); WaitAssert.Equal("True", () => boundValue.Text); }
public void CanBindSelect() { var target = new SelectElement(Browser.FindElement(By.Id("select-box"))); var boundValue = Browser.FindElement(By.Id("select-box-value")); Assert.Equal("Second choice", target.SelectedOption.Text); Assert.Equal("Second", boundValue.Text); // Modify target; verify value is updated target.SelectByText("Third choice"); WaitAssert.Equal("Third", () => boundValue.Text); // Also verify we can add and select new options atomically // Don't move this into a separate test, because then the previous assertions // would be dependent on test execution order (or would require a full page reload) Browser.FindElement(By.Id("select-box-add-option")).Click(); WaitAssert.Equal("Fourth", () => boundValue.Text); Assert.Equal("Fourth choice", target.SelectedOption.Text); }
public void CanUpdateFixedValuesMatchedByInterface() { var currentCount = Browser.FindElement(By.Id("current-count")); var decrementButton = Browser.FindElement(By.Id("decrement-count")); // We have the correct initial value WaitAssert.Equal("100", () => currentCount.Text); // Updates are propagated decrementButton.Click(); WaitAssert.Equal("99", () => currentCount.Text); decrementButton.Click(); WaitAssert.Equal("98", () => currentCount.Text); // Renders the descendant the same number of times we triggered // events on it, because we always re-render components after they // have an event Assert.Equal("3", Browser.FindElement(By.Id("receive-by-interface-num-renders")).Text); }
public void CanFollowLinkToPageWithParameters() { SetUrlViaPushState("/Other"); var app = MountTestComponent <TestRouter>(); app.FindElement(By.LinkText("With parameters")).Click(); WaitAssert.Equal("Your full name is Abc .", () => app.FindElement(By.Id("test-info")).Text); AssertHighlightedLinks("With parameters"); // Can add more parameters while remaining on same page app.FindElement(By.LinkText("With more parameters")).Click(); WaitAssert.Equal("Your full name is Abc McDef.", () => app.FindElement(By.Id("test-info")).Text); AssertHighlightedLinks("With parameters", "With more parameters"); // Can remove parameters while remaining on same page app.FindElement(By.LinkText("With parameters")).Click(); WaitAssert.Equal("Your full name is Abc .", () => app.FindElement(By.Id("test-info")).Text); AssertHighlightedLinks("With parameters"); }
public void MouseOverAndMouseOut_CanTrigger() { MountTestComponent <MouseEventComponent>(); var input = Browser.FindElement(By.Id("mouseover_input")); var output = Browser.FindElement(By.Id("output")); Assert.Equal(string.Empty, output.Text); var other = Browser.FindElement(By.Id("other")); // Mouse over the button and then back off var actions = new Actions(Browser) .MoveToElement(input) .MoveToElement(other); actions.Perform(); WaitAssert.Equal("onmouseover,onmouseout,", () => output.Text); }
public void InputDateInteractsWithEditContext_NullableDateTimeOffset() { var appElement = MountTestComponent <TypicalValidationComponent>(); var expiryDateInput = appElement.FindElement(By.ClassName("expiry-date")).FindElement(By.TagName("input")); var messagesAccessor = CreateValidationMessagesAccessor(appElement); // Validates on edit WaitAssert.Equal("valid", () => expiryDateInput.GetAttribute("class")); expiryDateInput.SendKeys("01/01/2000\t"); WaitAssert.Equal("modified valid", () => expiryDateInput.GetAttribute("class")); // Can become invalid expiryDateInput.SendKeys("111111111"); WaitAssert.Equal("modified invalid", () => expiryDateInput.GetAttribute("class")); WaitAssert.Equal(new[] { "The OptionalExpiryDate field must be a date." }, messagesAccessor); // Empty is valid, because it's nullable expiryDateInput.SendKeys($"{Keys.Backspace}\t{Keys.Backspace}\t{Keys.Backspace}\t"); WaitAssert.Equal("modified valid", () => expiryDateInput.GetAttribute("class")); WaitAssert.Empty(messagesAccessor); }
public void CanSelectNullableGuid_InitiallyBlank() { var paragraph = Browser.FindElement(By.Id("select-nullable-guid-initially-blank")); var select = new SelectElement(paragraph.FindElement(By.TagName("select"))); var result = paragraph.FindElement(By.Id("select-nullable-guid-initially-blank-result")); WaitAssert.Equal(string.Empty, () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal(string.Empty, () => result.Text); select.SelectByIndex(1); WaitAssert.Equal("413a7c18-b190-4f58-a967-338cd1566e97", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("413a7c18-b190-4f58-a967-338cd1566e97", () => result.Text); select.SelectByValue("00cd0391-5e22-4729-855a-fec86267722c"); WaitAssert.Equal("00cd0391-5e22-4729-855a-fec86267722c", () => select.SelectedOption.GetAttribute("value")); //WaitAssert.Equal( "00cd0391-5e22-4729-855a-fec86267722c", () => result.Text ); //select.SelectByValue( "" ); //WaitAssert.Equal( "0", select.SelectedOption.GetAttribute( "value" ) ); //WaitAssert.Equal( "0", result.Text ); }
public void CanSelectString_InitiallyBlank() { var paragraph = Browser.FindElement(By.Id("select-string-initially-blank")); var select = new SelectElement(paragraph.FindElement(By.TagName("select"))); var result = paragraph.FindElement(By.Id("select-string-initially-blank-result")); WaitAssert.Equal(string.Empty, () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal(string.Empty, () => result.Text); select.SelectByIndex(1); WaitAssert.Equal("Oliver", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("Oliver", () => result.Text); select.SelectByValue("Harry"); WaitAssert.Equal("Harry", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("Harry", () => result.Text); select.SelectByIndex(0); WaitAssert.Equal(string.Empty, () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal(string.Empty, () => result.Text); }
public void CanSelectNullableEnum_InitiallyBlank() { var paragraph = Browser.FindElement(By.Id("select-nullable-enum-initially-blank")); var select = new SelectElement(paragraph.FindElement(By.TagName("select"))); var result = paragraph.FindElement(By.Id("select-nullable-enum-initially-blank-result")); WaitAssert.Equal(string.Empty, () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal(string.Empty, () => result.Text); select.SelectByIndex(1); WaitAssert.Equal("Mon", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("Mon", () => result.Text); select.SelectByValue("Fri"); WaitAssert.Equal("Fri", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("Fri", () => result.Text); select.SelectByIndex(0); WaitAssert.Equal(string.Empty, () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal(string.Empty, () => result.Text); }
public void CanSelectEnum_InitiallySelected() { var paragraph = Browser.FindElement(By.Id("select-enum-initially-selected")); var select = new SelectElement(paragraph.FindElement(By.TagName("select"))); var result = paragraph.FindElement(By.Id("select-enum-initially-selected-result")); WaitAssert.Equal("Mon", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("Mon", () => result.Text); select.SelectByIndex(1); WaitAssert.Equal("Tue", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("Tue", () => result.Text); select.SelectByIndex(2); WaitAssert.Equal("Wen", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("Wen", () => result.Text); select.SelectByIndex(0); WaitAssert.Equal("Mon", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("Mon", () => result.Text); }
public void CanSelectInt_InitiallyBlank() { var paragraph = Browser.FindElement(By.Id("select-int-initially-blank")); var select = new SelectElement(paragraph.FindElement(By.TagName("select"))); var result = paragraph.FindElement(By.Id("select-int-initially-blank-result")); WaitAssert.Equal("0", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("0", () => result.Text); select.SelectByIndex(1); WaitAssert.Equal("1", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("1", () => result.Text); select.SelectByValue("2"); WaitAssert.Equal("2", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("2", () => result.Text); select.SelectByValue("0"); WaitAssert.Equal("0", () => select.SelectedOption.GetAttribute("value")); WaitAssert.Equal("0", () => result.Text); }
public void HasCounterPage() { // Navigate to "Counter" Browser.FindElement(By.LinkText("Counter")).Click(); WaitAssert.Equal("Counter", () => Browser.FindElement(By.TagName("h1")).Text); // Observe the initial value is zero var countDisplayElement = Browser.FindElement(By.CssSelector("h1 + p")); Assert.Equal("Current count: 0", countDisplayElement.Text); // Click the button; see it counts var button = Browser.FindElement(By.CssSelector(".main button")); button.Click(); WaitAssert.Equal("Current count: 1", () => countDisplayElement.Text); button.Click(); WaitAssert.Equal("Current count: 2", () => countDisplayElement.Text); button.Click(); WaitAssert.Equal("Current count: 3", () => countDisplayElement.Text); }
public void InputNumberInteractsWithEditContext_NullableFloat() { var appElement = MountTestComponent <TypicalValidationComponent>(); var heightInput = appElement.FindElement(By.ClassName("height")).FindElement(By.TagName("input")); var messagesAccessor = CreateValidationMessagesAccessor(appElement); // Validates on edit WaitAssert.Equal("valid", () => heightInput.GetAttribute("class")); heightInput.SendKeys("123.456\t"); WaitAssert.Equal("modified valid", () => heightInput.GetAttribute("class")); // Can become invalid heightInput.SendKeys("e100\t"); WaitAssert.Equal("modified invalid", () => heightInput.GetAttribute("class")); WaitAssert.Equal(new[] { "The OptionalHeight field must be a number." }, messagesAccessor); // Empty is valid, because it's a nullable float heightInput.Clear(); heightInput.SendKeys("\t"); WaitAssert.Equal("modified valid", () => heightInput.GetAttribute("class")); WaitAssert.Empty(messagesAccessor); }
public void FocusEvents_CanTrigger() { MountTestComponent <FocusEventComponent>(); var input = Browser.FindElement(By.Id("input")); var output = Browser.FindElement(By.Id("output")); Assert.Equal(string.Empty, output.Text); // Focus the target, verify onfocusin is fired input.Click(); WaitAssert.Equal("onfocus,onfocusin,", () => output.Text); // Focus something else, verify onfocusout is also fired var other = Browser.FindElement(By.Id("other")); other.Click(); WaitAssert.Equal("onfocus,onfocusin,onblur,onfocusout,", () => output.Text); }
public void InputTextAreaInteractsWithEditContext() { var appElement = MountTestComponent <TypicalValidationComponent>(); var descriptionInput = appElement.FindElement(By.ClassName("description")).FindElement(By.TagName("textarea")); var messagesAccessor = CreateValidationMessagesAccessor(appElement); // Validates on edit WaitAssert.Equal("valid", () => descriptionInput.GetAttribute("class")); descriptionInput.SendKeys("Hello\t"); WaitAssert.Equal("modified valid", () => descriptionInput.GetAttribute("class")); // Can become invalid descriptionInput.SendKeys("too long too long too long too long too long\t"); WaitAssert.Equal("modified invalid", () => descriptionInput.GetAttribute("class")); WaitAssert.Equal(new[] { "Description is max 20 chars" }, messagesAccessor); // Can become valid descriptionInput.Clear(); descriptionInput.SendKeys("Hello\t"); WaitAssert.Equal("modified valid", () => descriptionInput.GetAttribute("class")); WaitAssert.Empty(messagesAccessor); }
public void InputTextInteractsWithEditContext() { var appElement = MountTestComponent <TypicalValidationComponent>(); var nameInput = appElement.FindElement(By.ClassName("name")).FindElement(By.TagName("input")); var messagesAccessor = CreateValidationMessagesAccessor(appElement); // Validates on edit WaitAssert.Equal("valid", () => nameInput.GetAttribute("class")); nameInput.SendKeys("Bert\t"); WaitAssert.Equal("modified valid", () => nameInput.GetAttribute("class")); // Can become invalid nameInput.SendKeys("01234567890123456789\t"); WaitAssert.Equal("modified invalid", () => nameInput.GetAttribute("class")); WaitAssert.Equal(new[] { "That name is too long" }, messagesAccessor); // Can become valid nameInput.Clear(); nameInput.SendKeys("Bert\t"); WaitAssert.Equal("modified valid", () => nameInput.GetAttribute("class")); WaitAssert.Empty(messagesAccessor); }
private void TestBasicNavigation() { // Give components.server enough time to load so that it can replace // the prerendered content before we start making assertions. Thread.Sleep(5000); Browser.WaitForElement("ul"); // <title> element gets project ID injected into it during template execution Assert.Contains(Project.ProjectGuid, Browser.Title); // Initially displays the home page Assert.Equal("Hello, world!", Browser.GetText("h1")); // Can navigate to the counter page Browser.Click(By.PartialLinkText("Counter")); Browser.WaitForUrl("counter"); Browser.WaitForText("h1", "Counter"); // Clicking the counter button works var counterComponent = Browser.FindElement("h1").Parent(); var counterDisplay = Browser.FindElement("h1 + p"); Assert.Equal("Current count: 0", counterDisplay.Text); Browser.Click(counterComponent, "button"); WaitAssert.Equal("Current count: 1", () => Browser.FindElement("h1+p").Text); // Can navigate to the 'fetch data' page Browser.Click(By.PartialLinkText("Fetch data")); Browser.WaitForUrl("fetchdata"); Browser.WaitForText("h1", "Weather forecast"); // Asynchronously loads and displays the table of weather forecasts var fetchDataComponent = Browser.FindElement("h1").Parent(); Browser.WaitForElement("table>tbody>tr"); var table = Browser.FindElement(fetchDataComponent, "table", timeoutSeconds: 5); Assert.Equal(5, table.FindElements(By.CssSelector("tbody tr")).Count); }
public void CanBindTextbox_InitiallyPopulated() { var target = Browser.FindElement(By.Id("textbox-initially-populated")); var boundValue = Browser.FindElement(By.Id("textbox-initially-populated-value")); var mirrorValue = Browser.FindElement(By.Id("textbox-initially-populated-mirror")); var setNullButton = Browser.FindElement(By.Id("textbox-initially-populated-setnull")); Assert.Equal("Hello", target.GetAttribute("value")); Assert.Equal("Hello", boundValue.Text); Assert.Equal("Hello", mirrorValue.GetAttribute("value")); // Modify target; verify value is updated and that textboxes linked to the same data are updated target.Clear(); target.SendKeys("Changed value\t"); WaitAssert.Equal("Changed value", () => boundValue.Text); Assert.Equal("Changed value", mirrorValue.GetAttribute("value")); // Remove the value altogether setNullButton.Click(); WaitAssert.Equal(string.Empty, () => target.GetAttribute("value")); Assert.Equal(string.Empty, boundValue.Text); Assert.Equal(string.Empty, mirrorValue.GetAttribute("value")); }
public void CanCheckString_InitiallyChecked() { var paragraph = Browser.FindElement(By.Id("radiogroup-event-initially-selected")); var radioR = paragraph.FindElement(By.ClassName("radioR")); var radioG = paragraph.FindElement(By.ClassName("radioG")); var radioB = paragraph.FindElement(By.ClassName("radioB")); var result = paragraph.FindElement(By.Id("radiogroup-event-initially-selected-result")); WaitAssert.Equal("true", () => radioG.GetAttribute("checked")); WaitAssert.Equal("green", () => result.Text); WaitAssert.Equal(null, () => radioR.GetAttribute("checked")); WaitAssert.Equal(null, () => radioB.GetAttribute("checked")); radioR.Click(); WaitAssert.Equal(null, () => radioG.GetAttribute("checked")); WaitAssert.Equal("true", () => radioR.GetAttribute("checked")); WaitAssert.Equal("red", () => result.Text); radioB.Click(); WaitAssert.Equal(null, () => radioR.GetAttribute("checked")); WaitAssert.Equal("true", () => radioB.GetAttribute("checked")); WaitAssert.Equal("blue", () => result.Text); }
public void MouseDownAndMouseUp_CanTrigger() { MountTestComponent <MouseEventComponent>(); var input = Browser.FindElement(By.Id("mousedown_input")); var output = Browser.FindElement(By.Id("output")); Assert.Equal(string.Empty, output.Text); var other = Browser.FindElement(By.Id("other")); // Mousedown var actions = new Actions(Browser).ClickAndHold(input); actions.Perform(); WaitAssert.Equal("onmousedown,", () => output.Text); actions = new Actions(Browser).Release(input); actions.Perform(); WaitAssert.Equal("onmousedown,onmouseup,", () => output.Text); }
public void HasFetchDataPage() { // Navigate to "Fetch Data" Browser.FindElement(By.LinkText("Fetch data")).Click(); WaitAssert.Equal("Weather forecast", () => Browser.FindElement(By.TagName("h1")).Text); // Wait until loaded var tableSelector = By.CssSelector("table.table"); new WebDriverWait(Browser, TimeSpan.FromSeconds(10)).Until( driver => driver.FindElement(tableSelector) != null); // Check the table is displayed correctly var rows = Browser.FindElements(By.CssSelector("table.table tbody tr")); Assert.Equal(5, rows.Count); var cells = rows.SelectMany(row => row.FindElements(By.TagName("td"))); foreach (var cell in cells) { Assert.True(!string.IsNullOrEmpty(cell.Text)); } }