fed8b2eed7
Build and push multi-arch DocsGPT Docker image / build (linux/amd64, ubuntu-latest, amd64) (push) Has been cancelled
Backend release / release (push) Has been cancelled
Bandit Security Scan / bandit_scan (push) Has been cancelled
Build and push multi-arch DocsGPT Docker image / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Has been cancelled
Build and push multi-arch DocsGPT Docker image / manifest (push) Has been cancelled
Build and push DocsGPT FE Docker image for development / build (linux/amd64, ubuntu-latest, amd64) (push) Has been cancelled
Build and push DocsGPT FE Docker image for development / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Has been cancelled
Build and push DocsGPT FE Docker image for development / manifest (push) Has been cancelled
Python linting / ruff (push) Has been cancelled
Run python tests with pytest / Run tests and count coverage (3.12) (push) Has been cancelled
React Widget Build / build (push) Has been cancelled
25 lines
768 B
TypeScript
25 lines
768 B
TypeScript
/**
|
|
* Pre-authenticated Playwright APIRequestContext pointed at the e2e Flask.
|
|
*/
|
|
|
|
import type { APIRequestContext } from '@playwright/test';
|
|
|
|
/**
|
|
* Build an APIRequestContext pre-authenticated with `token`, base-URL'd at the
|
|
* e2e Flask app (default 127.0.0.1:7099). Specs call `.get()/.post()/.dispose()`
|
|
* directly on the returned context; remember to `dispose()` in `afterEach`.
|
|
*/
|
|
export async function authedRequest(
|
|
playwright: typeof import('@playwright/test'),
|
|
token: string,
|
|
): Promise<APIRequestContext> {
|
|
const baseURL = process.env.API_URL ?? 'http://127.0.0.1:7099';
|
|
return playwright.request.newContext({
|
|
baseURL,
|
|
extraHTTPHeaders: {
|
|
Authorization: `Bearer ${token}`,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
});
|
|
}
|