Drag and drop using protractor in dthmlx component

二次信任 提交于 2019-12-07 04:01:23
alecxe

The demos available on the Dhtmlx scheduler page don't use angular. I've found another suitable demo page which I would use as an example.

The general idea is pretty simple - use dragAndDrop() function. Unfortunately it is not documented on the API documentation page. May be this is because it is coming from webdriverjs and protractor has nothing to do with it. Anyway, currently, you can find some information and samples here:

Basically you can either move an element by x or y offset to the left or right or top or bottom; or, you can move to an another element.

Here's an example (moving Task #1 by 1000 to the right):

describe("Sample test", function () {
    beforeEach(function () {
        browser.get("http://dhtmlx.github.io/angular-gantt-demo/");
        browser.waitForAngular();
    });

    it("should move the task", function () {
        var task = element(by.xpath('//div[@class="gantt_bars_area"]//div[@task_id="2"]'));

        browser.actions().dragAndDrop(
            task,
            {x:1000, y:0}
        ).perform();

        browser.sleep(10000);
    });
});

Alternatively, you can manually chain mouseDown(), mouseMove(), mouseUp() actions, examples:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!