private void SetFirst(string number) { var first = _ngDriver.FindElement(NgBy.Input("first")); first.Clear(); first.SendKeys(number); }
private void SetSecond(string number) { var second = _ngDriver.FindElement(NgBy.Input("second")); second.Clear(); second.SendKeys(number); }
public void ShouldFilter() { // Fake backend with 2 phones NgMockE2EModule mockModule = new NgMockE2EModule(@" $httpBackend.whenGET('phones/phones.json').respond( [ { age: 12, carrier: 'AT&T', id: 'motorola-bravo-with-motoblur', imageUrl: 'img/phones/motorola-bravo-with-motoblur.0.jpg', name: 'MOTOROLA BRAVO\u2122 with MOTOBLUR\u2122', snippet: 'An experience to cheer about.' }, { age: 13, carrier: 'T-Mobile', id: 'motorola-defy-with-motoblur', imageUrl: 'img/phones/motorola-defy-with-motoblur.0.jpg', name: 'Motorola DEFY\u2122 with MOTOBLUR\u2122', snippet: 'Are you ready for everything life throws your way?' }, ] ); "); IWebDriver ngDriver = new NgWebDriver(driver, mockModule); ngDriver.Navigate().GoToUrl("http://angular.github.io/angular-phonecat/step-5/app/"); Assert.AreEqual(2, ngDriver.FindElements(NgBy.Repeater("phone in phones")).Count); ngDriver.FindElement(NgBy.Input("query")).SendKeys("bravo"); Assert.AreEqual(1, ngDriver.FindElements(NgBy.Repeater("phone in phones")).Count); ngDriver.FindElement(NgBy.Input("query")).SendKeys("!"); Assert.AreEqual(0, ngDriver.FindElements(NgBy.Repeater("phone in phones")).Count); }
public void ShouldAdd() { StringAssert.AreEqualIgnoringCase(ngDriver.Title, "Super Calculator"); var ng_first_operand = ngDriver.FindElement(NgBy.Model("first")); ng_first_operand.SendKeys("1"); NgWebElement ng_second_operand = ngDriver.FindElement(NgBy.Input("second")); ng_second_operand.SendKeys("2"); NgWebElement ng_math_operator_element = ngDriver.FindElement(NgBy.Options("value for (key, value) in operators")); Assert.AreEqual(ng_math_operator_element.Text, "+"); IWebElement math_operator_element = ngDriver.FindElement(NgBy.SelectedOption("operator")); Assert.AreEqual(math_operator_element.Text, "+"); IWebElement go_button_element = ngDriver.FindElement(NgBy.PartialButtonText("Go")); Assert.IsTrue(go_button_element.Displayed); var ng_go_button_element = ngDriver.FindElement(By.Id("gobutton")); ng_go_button_element.Click(); NgWebElement result_element = ngDriver.FindElement(NgBy.Binding("latest")); Assert.AreEqual("3", result_element.Text); highlight(result_element, 1000); }
public TutorialStep5Page SearchFor(string query) { var q = ngDriver.FindElement(NgBy.Input("query")); q.Clear(); q.SendKeys(query); return(this); }
public CustomersPage Filter(string text) { var filterElement = ngDriver.FindElement(NgBy.Input("searchText")); filterElement.Clear(); filterElement.SendKeys(text); return(this); }
public void ShouldGreetUsingBinding() { IWebDriver ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://www.angularjs.org"); ngDriver.FindElement(NgBy.Input("yourName")).SendKeys("Julie"); Assert.AreEqual("Hello Julie!", ngDriver.FindElement(NgBy.Binding("yourName")).Text); }
public void PopulateProjectNameWithSpecialChar(IWebDriver driverInstance) { IWebElement input = driverInstance.FindElement(NgBy.Input("ProjectWizardController.project.name")); input.Clear(); input.SendKeys("##TEST##"); driverInstance.FindElement(By.Id("txtDescription")).Click(); }
public void PopulateEmptyProjectName(IWebDriver driverInstance) { IWebElement input = driverInstance.FindElement(NgBy.Input("ProjectWizardController.project.name")); input.Clear(); //input.SendKeys("1"); driverInstance.FindElement(By.Id("txtDescription")).Click(); }
public void PopulateValidProjectSettings(IWebDriver driverInstance) { IWebElement input = driverInstance.FindElement(NgBy.Input("ProjectWizardController.project.name")); IWebElement textarea = driverInstance.FindElement(By.Id("txtDescription")); ICollection <IWebElement> radioGroup = driverInstance.FindElements(NgBy.Input("ProjectWizardController.project.docSource")); IWebElement checkbox = driverInstance.FindElement(By.Id("checkboxes-0")); input.Clear(); input.SendKeys("TestProject"); textarea.Clear(); textarea.SendKeys("Sample_Description_Text1#"); radioGroup.ElementAt(0).Click(); }
public void Basic_AddOneAndTwo_ShouldBeThree() { ngDriver.Url = URL; var first = ngDriver.FindElement(NgBy.Input("first")); var second = ngDriver.FindElement(NgBy.Input("second")); var goButton = ngDriver.FindElement(By.Id("gobutton")); first.SendKeys("1"); second.SendKeys("2"); goButton.Click(); var latestResult = ngDriver.FindElement(NgBy.Binding("latest")).Text; latestResult.Should().Be("3"); }
public void ShouldSubstract() { #pragma warning disable 618 var first = ngDriver.FindElement(NgBy.Input("first")); #pragma warning restore 618 first.SendKeys("10"); #pragma warning disable 618 var second = ngDriver.FindElement(NgBy.Input("second")); #pragma warning restore 618 second.SendKeys("2"); ReadOnlyCollection <NgWebElement> ng_math_operators = ngDriver.FindElements(NgBy.Options("value for (key, value) in operators")); NgWebElement ng_substract_math_operator = ng_math_operators.First(op => op.Text.Equals("-", StringComparison.Ordinal)); Assert.IsNotNull(ng_substract_math_operator); ng_substract_math_operator.Click(); var goButton = ngDriver.FindElement(By.Id("gobutton")); goButton.Click(); NgWebElement result_element = ngDriver.FindElement(NgBy.Binding("latest")); Assert.AreEqual("8", result_element.Text); ngDriver.Highlight(result_element, 1000); }
public void ShouldLoginCustomer() { NgWebElement ng_customer_button = ngDriver.FindElement(NgBy.ButtonText("Customer Login")); StringAssert.IsMatch("Customer Login", ng_customer_button.Text); ngDriver.Highlight(ng_customer_button, highlight_timeout); // core Selenium IWebElement customer_button = driver.FindElement(By.XPath("//button[contains(.,'Customer Login')]")); StringAssert.IsMatch("Customer Login", customer_button.Text); ngDriver.Highlight(customer_button, highlight_timeout); ng_customer_button.Click(); #pragma warning disable 618 NgWebElement ng_customer_select = ngDriver.FindElement(NgBy.Input("custId")); #pragma warning restore 618 StringAssert.IsMatch("userSelect", ng_customer_select.GetAttribute("id")); ReadOnlyCollection <NgWebElement> ng_customers = ng_customer_select.FindElements(NgBy.Repeater("cust in Customers")); Assert.AreNotEqual(0, ng_customers.Count); // won't move to or highlight select options foreach (NgWebElement ng_customer in ng_customers) { actions.MoveToElement(ng_customer); ngDriver.Highlight(ng_customer); } // pick first customer NgWebElement first_customer = ng_customers.First(); Assert.IsTrue(first_customer.Displayed); // the {{user}} is composed from first and last name StringAssert.IsMatch("(?:[^ ]+) +(?:[^ ]+)", first_customer.Text); string user = first_customer.Text; first_customer.Click(); // login button NgWebElement ng_login_button = ngDriver.FindElement(NgBy.ButtonText("Login")); Assert.IsTrue(ng_login_button.Displayed && ng_login_button.Enabled); ngDriver.Highlight(ng_login_button, highlight_timeout); ng_login_button.Click(); NgWebElement ng_greeting = ngDriver.FindElement(NgBy.Binding("user")); Assert.IsNotNull(ng_greeting); StringAssert.IsMatch(user, ng_greeting.Text); ngDriver.Highlight(ng_greeting, highlight_timeout); NgWebElement ng_account_number = ngDriver.FindElement(NgBy.Binding("accountNo")); Assert.IsNotNull(ng_account_number); theReg = new Regex(@"(?<account_id>\d+)$"); Assert.IsTrue(theReg.IsMatch(ng_account_number.Text)); ngDriver.Highlight(ng_account_number, highlight_timeout); NgWebElement ng_account_balance = ngDriver.FindElement(NgBy.Binding("amount")); Assert.IsNotNull(ng_account_balance); theReg = new Regex(@"(?<account_balance>\d+)$"); Assert.IsTrue(theReg.IsMatch(ng_account_balance.Text)); ngDriver.Highlight(ng_account_balance, highlight_timeout); NgWebElement ng_account_currency = ngDriver.FindElement(NgBy.Binding("currency")); Assert.IsNotNull(ng_account_currency); theReg = new Regex(@"(?<account_currency>(?:Dollar|Pound|Rupee))$"); Assert.IsTrue(theReg.IsMatch(ng_account_currency.Text)); ngDriver.Highlight(ng_account_currency, highlight_timeout); NgWebElement ng_logout_botton = ngDriver.FindElement(NgBy.ButtonText("Logout")); ngDriver.Highlight(ng_logout_botton, highlight_timeout); ng_logout_botton.Click(); }