mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
add drop actions utils
This commit is contained in:
@@ -14,11 +14,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { browser } from 'protractor';
|
||||
import { browser, ElementFinder } from 'protractor';
|
||||
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import * as remote from 'selenium-webdriver/remote';
|
||||
import { BrowserActions } from '../utils/browser-actions';
|
||||
|
||||
const JS_BIND_INPUT = function(target) {
|
||||
const input = document.createElement('input');
|
||||
@@ -97,4 +98,22 @@ export class DropActions {
|
||||
const input: any = await browser.executeScript(JS_BIND_INPUT_FOLDER, elem);
|
||||
return input.sendKeys(absolutePath);
|
||||
}
|
||||
|
||||
protected async dragAndDrop(elementToDrag: ElementFinder, locationToDragTo: ElementFinder, locationOffset = { x: 230, y: 280 }) {
|
||||
await BrowserActions.click(elementToDrag);
|
||||
await browser.actions().mouseDown(elementToDrag).mouseMove(locationToDragTo, locationOffset).mouseUp().perform();
|
||||
await browser.actions().doubleClick(locationToDragTo).perform();
|
||||
}
|
||||
|
||||
async dragAndDropNotClickableElement(elementToDrag: ElementFinder, locationToDragTo: ElementFinder) {
|
||||
await browser.actions().mouseMove(elementToDrag).perform();
|
||||
await browser.actions().mouseDown(elementToDrag).perform();
|
||||
await browser.actions().mouseMove({ x: 10, y: 100 }).perform();
|
||||
await browser.actions().mouseMove(locationToDragTo).perform();
|
||||
return browser.actions().mouseUp().perform();
|
||||
}
|
||||
|
||||
async dropElement(locationToDragTo: ElementFinder) {
|
||||
await browser.actions().mouseDown(locationToDragTo).perform();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user