janl commented on code in PR #9212:
URL: https://github.com/apache/pouchdb/pull/9212#discussion_r3020910146
##########
tests/multitab/user_agent.js:
##########
@@ -0,0 +1,53 @@
+'use strict';
+
+const playwright = require('playwright');
+
+const ADAPTERS = process.env.ADAPTERS || 'indexeddb';
+const CLIENT = process.env.CLIENT || 'firefox';
+const SHELL_URL = 'http://127.0.0.1:8000/tests/multitab/shell.html';
+
+class UserAgent {
+ static async start() {
+ let browser = await playwright[CLIENT].launch();
+ let context = await browser.newContext();
+ return new UserAgent(ADAPTERS, browser, context);
+ }
+
+ constructor(adapter, browser, context) {
+ this._adapter = adapter;
+ this._browser = browser;
+ this._context = context;
+ this._pages = new Map();
+ }
+
+ async stop() {
+ await this._browser.close();
+ }
+
+ async eval(pageId, fn) {
+ let page = await this._getPage(pageId);
+ return page.evaluate(fn);
+ }
+
+ _getPage(id) {
Review Comment:
`page` is the playwright API language and it is consistent with that. Of
course we can change it, but not sure if worth it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]