"use strict";
var __webpack_exports__ = {};
const e2e_namespaceObject = require("@tachybase/test/e2e");
const external_utils_js_namespaceObject = require("./utils.js");
e2e_namespaceObject.test.describe('where table data selector can be added', ()=>{
    (0, e2e_namespaceObject.test)('popup', async (param)=>{
        let { page, mockPage } = param;
        await (0, external_utils_js_namespaceObject.createTable)({
            page,
            mockPage,
            fieldName: 'manyToOne'
        });
        await page.getByLabel('checkbox').click();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CollectionField-general-form-general.manyToOne-manyToOne').getByTestId('select-data-picker')).toHaveText("1");
    });
});
e2e_namespaceObject.test.describe('configure actions', ()=>{
    (0, e2e_namespaceObject.test)('filter & add new & delete & refresh', async (param)=>{
        let { page, mockPage } = param;
        await (0, external_utils_js_namespaceObject.createTable)({
            page,
            mockPage,
            fieldName: 'manyToOne'
        });
        await page.getByLabel('schema-initializer-ActionBar-table:configureActions-users').hover();
        await page.getByRole('menuitem', {
            name: 'Filter'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Add new'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Delete'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Refresh'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Filter'
        }).getByRole('switch')).toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Add new'
        }).getByRole('switch')).toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Delete'
        }).getByRole('switch')).toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Refresh'
        }).getByRole('switch')).toBeChecked();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Filter'
        })).toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Add new'
        })).toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Delete'
        })).toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Refresh'
        })).toBeVisible();
        await page.getByLabel('schema-initializer-ActionBar-table:configureActions-users').hover();
        await page.getByRole('menuitem', {
            name: 'Filter'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Add new'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Delete'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Refresh'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Filter'
        }).getByRole('switch')).not.toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Add new'
        }).getByRole('switch')).not.toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Delete'
        }).getByRole('switch')).not.toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Refresh'
        }).getByRole('switch')).not.toBeChecked();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Filter'
        })).not.toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Add new'
        })).not.toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Delete'
        })).not.toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Refresh'
        })).not.toBeVisible();
    });
    (0, e2e_namespaceObject.test)('customize: bulk update', async (param)=>{
        let { page, mockPage } = param;
        await (0, external_utils_js_namespaceObject.createTable)({
            page,
            mockPage,
            fieldName: 'manyToOne'
        });
        await page.getByLabel('schema-initializer-ActionBar-table:configureActions-users').hover();
        await page.getByRole('menuitem', {
            name: 'Customize'
        }).hover();
        await page.getByRole('menuitem', {
            name: 'Bulk update'
        }).click();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Bulk update'
        })).toBeVisible();
    });
});
e2e_namespaceObject.test.describe('configure actions column', ()=>{
    (0, e2e_namespaceObject.test)('column width', async (param)=>{
        let { page, mockPage } = param;
        await (0, external_utils_js_namespaceObject.createTable)({
            page,
            mockPage,
            fieldName: 'manyToOne'
        });
        await createActionColumn(page);
        const expectActionsColumnWidth = async (width)=>{
            await page.mouse.move(0, 300);
            const box = await page.getByRole('columnheader', {
                name: 'Actions',
                exact: true
            }).boundingBox();
            (0, e2e_namespaceObject.expect)(Math.floor(box.width)).toBe(width);
        };
        await expectActionsColumnWidth(200);
        await page.getByText('Actions', {
            exact: true
        }).hover();
        await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-users').hover();
        await page.getByRole('menuitem', {
            name: 'Column width'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('dialog').getByText('Column width')).toBeVisible();
        await page.getByRole('dialog').getByRole('spinbutton').click();
        await page.getByRole('dialog').getByRole('spinbutton').fill('400');
        await page.getByTestId('modal-Action.Modal-users-Column width').getByRole('button', {
            name: 'Submit'
        }).click();
        await expectActionsColumnWidth(400);
    });
});
async function createActionColumn(page) {
    await page.getByLabel('schema-initializer-TableV2.Selector-table:configureColumns-users').hover();
    await page.getByRole('menuitem', {
        name: 'Action column'
    }).click();
}
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
