joule-labs / joule-extension

Lightning payments extension for Chrome
MIT License
353 stars 62 forks source link

End-to-end testing #151

Open wbobeirne opened 5 years ago

wbobeirne commented 5 years ago

It would bring my mind a lot of ease to have some somewhat reliable ent-to-end testing. This would ideally cover the extension itself, as well as WebLN interactions. Currently I'm looking at Cypress, but some challenges are presented with this:

  1. Cypress doesn't yet let you visit chrome extension options pages.
  2. Cypress doesn't implement the web extension APIs, so things like requesting permissions and the storage system won't work.
  3. It will be prohibitively difficult to get a regtest lightning node to work in CI.

Some options for getting around these things:

  1. Run a server that exposes the extension's options page through a port and visit that instead of chrome-extension://
  2. Stub out the extension APIs using something like sinon-chrome.
  3. Mock an lnd node as well. This would severely reduce the usefulness of this since tests wouldn't be an accurate representation of connecting to a real node.

It looks like Metamask is also looking to implement something like this, so it'll be interesting to see how they tackle the problem.

alepop commented 5 years ago

@wbobeirne what about puppeteer? https://stackoverflow.com/questions/48089670/detect-and-test-chrome-extension-using-puppeteer