I am using dhtmlx scheduler component with angular. Dhtmlx scheduler You can find drag and drop of events in live demo of Timeline view.
I need to writer protractor test case for it. How can I perform drag and drop of dhtmlx component using protractor?
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:
- How to do drag and drop in protractor?
- actions_spec.js
- How to test drag & drop functionality in AngularJS e2e testing
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:
- How to simulate a drag and drop action in protractor?
- Drag & Drop with Protractor by Repeater