blob: e4753cd2e19001ac8041258d4005e3ba13011a50 [file]
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
import { expect, test } from '@playwright/test';
const loggerName = `org.apache.doris.ui.M10BrowserProbe${Date.now()}`;
test.setTimeout(60_000);
test.afterEach(async ({ page }) => {
if (page.isClosed()) return;
await page.evaluate(async (name) => {
await fetch('/rest/v1/log', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ del_verbose: name }),
});
await fetch('/rest/v1/logout', { method: 'POST' });
}, loggerName).catch(() => undefined);
});
test('reads logs and safely adds, refreshes, and deletes a verbose logger', async ({ page }) => {
await page.goto('/login');
await page.getByLabel('Username').fill('root');
await page.getByRole('button', { name: 'Sign in' }).click();
await page.getByRole('menuitem', { name: /Log/ }).click();
await expect(page.getByRole('heading', { name: 'Log', exact: true })).toBeVisible();
await expect(page.getByText('INFO', { exact: true })).toBeVisible();
await expect(page.locator('.log-viewer')).toBeVisible();
await page.getByLabel('New verbose logger name').fill(loggerName);
await page.getByRole('button', { name: 'Add verbose name' }).click();
await expect(page.getByText(loggerName, { exact: true })).toBeVisible();
await page.reload();
await expect(page.getByText(loggerName, { exact: true })).toBeVisible();
await page.getByRole('button', { name: `Delete ${loggerName}` }).click();
await page.getByRole('button', { name: 'Delete', exact: true }).click();
await expect(page.getByText(loggerName, { exact: true })).toHaveCount(0);
});