public TutorialStep5Page(IWebDriver driver, string url) { ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl(url); }
public void ShouldWaitForAngular() { ngDriver.Navigate().GoToUrl(base_url); IWebElement element = ngDriver.FindElement(NgBy.Model("yourName")); Assert.IsTrue(((NgWebElement)element).Displayed); }
public void ShouldSetLocation() { String loc = "misc/faq"; NgNavigation nav = new NgNavigation(ngDriver, ngDriver.Navigate()); nav.SetLocation(null, loc); Assert.IsTrue(ngDriver.Url.ToString().Contains(loc)); }
public void CarlaLoginWorkerNoTerms() { // load the dashboard page string test_start = configuration["test_start_worker"]; ngDriver.Navigate().GoToUrl($"{baseUri}{test_start}"); ngDriver.WaitForAngular(); }
public void Test1() { By by = By.CssSelector("a[ng-bind-html='caseName']"); var casesCount = driver.FindElements(by).Count; for (int i = 0; i < casesCount; i++) { var caseElement = driver.FindElements(by)[i]; var caseName = caseElement.Text; caseElement.Click(); waitForPage(); takeScreenShot(caseName); log.Info("****Case Name : " + caseName); if (driver.FindElements(By.Id("iframeContent")).Count > 0) { driver.SwitchTo().Frame("iframeContent"); var links = _driver.FindElements(By.CssSelector("#page a")); foreach (var link in links) { log.Info("Link Text[" + link.Text + "] HREF[" + link.GetAttribute("href") + "]"); } driver.SwitchTo().DefaultContent(); } driver.Navigate().GoToUrl(urlBase); } }
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 SetUp() { // driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(5)); // Using NuGet Package 'WebDriver.ChromeDriver.win32' if (headless) { var option = new ChromeOptions(); option.AddArgument("--headless"); driver = new ChromeDriver(option); } else { driver = new ChromeDriver(); } // Using Internet Explorer //var options = new InternetExplorerOptions() { IntroduceInstabilityByIgnoringProtectedModeSettings = true }; //driver = new InternetExplorerDriver(options); // Using Microsoft Edge //driver = new EdgeDriver(); // Required for TestForAngular and WaitForAngular scripts driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(5); // driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(5)); ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl(base_url); }
public void TestAjApps() { ngWebDriver.Navigate().GoToUrl("https://hello-angularjs.appspot.com/sorttablecolumn"); NgWebElement element = ngWebDriver.FindElement(NgBy.Model("searchKeyword")); element.SendKeys("Angular"); }
public TutorialStep5Page(IWebDriver driver, string url) { ngDriver = new NgWebDriver(driver); PageFactory.InitElements(ngDriver, this); 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); }
public TutorialStep7Page(IWebDriver driver, string url) { ngDriver = new NgWebDriver(driver); PageFactory.InitElements(ngDriver, this); ngDriver.Navigate().GoToUrl(url); }
public void ShouldGreetUsingBinding() { IWebDriver ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl(base_url ); ngDriver.FindElement(NgBy.Model("yourName")).SendKeys("Julie"); Assert.AreEqual("Hello Julie!", ngDriver.FindElement(NgBy.Binding("yourName")).Text); }
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.Model("query")).SendKeys("bravo"); Assert.AreEqual(1, ngDriver.FindElements(NgBy.Repeater("phone in phones")).Count); ngDriver.FindElement(NgBy.Model("query")).SendKeys("!"); Assert.AreEqual(0, ngDriver.FindElements(NgBy.Repeater("phone in phones")).Count); }
public void IntialiseDriverAndLaunchUrl() { webDriver = new FirefoxDriver(); ngWebDriver = new NgWebDriver(webDriver); scriptLoadTime = webDriver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(5)); ngWebDriver.Navigate().GoToUrl(baseUrl); }
public void SetUp() { // driver = new PhantomJSDriver(); driver = new FirefoxDriver(); driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(5)); ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl(base_url); }
public void ShouldListTodos() { ngDriver.Navigate().GoToUrl("http://www.angularjs.org"); var elements = ngDriver.FindElements(NgBy.Repeater("todo in todoList.todos")); Assert.AreEqual("build an angular app", elements[1].Text); Assert.AreEqual(false, elements[1].Evaluate("todo.done")); }
public void ShouldGreetUsingBinding() { IWebDriver ngDriver = new NgWebDriver(_driver); ngDriver.Navigate().GoToUrl("http://www.angularjs.org"); ngDriver.FindElement(NgBy.Model("yourName")).SendKeys("Julie"); Assert.AreEqual("Hello Julie!", ngDriver.FindElement(NgBy.Binding("yourName")).Text); }
public void ShouldListTodos() { var ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://www.angularjs.org"); var elements = ngDriver.FindElements(NgBy.Repeater("todo in todoList.todos")); Assert.AreEqual("build an angular app", elements[1].Text); Assert.AreEqual(false, elements[1].Evaluate("todo.done")); }
public void ShouldGreetUsingBinding() { var ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl(base_url); ngDriver.FindElement(NgBy.Model("yourName")).SendKeys("Julie"); Assert.AreEqual("Hello Julie!", ngDriver.FindElement(NgBy.Binding("yourName")).Text); }
public void Angular2Test() { var ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("https://material.angular.io/"); ngDriver.FindElement(By.XPath("//a[@routerlink='/guide/getting-started']")).Click(); Assert.AreEqual("https://material.angular.io/guide/getting-started", ngDriver.Url); }
public void SetUp() { driver = new ChromeDriver(); driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(5); // driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(5)); // driver.Manage().Window.Size = new System.Drawing.Size(700, 400); ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl(base_url); }
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 NonAngularPageShouldBeSupported() { Assert.DoesNotThrow(() => { var ngDriver = new NgWebDriver(driver); ngDriver.IgnoreSynchronization = true; ngDriver.Navigate().GoToUrl("http://www.google.com"); ngDriver.IgnoreSynchronization = false; }); }
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 BeforeScenario() { HookHelper.IgnoreManualTestingScenarios(); _ngDriver = HookHelper.GetDriver(Globals.DriverType.Chrome, false); _objectContainer.RegisterInstanceAs <NgWebDriver>(_ngDriver); _ngDriver.Navigate().GoToUrl("http://localhost:4200/"); }
public void ShouldListTodos() { var ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://www.angularjs.org"); var elements = ngDriver.FindElements(NgBy.Repeater("todo in todoList.todos")); Assert.AreEqual("build an AngularJS app", elements[1].Text.Trim()); Assert.AreEqual(false, elements[1].Evaluate("todo.done")); Thread.Sleep(5000); }
public void TestSetUp() { _driver = new ChromeDriver(); //Meet the trick here _ngWebDriver = new NgWebDriver(_driver, "[ng-app='docsApp']"); _ngWebDriver.Navigate().GoToUrl(Url); _ngWebDriver.Manage().Window.Maximize(); //The script timeout is almost essential since most of protractor mechanism are dependent of client side script. _ngWebDriver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(10)); }
public void SetUp() { driver = new FirefoxDriver(); // NOTE: SetScriptTimeout is obsolete driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(5); // driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(5)); // driver.Manage().Window.Size = new System.Drawing.Size(700, 400); ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl(base_url); wait = new WebDriverWait(driver, TimeSpan.FromSeconds(wait_seconds)); wait.PollingInterval = TimeSpan.FromMilliseconds(wait_poll_milliseconds); }
public void TestUserStartsWithCreateTableScript() { // Arrange driver.Navigate().GoToUrl(baseUrl); // Act TestEmptyCreateTableScript(); TestAddCreateTableScript(); TestEmptyCreateTableScript(); TestWrongCreateTableScript(); TestAddCreateTableScript(); // Assert }
public void ShouldGreetUsingBinding() { var ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://www.angularjs.org"); ngDriver.FindElement(NgBy.Model("yourName")).SendKeys("Rupesh"); Assert.AreEqual("Hello Rupesh!", ngDriver.FindElement(NgBy.Binding("yourName")).Text); //driver.Url = "http://www.angularjs.org"; //driver.FindElement(By.CssSelector("input.ng-valid.ng-touched.ng-dirty.ng-valid-parse.ng-empty")).SendKeys("Rupesh"); //NoSuchElementException }
public void ShouldCheckElementByModel() { var chromeDriver = new ChromeDriver(); var ngDriver = new NgWebDriver(chromeDriver); ngDriver.Navigate().GoToUrl("http://todomvc.com/examples/angularjs"); var element = ngDriver.FindElement(NgBy.Model("newTodo")); Assert.IsTrue(element.Displayed); ngDriver.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); }
protected static IWebDriver LaunchWebDriver(string url, TargetBrowser targetBrowser = TargetBrowser.InternetExplorer, int width = 1024, int height = 768) { IWebDriver browser = null; switch (targetBrowser) { case TargetBrowser.InternetExplorer: var ieOptions = new InternetExplorerOptions { IntroduceInstabilityByIgnoringProtectedModeSettings = true, EnsureCleanSession = true }; browser = new NgWebDriver(new InternetExplorerDriver(ieOptions)); break; case TargetBrowser.Edge: var edgeOptions = new EdgeOptions { PageLoadStrategy = EdgePageLoadStrategy.Eager }; browser = new NgWebDriver(new EdgeDriver(edgeOptions)); break; case TargetBrowser.Chrome: browser = new NgWebDriver(new ChromeDriver()); break; case TargetBrowser.Firefox: browser = new NgWebDriver(new FirefoxDriver()); break; case TargetBrowser.Safari: browser = new NgWebDriver(new SafariDriver()); break; default: throw new ArgumentException($"Unknown target browser type {targetBrowser}"); } browser.Manage().Window.Size = new Size(width, height); browser.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10)); browser.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(10)); browser.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10)); // Set script timeouts to 5 secs browser.Navigate().GoToUrl(url); return(browser); }
public void SwitchToListView() { IWebDriver ngDriver = new NgWebDriver(driver); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); IWebElement listViewMenu = ngDriver.FindElement(By.XPath("//ul//li[contains(.,'List View')]")); Assert.IsFalse(listViewMenu.GetAttribute("class").Contains("active")); listViewMenu.Click(); // Assert 'list view' is selected Assert.IsTrue(listViewMenu.GetAttribute("class").Contains("active")); Assert.IsFalse(ngDriver.FindElement(By.ClassName("cardContainer")).Displayed); Assert.IsTrue(ngDriver.FindElement(By.ClassName("gridContainer")).Displayed); }
public void CarlaLogin() { // load the dashboard page ngDriver.Navigate().GoToUrl($"{baseUri}"); NgWebElement butt = ngDriver.FindElement(By.XPath("(.//*[normalize-space(text()) and normalize-space(.)='OR'])[1]/following::strong[1]")); butt.Click(); IWebElement username = driver.FindElement(By.Id("user")); username.SendKeys(configuration["testUser1"]); IWebElement password = driver.FindElement(By.Id("password")); password.SendKeys(configuration["testPass1"]); IWebElement sub = driver.FindElement(By.Name("btnSubmit")); sub.Click(); }