Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

browser.actions().click() does not work with async/await #4578

@pontusnyman

Description

@pontusnyman

Hi,
I am converting my protractor tests from Promises to async/await and I found something weird with browser actions click. The problem is that the click() does not execute, but the mouseMove does.
The click() works when test is written as a promise not async/await

Here is the test and the browser.actions function

  it('When entering selection state selection toolbar should appear', async () => {
    const page = new SingleObjectPage();
    await page.get('barchart', 'PWFwr', 'select=clearall');
    await page.activateSelectionMode($(barlayer));
    await browser.wait(EC.visibilityOf($(SingleObjectPage.selectors.object.confirmButton)), timeout, 'Confirm button did not appear');
  });

  activateSelectionMode(element) {
    return browser.actions()
      .mouseMove(element, {
        x: 20,
        y: 75,
      })
      .click()
      .perform();
  }

I found a workaround to get it to work.

  activateSelectionMode(element) {
    return browser.actions()
      .mouseMove(element, {
        x: 20,
        y: 75,
      })
      .perform().then(() => browser.actions()
        .click()
        .perform());
  }

Bug report

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions