Skip to content

Commit

Permalink
#76: drag and drop sliders - improve JavaDoc and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Pfotenhauer committed Apr 3, 2020
1 parent 9aff251 commit 605383b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ public static void wrapAssertionError(final Runnable runnable)
}

/**
* Drag and drop a horizontal or vertical slider to a given position. The position will be set by the user. It drags
* the slider and moves it to a specific position of the respective slider.
* Drag and drop an element to a given position. The position will be set by the user. It drags the element and
* moves it to a specific position of the respective slider.
*
* @param elementToMove
* The selector of the slider to drag and drop
Expand Down
25 changes: 12 additions & 13 deletions src/test/java/com/xceptance/neodymium/util/SelenideAddonsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,8 @@ public void testRightHorizontalDragAndDropUntilCondition()
{
Selenide.open("https://demos.telerik.com/kendo-ui/slider/index");

SelenideAddons.dragAndDropUntilCondition($(".balSlider a[role=slider]"), $(".balSlider a[role=slider]"), 40, 0, 3000, 23,
Condition.attribute("aria-valuenow", "8"));
SelenideElement slider = $(".balSlider a[role=slider]");
SelenideAddons.dragAndDropUntilCondition(slider, slider, 40, 0, 3000, 23, Condition.attribute("aria-valuenow", "8"));

Assert.assertEquals($(".balSlider a[role=slider]").getAttribute("aria-valuenow"), "8");
}
Expand All @@ -422,8 +422,8 @@ public void testLeftHorizontalDragAndDropUntilCondition()
{
Selenide.open("https://demos.telerik.com/kendo-ui/slider/index");

SelenideAddons.dragAndDropUntilCondition($(".balSlider a[role=slider]"), $(".balSlider a[role=slider]"), -40, 0, 3000, 23,
Condition.attribute("aria-valuenow", "-8"));
SelenideElement slider = $(".balSlider a[role=slider]");
SelenideAddons.dragAndDropUntilCondition(slider, slider, -40, 0, 3000, 23, Condition.attribute("aria-valuenow", "-8"));

Assert.assertEquals($(".balSlider a[role=slider]").getAttribute("aria-valuenow"), "-8");
}
Expand All @@ -433,9 +433,8 @@ public void testUpVerticalDragAndDropUntilCondition()
{
Selenide.open("https://demos.telerik.com/kendo-ui/slider/index");

SelenideAddons.dragAndDropUntilCondition($("#equalizer .k-slider-vertical:first-child a"), $("#equalizer .k-slider-vertical:first-child a"), 0, -10,
3000, 23,
Condition.attribute("aria-valuenow", "16"));
SelenideElement slider = $("#equalizer .k-slider-vertical:first-child a");
SelenideAddons.dragAndDropUntilCondition(slider, slider, 0, -10, 3000, 23, Condition.attribute("aria-valuenow", "16"));

Assert.assertEquals($("#equalizer .k-slider-vertical:first-child a").getAttribute("aria-valuenow"), "16");
}
Expand All @@ -445,9 +444,8 @@ public void testDownVerticalDragAndDropUntilCondition()
{
Selenide.open("https://demos.telerik.com/kendo-ui/slider/index");

SelenideAddons.dragAndDropUntilCondition($("#equalizer .k-slider-vertical:first-child a"), $("#equalizer .k-slider-vertical:first-child a"), 0, 10,
3000, 23,
Condition.attribute("aria-valuenow", "-6"));
SelenideElement slider = $("#equalizer .k-slider-vertical:first-child a");
SelenideAddons.dragAndDropUntilCondition(slider, slider, 0, 10, 3000, 23, Condition.attribute("aria-valuenow", "-6"));

Assert.assertEquals($("#equalizer .k-slider-vertical:first-child a").getAttribute("aria-valuenow"), "-6");
}
Expand All @@ -457,16 +455,17 @@ public void testDragAndDropAssertionError()
{
Selenide.open("https://demos.telerik.com/kendo-ui/slider/index");

SelenideAddons.dragAndDropUntilCondition($(".balSlider a[role=slider]"), $(".balSlider a[role=slider]"), -10, 0, 3000, -1,
Condition.attribute("aria-valuenow", "-16"));
SelenideElement slider = $(".balSlider a[role=slider]");
SelenideAddons.dragAndDropUntilCondition(slider, slider, -10, 0, 3000, -1, Condition.attribute("aria-valuenow", "-16"));
}

@Test()
public void testLeftHorizontalDragAndDropUntilText()
{
Selenide.open("https://demos.telerik.com/kendo-ui/slider/index");

leftHorizontalDragAndDropUntilText($(".balSlider a[role=slider]"), $(".balSlider a[role=slider]"), -40, "aria-valuenow", "-8");
SelenideElement slider = $(".balSlider a[role=slider]");
leftHorizontalDragAndDropUntilText(slider, slider, -40, "aria-valuenow", "-8");

Assert.assertEquals($(".balSlider a[role=slider]").getAttribute("aria-valuenow"), "-8");
}
Expand Down

0 comments on commit 605383b

Please sign in to comment.