jcoglan commented on code in PR #9212:
URL: https://github.com/apache/pouchdb/pull/9212#discussion_r3028004775
##########
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:
I was unsure about this. Everyone discussing these issues uses "tab" but
Playwright uses "page". Strictly speaking, a "tab" is a particular UI for
operating multiple pages, but it's not the only one. Colloquially I think
"multi-tab" communicates "several pages operating concurrently" better than
"multi-page" which to me sounds like a multi-step sequential workflow.
--
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]