minop1205 / react-dnd-treeview

A draggable / droppable React-based treeview component. You can use render props to create each node freely.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

katalon test

aydozgeee opened this issue · comments

Hello, I am trying to drag and drop files to folders on Katalon automation tests. But when test is running, the mouse location is tract. Element drops where my mouse pointer is, even location has been set. Do you have any ideas on how to automate dnd tree?

def dragdrop(TestObject to, TestObject dest) {
def eleto = WebUiCommonHelper.findWebElement(to, 30)
def eledeset = WebUiCommonHelper.findWebElement(dest, 30)
WebDriver driver = DriverFactory.getWebDriver()
Actions actions = new Actions(driver);
actions.moveToElement(eleto)
.pause(Duration.ofSeconds(1))
.clickAndHold(eleto)
.pause(Duration.ofSeconds(5))
.moveByOffset(0,-130)
.pause(Duration.ofSeconds(1))
.moveToElement(eledeset)
.release().perform();

}

When I test this package, I write assertions within the Storybook play function.

(Minimum configuration story test)
https://github.com/minop1205/react-dnd-treeview/blob/next/src/stories/examples/MinimumConfiguration/MinimumConfiguration.stories.tsx

However, when I try to test dropping files, or elements that are outside of the DndProvider, it fails.

These external elements are being dragged and dropped via the dataTransfer object, but the test environment does not have access to the necessary information in the dataTransfer, so we need to mock these in the automated test. However, mocking and testing these elements makes little sense for automated testing, so we have only partially implemented testing in these cases at this time.

https://github.com/minop1205/react-dnd-treeview/blob/next/src/stories/examples/FileDrop/FileDrop.stories.tsx

If I'm not mistaken, automated tests can be done partially means that drag can be done automated but drop is not happening right?

I have not used Katalon, but I guess it depends on the test runner you are using as to what kind of testing is possible.

In my case, I am using Storybook + React Testing Library, and in this case, I can drag, but cannot detect the drop. This is due to a browser API spec issue that restricts access to the dataTransfer object that react-dnd references internally.

These are cases where elements outside the tree are dropped into the tree, and if the test is completed within the tree, this problem would not occur.