예제 #1
0
 public MenuControl(Browser browser, IElement parent, IElementLocator locator)
     : base(browser, parent, locator)
 {
     this.TxtUserName = WebElement.Create(this.browser, this, ElementLocator.Create(By.Id, "userName"));
     this.TxtPassword = WebElement.Create(this.browser, this, ElementLocator.Create(By.Id, "password"));
     this.BtnLogin    = WebElement.CreateNavigation <Test000HomePage>(this.browser, this, ElementLocator.Create(By.Id, "login"));
 }
예제 #2
0
 public Test000HomePage()
     : base("Virtual Store - Home")
 {
     this.LblUserName = WebElement.Create(this, ElementLocator.Create(By.Id, "username"));
     this.BtnLogin    = WebElement.CreateNavigation <Test000HomePage>(this, ElementLocator.Create(By.Id, "login"));
     this.CtlMenu     = WebElement.CreateControl <MenuListItemControl>(this, ElementLocator.Create(By.Id, "menu"));
 }
예제 #3
0
        public void ShouldNotCrashIfElementNotAvailable()
        {
            var elStatusPage = Browser.Open <ElementStatusPage>();

            var unrealElement = WebElement.Create(null, ElementLocator.Create(By.Id, "doesNotExist"));

            Assert.IsFalse(unrealElement.IsAvailable);
        }
 public Test001CalculatorPage(Browser browser)
     : base(browser, "Calculator")
 {
     this.TxtOperand1 = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "operand1"));
     this.TxtOperand2 = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "operand2"));
     this.BtnAdd      = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "add"));
     this.TxtResult   = WebElement.CreateSelect(this.Browser, this, ElementLocator.Create(By.Id, "result"));
 }
예제 #5
0
        public void ShouldThrowExceptionWhenTestingEnabledAndElementNotPresent()
        {
            var elStatusPage  = Browser.Open <ElementStatusPage>();
            var unrealElement = WebElement.Create(null, ElementLocator.Create(By.Id, "doesNotExist"));

            Action checkDisplayed = () => { var displayed = unrealElement.IsEnabled; };

            checkDisplayed.Should().Throw <ElementNotFoundException>();
        }
예제 #6
0
 public Test000LoginPage(Browser browser)
     : base(browser, "Virtual Store - Login")
 {
     this.TxtUserName = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "userName"));
     this.TxtPassword = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "password"));
     this.BtnLogin    = WebElement.CreateNavigation <Test000HomePage>(this.Browser, this, ElementLocator.Create(By.Id, "login"));
     this.DdlCountry  = WebElement.CreateSelect(this.Browser, this, ElementLocator.Create(By.Id, "country"));
     this.DdlCity     = WebElement.CreateSelect(this.Browser, this, ElementLocator.Create(By.Id, "city"));
     this.CtlMenu     = WebElement.CreateControl <MenuListItemControl>(this.Browser, this, ElementLocator.Create(By.Id, "menu"));
 }
예제 #7
0
        public void ShouldHtml5DragAndDropSuccessfuly()
        {
            var hoverPage = Browser.Open <DndHtml5Page>();

            hoverPage.DivDraggable.DragAndDropTo(hoverPage.DivDropTarget);

            var droppedElement = WebElement.Create(null, ElementLocator.Create(By.CssSelector, "#div1>#drag1"));

            Wait.NoMoreThan(TimeSpan.FromSeconds(2)).Until(() => droppedElement.IsAvailable);

            droppedElement.IsAvailable.Should().BeTrue();
        }
예제 #8
0
        public void ShouldWaitForElementToBecomeVisible()
        {
            var elStatusPage = Browser.Open <ElementStatusPage>();

            var disablingElement = WebElement.Create(null, ElementLocator.Create(By.Id, "willBeDisplayed"));

            using (var benchmark = new BenchmarkScope("Time Until Display"))
            {
                Wait.NoMoreThan(TimeSpan.FromSeconds(3)).Until(() => disablingElement.IsDisplayed);
                benchmark.Elapsed.Should().BeCloseTo(TimeSpan.FromSeconds(2), 300);
            }
        }
예제 #9
0
        public void ShouldWaitForConfirmAndDismiss()
        {
            var alertPage = Browser.Open <AlertPage>();

            Browser.Click(WebElement.Create(null, ElementLocator.Create(By.LinkText, "Confirm")));
            var twoSeconds = TimeSpan.FromSeconds(2);

            Wait.NoMoreThan(twoSeconds).Until(() => Browser.IsAlertPresent);
            Browser.IsAlertPresent.Should().BeTrue();
            Browser.Alert.Text.Should().Contain("Sunny");
            Browser.Alert.Dismiss();
            Browser.IsAlertPresent.Should().BeFalse();
        }
예제 #10
0
        public void ShouldWaitForAlertAndAccept()
        {
            var alertPage = Browser.Open <AlertPage>();

            Browser.Click(WebElement.Create(null, ElementLocator.Create(By.ClassName, "alert")));
            var twoSeconds = TimeSpan.FromSeconds(2);

            Wait.NoMoreThan(twoSeconds).Until(() => Browser.IsAlertPresent);
            Browser.IsAlertPresent.Should().BeTrue();
            Browser.Alert.Text.Should().Contain("Servus");
            Browser.Alert.Accept();
            Browser.IsAlertPresent.Should().BeFalse();
        }
예제 #11
0
        public void Issue_11_ShouldNoBlockForLongerThanSpecifiedWhenCallingWaitForNoMoreThan()
        {
            var gatewayPage        = Browser.Open <Test000GatewayPage>();
            var nonExistingElement = WebElement.Create(null, ElementLocator.Create(SpecDrill.SecondaryPorts.AutomationFramework.By.CssSelector, ".abc-xyz"));

            using (var wait = Browser.ImplicitTimeout(TimeSpan.FromSeconds(3)))
                using (var benchmark = new BenchmarkScope("timing Wait.NoMoreThan(...)"))
                {
                    var timeLimit = TimeSpan.FromSeconds(1);

                    Action waitForNonExistingElement = () =>
                                                       Wait.NoMoreThan(timeLimit).Until(() => nonExistingElement.IsAvailable);
                    waitForNonExistingElement.Should().Throw <TimeoutException>();
                    benchmark.Elapsed.Should().BeCloseTo(timeLimit, 300);
                }
        }
예제 #12
0
 public GoogleSearchResultsPage(Browser browser)
     : base(browser, "")
 {
     SearchResults = new ListElement <SearchResultItemControl>(this, ElementLocator.Create(By.CssSelector, "div.content div.mw div.g"));
 }
예제 #13
0
 public SearchResultItemControl(IBrowser browser, IElement parent, IElementLocator locator) : base(browser, parent, locator)
 {
     Link        = WebElement.Create(this.Browser, this, ElementLocator.Create(By.CssSelector, "div a"));
     Description = WebElement.Create(this.Browser, this, ElementLocator.Create(By.CssSelector, "div.rc>div.s>span.st"));
 }
예제 #14
0
 public MenuListItemControl(IBrowser browser, IElement parent, IElementLocator locator) : base(browser, parent, locator)
 {
     LnkLogin = WebElement.CreateNavigation <Test000LoginPage>(browser, parent, ElementLocator.Create(By.PartialLinkText, "Login"));
     LnkHome  = WebElement.CreateNavigation <Test000HomePage>(browser, parent, ElementLocator.Create(By.PartialLinkText, "Home"));
 }
예제 #15
0
 private void InitFields()
 {
     this.TxtSearch = WebElement.Create(this.Browser, this, ElementLocator.Create(By.CssSelector, "input#lst-ib"));
     this.BtnSearch = WebElement.CreateNavigation <GoogleSearchResultsPage>(this.Browser, this, ElementLocator.Create(By.CssSelector, "button.lsb>span.sbico"));
 }