MCPcopy
hub / github.com/CapSoftware/Cap / configureExtension

Function configureExtension

apps/chrome-extension/e2e/overlay-ui.spec.ts:209–262  ·  view source on GitHub ↗
(
	worker: Awaited<ReturnType<typeof getServiceWorker>>,
	apiBaseUrl: string,
)

Source from the content-addressed store, hash-verified

207};
208
209const 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
264const sendServiceWorkerMessage = async (
265 page: Page,

Callers 1

overlay-ui.spec.tsFile · 0.70

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected