Skip to content

Async codemod is inconsistent #89

Description

@servant-42

I recently used the async codemod to convert 2,500 lines of tests and found it to be inconsistent.

It would add await places where it shouldn't, for example, before underscore functions and String.startsWith() / .endsWith().

It would put await in the wrong place, for example before assert.equal() instead of before browser.getUrl():

await assert.equal(browser.getUrl(), base_url + '/#changesets', 'navigateToActiveChangesets');

It doesn't support functions added to the browser object (though perhaps this is discouraged & therefore by design). For example, this function isn't converted to async, and calls to it don't get an await injected:

  browser.getText = function (el) {
    return $(el).getText();
  };

It seems to assume the codebase is on WebDriver v7.9+ and can use a single async on chained calls. For example, it only injected two awaits here:

  async function getDot(dotClass, labelClass) {
    return (await (await $(dotClass + '[style="opacity: 1"]')
      .parent())
      .parent())
      .find(labelClass)
      .html();
  }

Perhaps this is a fair assumption, but it would be nice if it was documented in case others, like me, plan to upgrade to 7.9+ after the async codemod instead of before.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions