webdriverio / codemod

A codemod to transform Protractor into WebdriverIO tests
MIT License
25 stars 12 forks source link

Avoid failure when API breaks #21

Open berdal84 opened 3 years ago

berdal84 commented 3 years ago

When trying to translate from protractor to wdio v7, I had errors about API incompatibility (ex: browser.actions) not handled by the codemod. Instead of having a blocking error (with a lot of usefull information, which a good thing) I suggest:

Let me give you an example:

Before:

    browser.actions()
         .mouseMove(element)
         .mouseMove({x: 200, y: 0})
         .perform();

After:


    throw new Error('You forgot to convert browser.actions(...), check source code at line:col ');
    // TODO: convert to wdio
    // <explanations here>
    //  browser.actions()
    //     .mouseMove(element)
    //     .mouseMove({x: 200, y: 0})
    //     .perform();

Regards,

christian-bromann commented 3 years ago

Thanks @berdal84 for filing the issue. Unfortunately comments are very difficult to transform. It is not straight forward to move an expression statement into a comment. It would require some heavy refactoring. I very much like the idea though. So any contributions would be much appreciated.

christian-bromann commented 2 years ago

Not sure why you closed the issue. I think this is still a cool feature request.

berdal84 commented 2 years ago

It was a mistake, sorry for that.