-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathdragAndDrop.spec.js
27 lines (22 loc) · 949 Bytes
/
dragAndDrop.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const {By} = require('selenium-webdriver');
const {suite} = require('selenium-webdriver/testing');
const assert = require('assert');
suite(function(env) {
describe('Drag and Drop', function() {
let driver;
before(async function() {
driver = await env.builder().build();
});
after(async () => await driver.quit());
it('By Offset', async function() {
await driver.get('https://www.selenium.dev/selenium/web/mouse_interaction.html');
const draggable = driver.findElement(By.id("draggable"));
let start = await draggable.getRect();
let finish = await driver.findElement(By.id("droppable")).getRect();
const actions = driver.actions({async: true});
await actions.dragAndDrop(draggable, {x: finish.x - start.x, y: finish.y-start.y}).perform();
let result = await driver.findElement(By.id("drop-status")).getText();
assert.deepStrictEqual('dropped', result)
});
});
});