Files
openobserve/tests/ui-testing/utils/apiUtils.js
T
Neha P 3ff97016cf test: e2e-stream-name (#6764)
Added a test to add stream name and assert if stream with uppercase
exists
add a stream with lowercase and assert if stream name with lowercase
exists
2025-05-08 20:16:03 +05:30

28 lines
795 B
JavaScript

export const getHeaders = () => {
const basicAuthCredentials = Buffer.from(
`${process.env["ZO_ROOT_USER_EMAIL"]}:${process.env["ZO_ROOT_USER_PASSWORD"]}`
).toString("base64");
return {
Authorization: `Basic ${basicAuthCredentials}`,
"Content-Type": "application/json",
};
};
export const getIngestionUrl = (orgId, streamName) => {
return `${process.env.INGESTION_URL}/api/${orgId}/${streamName}/_json`;
};
export const sendRequest = async (page, url, payload, headers) => {
return await page.evaluate(
async ({ url, headers, payload }) => {
const response = await fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
});
return await response.json();
},
{ url, headers, payload }
);
};