0

For my site, I want to click, hold and drag to the left an element, so it appears a trash icon. The following code below passes but does nothing. I don't want to drag to a specific position, but just drag to the left, so I tried to decrease X value, also this does not work. Any help is really appreciated.

 it('should delete unexpected item', function(){
        let el = element(by.css("div[fxlayout='row']"));

        el.getLocation().then(function (location) {
            console.log(location.y);
            console.log(location.x);

        });

        browser.actions().mouseDown(el).perform();
        browser.sleep(3000);
        browser.actions().mouseMove({ x: 30, y: 0 }).perform();
        browser.actions().mouseDown(el).perform();
        browser.actions().mouseMove({ x: 10, y: 0 }).perform();
        browser.actions().mouseUp().perform();
        browser.sleep(3000);


    })

0

I found a way to just move to the sides.

it('should delete unexpected item', function(){
        let el = element(by.css("div[class='delete-indicator']"));

        el.getLocation().then(function (location) {
            console.log(location.y);
            console.log(location.x);

        });

        browser.actions().mouseDown(el).perform();
        browser.sleep(1000);
        browser.actions().mouseMove({ x: 293, y: 0 }).perform(); ///start position
        browser.actions().mouseDown(el).perform();
        browser.sleep(2000);
        browser.actions().mouseMove({ x: -90, y: 0 }).perform(); ///final position

        browser.actions().mouseUp().perform();
        browser.sleep(2000);
        element(by.css('.delete-icon')).click();
        browser.sleep(3000);        

    })
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.