コード例 #1
0
        public void DraggableAndSortable_DragItem2ToListBottom_Item2IsAtListBottom()
        {
            var draggablePage = new DraggablePage(this.driver);
            // Get the current test method name and use it as a Key in the xlsx file
            InteractionPages drag = 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
            draggablePage.tabNo = TestContext.CurrentContext.Test.Properties.Get("Draggable test tab Number:").ToString();
            draggablePage.NavigateTo(draggablePage.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);", draggablePage.TopOfPage);

            draggablePage.DragObject(int.Parse(drag.HorizontalOffset), int.Parse(drag.VerticalOffset), draggablePage.DraggableSortableElement2);

            // Assert that the element 5 from the list now has text "Item 2"
            // Thread.Sleep(1000); - deprecated because I use now a sleeker wait in the AssertSortableElementIsMovedAtBottom()
            draggablePage.AssertSortableElementIsMovedAtBottom("Item 2");
        }