feat: allow passing testTabIndex to popup.html view [#1101]
In order to automate test on the popup, we need to be able to open it in a standalone browser tab.
We also need to have the popup "pointing" to any arbitrary tab of our choosing (activeTab
).
To achieve this we allow passing a testTabId
query parameter, which is a tab id from the browser.tabs API.
We also provide a helper function getTabId
for our e2e tests. This function will inject a script that will query for a tab with a particular title.
We choose this for several reason:
Tab ids can only be queried from an extension runtime, as the browser.tabs api is part of the webextension API and not available in regular web pages, so we always need to switch to an extension page before injecting this script to the execution context.
The helper function will return -1
if no tab can be found.
Tested that runtime is working correctly:
Also tested the helper function by writing a small test and running locally (did not check this in versioning), it did return the correct tab id
Related to #1101 (closed)