protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Protractor 6.0 fails on call to actions API.

Open tymfear opened this issue 7 years ago • 4 comments

Bug report

  • Node Version: 10.15.0
  • Protractor Version: 6.0
  • Angular Version: ``
  • Browser(s): chrome v. 73.0.3683.8
  • Operating System and Version MacOS High Sierra v .10.13.6
  • Your protractor configuration file
  • A relevant example test
  • Output from running the test
  • Steps to reproduce the bug
  • The URL you are running your tests against (if relevant)

Config:

exports.config = {
  SELENIUM_PROMISE_MANAGER: false,
  allScriptsTimeout: 30 * 1000,
  directConnect: true,
  specs: [
    'src/specs/spec.*'
  ],
  capabilities: {
    browserName: 'chrome',
    chromeOptions: {
      args: ['--no-sandbox', '--disable-gpu',]
    }
  },
  onPrepare: async () => {
    require('ts-node').register({
      project: './tsconfig.json'
    });
    await browser.driver.manage().window().maximize();
  },
};

Spec

import {$, browser} from 'protractor';

it('Executes Actions sequesne', async () => {
  await browser.waitForAngularEnabled(false);
  await browser.get('https://google.com');
  const element = await $('[name="q"]').getWebElement();
  await browser.actions()
    .mouseMove(element)
    .mouseMove({x: 50, y: 0})
    .doubleClick()
    .perform();
});

Output

[19:51:27] I/direct - Using ChromeDriver directly...
DEPRECATION: Setting randomizeTests directly is deprecated, please use the random option in `configure`
DEPRECATION: Setting specFilter directly on Env is deprecated, please use the specFilter option in `configure`
Started
F

Failures:
1) Executes Actions sequesne
  Message:
    TypeError: protractor_1.browser.actions(...).mouseMove is not a function
  Stack:
        at <Jasmine>
        at Object.<anonymous> (/Users/daudty/projects/management-platform-ui/test/ts-e2e-protractor/src/specs/spec.ts:8:6)
        at <Jasmine>
        at fulfilled (/Users/daudty/projects/management-platform-ui/test/ts-e2e-protractor/src/specs/spec.ts:4:58)
        at process._tickCallback (internal/process/next_tick.js:68:7)

1 spec, 1 failure
Finished in 5.484 seconds
[19:51:35] I/launcher - 0 instance(s) of WebDriver still running
[19:51:35] I/launcher - Running 0 instances of WebDriver
[19:51:35] I/launcher - chrome #01 failed 1 test(s)
[19:51:35] I/launcher - overall: 1 failed spec(s)
[19:51:35] E/launcher - Process exited with error code 1

Did something changed?

tymfear avatar Mar 24 '19 17:03 tymfear

Actions API has changed. I would read up on them and access them directly from browser.drive

cnishina avatar Mar 25 '19 03:03 cnishina

@cnishina yeah, found solution, thanks. FYI, just need to pass {bridge: true} to actions builder.

  await browser.actions({bridge: true})
    .mouseMove(element)
    .mouseMove({x: 50, y: 0})
    .doubleClick()
    .perform();

tymfear avatar Mar 25 '19 11:03 tymfear

I'm still getting the same error (mouseMove is not a function) after passing {bridge: true}.

return browser.actions({ bridge: true })
            .mouseMove(elem)
            .mouseMove({ x: toRight, y: toBottom })
            .click()
            .perform();

mvhaen avatar Mar 31 '19 15:03 mvhaen

@mvhaen it's called move now and they changed the API see https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/input_exports_Actions.html

denhai avatar Apr 16 '19 03:04 denhai