public void Customers_View_ByDefault() { IWebDriver ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://localhost:58918/"); Assert.IsTrue(ngDriver.Url.EndsWith("#/customers")); }
public void DeleteCustomerOnCardView() { NgMockE2EModule mockModule = new NgMockE2EModule(@" $httpBackend.whenGET(/^\/app\/partials\//).passThrough(); $httpBackend.whenGET(/^\/app\/views\//).passThrough(); $httpBackend.whenGET('\/api/dataservice/customersSummary?$top=10&$skip=0').respond( // status 200, // body [ { id:1, firstName:'Marcus', lastName:'HighTower', city:'Phoenix', state: { id:1, abbreviation:'AZ', name:' Arizona' }, orderCount:6, gender:'Male' }, { id:2, firstName:'Dan', lastName:'Wahlin', city:'Chandler', state:{ id:1, abbreviation:'AZ', name:' Arizona' }, orderCount:5, gender:'Male' } ], // headers { 'X-InlineCount': 2 } );" ); var ngDriver = new NgWebDriver(driver, mockModule); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); var customersPage = new CustomersPage(ngDriver); Assert.AreEqual(2, customersPage.GetCustomersCount()); Assert.AreEqual("Showing 2 of 2 total customers", customersPage.GetFooterText()); // Delete Dan (sorry...) customersPage.DeleteCustomer(2).ConfirmDelete(); Assert.AreEqual(1, customersPage.GetCustomersCount()); Assert.AreEqual("Showing 1 of 1 total customers", customersPage.GetFooterText()); // Fail! }
public void CustomersViewByDefault() { IWebDriver ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://localhost:58000/"); // Assert default view is 'customers' Assert.IsTrue(ngDriver.Url.EndsWith("#/customers")); }
public void CardViewByDefault() { var ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); var customersPage = new CustomersPage(ngDriver); Assert.IsTrue(customersPage.IsCardViewSelected()); }
public void CardViewByDefault() { IWebDriver ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); // Assert 'card view' is selected Assert.IsTrue(ngDriver.FindElement(By.ClassName("cardContainer")).Displayed); Assert.IsFalse(ngDriver.FindElement(By.ClassName("gridContainer")).Displayed); }
public void PeopleTitle() { using (IWebDriver wdriver = new NgWebDriver(new ChromeDriver(@"dependencies"))) { wdriver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(5)); wdriver.Navigate().GoToUrl(baseUrl + "people"); Assert.AreEqual(wdriver.Title, "ui.core: people"); wdriver.Quit(); } }
public void ShowTop10Customers() { IWebDriver ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); IWebElement cardElement = ngDriver.FindElement(By.ClassName("cardContainer")); var customers = cardElement.FindElements(NgBy.Repeater("customer in filteredCustomers")); Assert.AreEqual(10, customers.Count); IWebElement footer = ngDriver.FindElement(NgBy.Binding("totalRecords")); Assert.AreEqual("Showing 10 of 23 total customers", footer.Text); }
public void Switch_to_List_view() { IWebDriver ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://localhost:58918/#/customers"); IWebElement listViewMenu = ngDriver.FindElement(By.XPath("//ul//li[contains(.,'List View')]")); Assert.IsFalse(listViewMenu.GetAttribute("class").Contains("active")); listViewMenu.Click(); Assert.IsFalse(ngDriver.FindElement(By.ClassName("cardContainer")).Displayed); Assert.IsTrue(ngDriver.FindElement(By.ClassName("gridContainer")).Displayed); Assert.IsTrue(listViewMenu.GetAttribute("class").Contains("active")); }
public void SwitchToListView() { var ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); var customersPage = new CustomersPage(ngDriver); customersPage.SwitchToListView(); Assert.IsTrue(customersPage.IsListViewSelected()); }
public void ShowTop10Customers() { var ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); var customersPage = new CustomersPage(ngDriver); Assert.AreEqual(10, customersPage.GetCustomersCount()); IWebElement footer = ngDriver.FindElement(NgBy.Binding("totalRecords")); Assert.AreEqual("Showing 10 of 23 total customers", footer.Text); }
public void ShowCustomerOrders() { var ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); var customerOrdersPage = new CustomersPage(ngDriver).GoToCustomerOrders(2); Assert.AreEqual("Dan Wahlin", customerOrdersPage.GetCustomerName()); Assert.AreEqual(5, customerOrdersPage.GetOrdersCount()); }
public void ShouldFilter() { var ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); var customersPage = new CustomersPage(ngDriver); Assert.AreEqual(4, customersPage.Filter("Wahlin").GetCustomersCount()); // Fail! }
//ngDriver setup public PackagesPageObjects(IWebDriver driver, string url) { ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl(url); }
public void NoCustomersOnCardView() { NgMockE2EModule mockModule = new NgMockE2EModule(@" $httpBackend.whenGET(/^\/app\/partials\//).passThrough(); $httpBackend.whenGET(/^\/app\/views\//).passThrough(); $httpBackend.whenGET('\/api/dataservice/customersSummary?$top=10&$skip=0').respond( // status 200, // body [], // headers { 'X-InlineCount': 0 } );" ); var ngDriver = new NgWebDriver(driver, mockModule); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); var cardElement = ngDriver.FindElement(By.ClassName("cardContainer")); Assert.AreEqual(0, cardElement.FindElements(NgBy.Repeater("customer in filteredCustomers")).Count); Assert.IsTrue(ngDriver.FindElement(By.XPath("//h4[contains(.,'No customers found')]")).Displayed); }
//ngDriver setup public DataProvidersPageObjects(IWebDriver driver, string url) { ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl(url); }
public void NoCustomersOnCardView() { NgMockE2EModule mockModule = new NgMockE2EModule(@" $httpBackend.whenGET(/^\/app\/partials\//).passThrough(); $httpBackend.whenGET(/^\/app\/views\//).passThrough(); $httpBackend.whenGET('\/api/dataservice/customersSummary?$top=10&$skip=0').respond( // status 200, // body [], // headers { 'X-InlineCount': 0 } );" ); var ngDriver = new NgWebDriver(driver, mockModule); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); var customersPage = new CustomersPage(ngDriver); Assert.AreEqual(0, customersPage.GetCustomersCount()); Assert.AreEqual("No customers found", customersPage.GetFooterText()); }
public void DeleteCustomerOnCardView() { NgMockE2EModule mockModule = new NgMockE2EModule(@" $httpBackend.whenGET(/^\/app\/partials\//).passThrough(); $httpBackend.whenGET(/^\/app\/views\//).passThrough(); $httpBackend.whenGET('\/api/dataservice/customersSummary?$top=10&$skip=0').respond( // status 200, // body [ { id:1, firstName:'Marcus', lastName:'HighTower', city:'Phoenix', state: { id:1, abbreviation:'AZ', name:' Arizona' }, orderCount:6, gender:'Male' }, { id:2, firstName:'Dan', lastName:'Wahlin', city:'Chandler', state:{ id:1, abbreviation:'AZ', name:' Arizona' }, orderCount:5, gender:'Male' } ], // headers { 'X-InlineCount': 2 } );" ); var ngDriver = new NgWebDriver(driver, mockModule); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); var cardElement = ngDriver.FindElement(By.ClassName("cardContainer")); var footer = ngDriver.FindElement(NgBy.Binding("totalRecords")); Assert.AreEqual("Showing 2 of 2 total customers", footer.Text); var customers = cardElement.FindElements(NgBy.Repeater("customer in filteredCustomers")); Assert.AreEqual(2, customers.Count); // Delete Dan (sorry...) foreach (var customer in customers) { if ((long)customer.Evaluate("customer.id") == 2) { // Close card customer.FindElement(By.ClassName("cardClose")).Click(); // Popup to confirm ngDriver.FindElement(By.XPath("//button[contains(.,'Delete Customer')]")).Click(); break; } } Assert.AreEqual(1, cardElement.FindElements(NgBy.Repeater("customer in filteredCustomers")).Count); Assert.AreEqual("Showing 1 of 1 total customers", footer.Text); // Fail! }