示例#1
0
        public void ResizableDefault_WidthHeight_ShouldResize()
        {
            _resizePage.NavigateTo("http://demoqa.com/resizable/");

            _resizePage.Resize(_resizePage.HandleObject, 300, 150);

            int width  = _resizePage.ResizableObject.Size.Width;
            int height = _resizePage.ResizableObject.Size.Height;

            width.Should().Be(433);
            height.Should().Be(283);
        }
 public void SetUp()
 {
     Initialize();
     _resizablePage = new ResizablePage(Driver);
     Driver.Manage().Window.Maximize();
     _resizablePage.NavigateTo();
 }
示例#3
0
        public void ResizableFourthTest()
        {
            var resizablePage = new ResizablePage(driver);

            resizablePage.NavigateTo();
            resizablePage.ResizeWindowWithoutDropping();

            resizablePage.AssertWindowAttribute("you can find a screenshot of the this failed test");
        }
示例#4
0
        public void ResizableThirdTest()
        {
            var resizablePage = new ResizablePage(driver);

            resizablePage.NavigateTo();
            resizablePage.IncreaseWidthAndHeightBy(0, 100);

            resizablePage.AssertNewSizeHeight();
        }
示例#5
0
        public void ResizableSecondTest()
        {
            var resizablePage = new ResizablePage(driver);

            resizablePage.NavigateTo();
            resizablePage.IncreaseWidthAndHeightBy(100, 0);

            resizablePage.AssertNewSizeWidth();
        }
示例#6
0
        public void ResizableItem_ResizeSides100PixBigger_ItemSidesAre100PixBigger()
        {
            var resizablePage = new ResizablePage(this.driver);

            resizablePage.NavigateTo(resizablePage.URL);

            resizablePage.IncreaseWidthAndHeightBy(100);

            resizablePage.AssertSizeIncreasedWith(100);
        }
示例#7
0
        public void ResizableItem_ResizeWidth100PixBigger_ItemWidthIs100PixBigger()
        {
            var resizablePage = new ResizablePage(this.driver);

            resizablePage.NavigateTo(resizablePage.URL);

            resizablePage.IncreaseWidthBy(100);

            resizablePage.AssertWidthIncreasedWith(100);
        }
示例#8
0
        public void MinMaxElementResizeTest()
        {
            //resize element to make it smaller or larger
            var resizablePage = new ResizablePage(driver);

            resizablePage.NavigateTo();
            var resizableElementWidthBefore  = resizablePage.MinMaxElement.Size.Width;
            var resizableElementHeightBefore = resizablePage.MinMaxElement.Size.Height;

            resizablePage.MinMaxElementResize();

            resizablePage.MinMaxElement.Size.Width.Should().NotBe(resizableElementWidthBefore);
            resizablePage.MinMaxElement.Size.Height.Should().NotBe(resizableElementHeightBefore);
        }
示例#9
0
        public void ResizableObject()
        {
            var resizablePage = new ResizablePage(Driver);

            resizablePage.NavigateTo();
            var elementH = resizablePage.GetSize().Height;
            var elementW = resizablePage.GetSize().Width;

            resizablePage.ResizeObject();
            //Assert.That(_resizablePage.GetSize().Height, Is.InRange(elementH + 10, elementH + 50));
            //Assert.That(_resizablePage.GetSize().Width, Is.InRange(elementW + 10, elementW + 50));
            resizablePage.GetSize().Height.Should().BeInRange(elementH + 10, elementH + 50);
            resizablePage.GetSize().Width.Should().BeInRange(elementW + 10, elementW + 50);
        }
        public void ResizableConstrainedItem_ResizeSides_ItemResizeConstrainedByContainer()
        {
            var resizablePage = new ResizablePage(this.driver);

            // Get the tab number (e.g. "Default functionality", Constrain movement") from the test property above and give it to the URL
            resizablePage.tabNo = TestContext.CurrentContext.Test.Properties.Get("Resizable test tab Number:").ToString();
            resizablePage.NavigateTo(resizablePage.URL);
            // Scroll page Up so the element is into view. Because when Firefox opens the desired page/tab, somehow the page is scrolled down
            ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", resizablePage.TopOfPage);

            resizablePage.IncreaseWidthAndHeight();

            resizablePage.AssertResizableSizeSmallerThanContainer(resizablePage.resizableElementTab3);
        }
        public void AnimateFunctionalityByPixels(int xTransition, int yTransition)
        {
            _resizablePage.NavigateTo();
            _resizablePage.AnimateButton.Click();

            int startXCoordinate = _resizablePage.ResizablePoint.Location.X + xTransition;
            int startYCoordinate = _resizablePage.ResizablePoint.Location.Y + yTransition;

            _resizablePage.DragElementByOffset(_resizablePage.ResizablePoint, xTransition, yTransition);
            int endXCoordinate = _resizablePage.ResizablePoint.Location.X;
            int endYCoordinate = _resizablePage.ResizablePoint.Location.Y;

            Assert.AreEqual(startXCoordinate, endXCoordinate, 3);
            Assert.AreEqual(startYCoordinate, endYCoordinate, 3);
        }
        public void ResizableConstrainedItem_ResizeSidesMoreThanConstraints_ItemResizeConstrainedByConstraints()
        {
            var resizablePage = new ResizablePage(this.driver);
            // Get the current test method name and use it as a Key in the xlsx file
            InteractionPages resize = AccessExcelData.GetInteractionTestsData(TestContext.CurrentContext.Test.Name);

            // Get the tab number (e.g. "Default functionality", Constrain movement") from the test property above and give it to the URL
            resizablePage.tabNo = TestContext.CurrentContext.Test.Properties.Get("Resizable test tab Number:").ToString();
            resizablePage.NavigateTo(resizablePage.URL);
            // Scroll page Up so the element is into view. Because when Firefox opens the desired page/tab, somehow the page is scrolled down
            ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", resizablePage.TopOfPage);

            resizablePage.IncreaseWidthAndHeightBy3(int.Parse(resize.HorizontalOffset), int.Parse(resize.VerticalOffset));

            resizablePage.AssertResizableSizeSmallerThanOrEqualToConstraints(resizablePage.resizableElementTab5, resize);
        }
        public void ResizableItem_ResizeSides_ItemSidesResizedProperly()
        {
            var resizablePage = new ResizablePage(this.driver);
            // Get the current test method name (TestContext.CurrentContext.Test.Name = ResizableItem_ResizeSides_ItemSidesResizedProperly) and use it as a Key in the xlsx file
            InteractionPages resize = AccessExcelData.GetInteractionTestsData(TestContext.CurrentContext.Test.Name);

            // Get the tab number (e.g. "Default functionality", Constrain movement") from the test property above and give it to the URL
            resizablePage.tabNo = TestContext.CurrentContext.Test.Properties.Get("Resizable test tab Number:").ToString();
            resizablePage.NavigateTo(resizablePage.URL);
            // Scroll page Up so the element is into view. Because when Firefox opens the desired page/tab, somehow the page is scrolled down
            ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", resizablePage.TopOfPage);

            resizablePage.IncreaseWidthAndHeightBy2(int.Parse(resize.HorizontalOffset), int.Parse(resize.VerticalOffset));

            // Exact Assert would not pass because the resized item's dimensions are 17 pixels less than logically expected
            // See method AssertSizeIncreasedWith2 for details
            resizablePage.AssertSizeIncreasedWith2(int.Parse(resize.HorizontalOffset), int.Parse(resize.VerticalOffset));
        }
示例#14
0
 public void Setup()
 {
     Initialize();
     _resizablePage = new ResizablePage(Driver);
     _resizablePage.NavigateTo();
 }