interledger / web-monetization-extension

An open-source browser extension that enables Web Monetization.
Apache License 2.0
49 stars 3 forks source link

test(e2e): add boilerplate and tests #556

Closed sidvishnoi closed 2 weeks ago

sidvishnoi commented 4 weeks ago

Closes https://github.com/interledger/web-monetization-extension/issues/542

github-actions[bot] commented 4 weeks ago

Extension builds preview

Name Link
Latest commit ed3e0c3188883b659b92d63cfec26312ab63d6f2
Latest job logs Run #10848587613
BadgeDownload
BadgeDownload
sidvishnoi commented 4 weeks ago

Locally: image

sidvishnoi commented 4 weeks ago

TODO:

sidvishnoi commented 4 weeks ago

Locally: image

sidvishnoi commented 3 weeks ago

Figure out way to open popup as a popup, as no browser/automation supports clicking browser action as such (i.e. we need to simulate that behavior, as if popup is open like that)

One approach could be we open the open as a separate window. Then we won't have to rely on "action.openPopup()" which is flaky. But we'd have to handle focus change events correctly, as popup will always be open (See log: "Popup is open, ignoring focus change").

Checking how to make it work with headless: true or make headless: false work on GitHub Actions. If not possible on CI, being able to run locally would be worthwhile anyway, just more manual and more chances of "works on my machine".

sidvishnoi commented 3 weeks ago

Apparently, we can't have headless: true with extensions: https://issues.chromium.org/issues/41309918#comment6. Will have to use xvfb if we want this running in CI.

sidvishnoi commented 3 weeks ago

Chromium tests passed in CI! (although one is already flaky!)

sidvishnoi commented 3 weeks ago

Firefox isn't supported well enough at the moment: https://github.com/microsoft/playwright/issues/7297 (some things might work, but presently hanging indefinitely locally).

sidvishnoi commented 3 weeks ago

Ok, puppeteer has same issues. Will test only Chrome for now, and wait for Playwright support for Firefox.

But need to find a way to ensure we can use same context across more tests.