( worker: Awaited<ReturnType<typeof getServiceWorker>>, apiBaseUrl: string, )
| 207 | }; |
| 208 | |
| 209 | const configureExtension = async ( |
| 210 | worker: Awaited<ReturnType<typeof getServiceWorker>>, |
| 211 | apiBaseUrl: string, |
| 212 | ) => { |
| 213 | await worker.evaluate( |
| 214 | async ({ authKey, bootstrapKey, settingsKey, apiBaseUrl }) => { |
| 215 | const chromeApi = (globalThis as ChromeGlobal).chrome; |
| 216 | await new Promise<void>((resolve) => |
| 217 | chromeApi.storage.local.clear(() => resolve()), |
| 218 | ); |
| 219 | await new Promise<void>((resolve) => |
| 220 | chromeApi.storage.local.set( |
| 221 | { |
| 222 | [authKey]: { authApiKey: "auth-e2e", userId: "user-e2e" }, |
| 223 | [bootstrapKey]: { |
| 224 | bootstrap: { |
| 225 | user: { id: "user-e2e", email: "e2e@cap.test" }, |
| 226 | organization: { id: "org-e2e", name: "E2E" }, |
| 227 | plan: { isPro: true, maxRecordingSeconds: 600 }, |
| 228 | }, |
| 229 | cachedAt: Date.now(), |
| 230 | }, |
| 231 | [settingsKey]: { |
| 232 | apiBaseUrl, |
| 233 | capture: { |
| 234 | recordingMode: "fullscreen", |
| 235 | camera: null, |
| 236 | microphone: null, |
| 237 | }, |
| 238 | webcam: { |
| 239 | enabled: true, |
| 240 | deviceId: "__cap_default_camera__", |
| 241 | position: "bottom-left", |
| 242 | size: 230, |
| 243 | shape: "round", |
| 244 | mirror: false, |
| 245 | }, |
| 246 | microphone: { enabled: false, deviceId: null }, |
| 247 | systemAudio: { enabled: false }, |
| 248 | sounds: { enabled: false }, |
| 249 | }, |
| 250 | }, |
| 251 | () => resolve(), |
| 252 | ), |
| 253 | ); |
| 254 | }, |
| 255 | { |
| 256 | apiBaseUrl, |
| 257 | authKey: AUTH_KEY, |
| 258 | bootstrapKey: BOOTSTRAP_CACHE_KEY, |
| 259 | settingsKey: SETTINGS_KEY, |
| 260 | }, |
| 261 | ); |
| 262 | }; |
| 263 | |
| 264 | const sendServiceWorkerMessage = async ( |
| 265 | page: Page, |
no test coverage detected