コード例 #1
0
        public void Should_BePossibleTo_ScrollToTheCenter()
        {
            const int accuracy    = 1;
            var       welcomeForm = new WelcomeForm();

            welcomeForm.Open();
            welcomeForm.GetExampleLink(AvailableExample.Dropdown).JsActions.ScrollToTheCenter();

            var windowSize = AqualityServices.Browser.ExecuteScriptFromFile <object>("Resources.GetWindowSize.js").ToString();
            var currentY   = AqualityServices.Browser.ExecuteScriptFromFile <object>("Resources.GetElementYCoordinate.js",
                                                                                     welcomeForm.GetExampleLink(AvailableExample.Dropdown).GetElement()).ToString();
            var coordinateRelatingWindowCenter = double.Parse(windowSize) / 2 - double.Parse(currentY);

            Assert.LessOrEqual(Math.Abs(coordinateRelatingWindowCenter), accuracy, "Upper bound of element should be in the center of the page");
        }
        public void Should_BePossibleTo_Click()
        {
            var welcomeForm = new WelcomeForm();

            welcomeForm.Open();
            welcomeForm.GetExampleLink(AvailableExample.Dropdown).MouseActions.Click();
            Assert.IsTrue(new DropdownForm().State.WaitForDisplayed(), "Dropdown form should be displayed");
        }
コード例 #3
0
        public void Should_BePossibleTo_HighlightElement()
        {
            var welcomeForm = new WelcomeForm();

            welcomeForm.Open();
            var dropdownExample = welcomeForm.GetExampleLink(AvailableExample.Dropdown);

            dropdownExample.JsActions.HighlightElement(HighlightState.Highlight);
            var border = dropdownExample.GetCssValue("border");

            Assert.AreEqual("3px solid rgb(255, 0, 0)", border, "Element should be highlighted");
        }