拖放用量角器在dthmlx组件 [英] Drag and drop using protractor in dthmlx component

查看:170
本文介绍了拖放用量角器在dthmlx组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用具有角DHTMLX调度器组件。 DHTMLX调度你可以在时间线视图的现场演示活动拖放

I am using dhtmlx scheduler component with angular. Dhtmlx scheduler You can find drag and drop of events in live demo of Timeline view.

我需要作家量角器测试案例吧。我怎么能执行拖放使用量角器DHTMLX组件的下降?

I need to writer protractor test case for it. How can I perform drag and drop of dhtmlx component using protractor?

推荐答案

在DHTMLX调度页面上提供的演示没有使用棱角分明。我发现其他合适的演示页面,我将作为一个例子使用。

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.

的总体思路是pretty简单 - 使用 dragAndDrop()功能。遗憾的是它不记录在 API文档页面。可能这是因为它是从we​​bdriverjs和量角器来有什么用它做。总之,目前,你可以在这里找到一些资料和样品:

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:

  • How to do drag and drop in protractor?
  • actions_spec.js
  • How to test drag & drop functionality in AngularJS e2e testing

基本上,你可以通过 X移动元素或偏移到左或右,或顶部或底部;或者,你可以移动到另一个元素。

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.

下面是(移动任务#1 1000向右)的例子:

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);
    });
});


另外,您也可以手动链鼠标按下()的mouseMove() mouseUp事件()的行动,例如:

  • How to simulate a drag and drop action in protractor?
  • Drag & Drop with Protractor by Repeater

这篇关于拖放用量角器在dthmlx组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆