mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-05 16:10:43 +00:00
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
56 lines
2.3 KiB
JavaScript
56 lines
2.3 KiB
JavaScript
const { test, expect, navigateToBase } = require('../../utils/enhanced-baseFixtures.js');
|
|
const testLogger = require('../../utils/test-logger.js');
|
|
const PageManager = require('../../../pages/page-manager.js');
|
|
const { getOrgIdentifier } = require('../../utils/cloud-auth.js');
|
|
|
|
test.describe("Function delete confirmation", () => {
|
|
test.describe.configure({ mode: 'serial' });
|
|
let pm;
|
|
let functionName;
|
|
|
|
test.beforeEach(async ({ page }, testInfo) => {
|
|
testLogger.testStart(testInfo.title, testInfo.file);
|
|
await navigateToBase(page);
|
|
pm = new PageManager(page);
|
|
functionName = `e2e_2812_${Date.now()}`;
|
|
// Created via API: the subject here is the delete confirmation, not the editor.
|
|
await pm.apiCleanup.createFunction(functionName, '.e2e_2812 = "x" \n .');
|
|
testLogger.info(`Created function ${functionName}`);
|
|
});
|
|
|
|
test.afterEach(async () => {
|
|
if (functionName) {
|
|
await pm.apiCleanup.deleteFunctionInOrg(pm.apiCleanup.org, functionName).catch((e) =>
|
|
testLogger.warn(`Function cleanup failed: ${e.message}`)
|
|
);
|
|
functionName = undefined;
|
|
}
|
|
});
|
|
|
|
test("deleting a function must ask first, and cancelling must keep it", {
|
|
tag: ['@bug-2812', '@P2', '@regression', '@pipelinesRegression', '@pipelinesRegressionFunctions']
|
|
}, async () => {
|
|
await pm.functionsPage.navigate(getOrgIdentifier());
|
|
await pm.functionsPage.searchFunction(functionName);
|
|
await pm.functionsPage.expectFunctionInList(functionName);
|
|
|
|
await pm.functionsPage.openDeleteConfirmFor(functionName);
|
|
const dialogText = await pm.functionsPage.getConfirmDialogText();
|
|
testLogger.info(`Confirm dialog text: ${dialogText}`);
|
|
|
|
expect(dialogText,
|
|
'Bug #2812: deleting a function must raise a confirmation, not delete silently'
|
|
).toContain(`Are you sure you want to delete the ${functionName} function?`);
|
|
|
|
await pm.functionsPage.cancelDeleteConfirm();
|
|
await pm.functionsPage.expectFunctionInList(functionName);
|
|
testLogger.info('Cancel left the function in place');
|
|
|
|
await pm.functionsPage.openDeleteConfirmFor(functionName);
|
|
await pm.functionsPage.acceptDeleteConfirm();
|
|
await pm.functionsPage.expectFunctionAbsent(functionName);
|
|
|
|
testLogger.info('PASSED: delete is confirmed before it happens (Bug #2812)');
|
|
});
|
|
});
|