import * as __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__ from "@tachybase/test/e2e";
import * as __WEBPACK_EXTERNAL_MODULE_dayjs__ from "dayjs";
import * as __WEBPACK_EXTERNAL_MODULE__utils_mjs__ from "./utils.mjs";
(0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('Date display format in form', async (param)=>{
    let { page, mockPage } = param;
    await mockPage(__WEBPACK_EXTERNAL_MODULE__utils_mjs__.oneFormBlockWithDatetimeFields).goto();
    await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
        page,
        showMenu: async ()=>{
            await page.getByPlaceholder('Select date').hover();
            await page.getByLabel('block-item-CollectionField').hover();
            await page.getByLabel('designer-schema-settings-CollectionField-fieldSettings:FormItem-general').hover();
        },
        supportedOptions: [
            'Edit field title',
            'Display title',
            'Edit description',
            'Edit tooltip',
            'Required',
            'Set default value',
            'Pattern',
            'Date display format',
            'Delete'
        ]
    });
    await page.getByText('Date display format').click();
    await page.getByLabel('Show time').check();
    await page.getByRole('button', {
        name: 'HH:mm:ss',
        exact: true
    }).click();
    await page.getByRole('button', {
        name: 'OK'
    }).click();
    await page.getByPlaceholder('Select date').click();
    await page.getByText('Now').click();
    const value = await page.getByPlaceholder('Select date').inputValue();
    (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(value).toBe((0, __WEBPACK_EXTERNAL_MODULE_dayjs__["default"])(value).format('YYYY-MM-DD HH:mm:ss'));
});
(0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('Date display format in table', async (param)=>{
    let { page, mockPage, mockRecord } = param;
    await mockPage(__WEBPACK_EXTERNAL_MODULE__utils_mjs__.oneTableBlockWithDatetimeFields).goto();
    const date = new Date().toDateString();
    await mockRecord('general', {
        datetime: date
    });
    await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
        page,
        showMenu: async ()=>{
            await page.getByRole('button', {
                name: 'datetime'
            }).hover();
            await page.getByLabel('designer-schema-settings-TableV2.Column-fieldSettings:TableColumn-general').hover();
        },
        supportedOptions: [
            'Custom column title',
            'Column width',
            'Sortable',
            'Date display format',
            'Delete'
        ]
    });
    await page.getByText('Date display format').click();
    await page.getByLabel('Show time').check();
    await page.getByRole('button', {
        name: 'hh:mm:ss a'
    }).click();
    await page.getByRole('button', {
        name: 'OK'
    }).click();
    await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('button', {
        name: (0, __WEBPACK_EXTERNAL_MODULE_dayjs__["default"])(date).format('YYYY-MM-DD hh:mm:ss a')
    })).toBeVisible();
});
