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