yorkxin / copy-as-markdown

A browser extension to copy tabs and links as Markdown
MIT License
529 stars 81 forks source link

E2E Testing #135

Closed yorkxin closed 2 months ago

yorkxin commented 4 months ago

I can only do so much with manual testing. Now that I started bloating features, it is time to add E2E tests before I regret.

I've studied E2E tests on Chrome's Guide. I've also found that there are limits on Puppeteer in terms of testing extensions:

The second article suggested that Selenium is a better choice when it comes to inputs controlled by the OS (e.g. mouse right-click, keypress). Therefore it might be a better idea to start with Selenium.

yorkxin commented 4 months ago

When trying to test feature #143 which requires context menu click on the tabs bar, I found it really hard to achieve with AWT Robot library, because I'll need to move the mouse to a position where the tabs bar is. Moving focus by keyboard (F6 then Shift-Tab * 4) isn't enough.

Also I learned from a StackOverflow post (lost link) that Selenium is launched by another program (in my case it's something something remote TestNG), so to focus on the browser itself, it is necessary to use Cmd+Tab (on macOS).

yorkxin commented 2 months ago

Good enough. I am closing this.

I've published technical notes on my blog. If anyone is interested in it: Copy as Markdown 3.0: A Milestone – Yu-Cheng Chuang’s Blog