-
-
Notifications
You must be signed in to change notification settings - Fork 14
Description
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.