"use strict";
var __webpack_exports__ = {};
const e2e_namespaceObject = require("@tachybase/test/e2e");
const external_templatesOfBug_js_namespaceObject = require("./templatesOfBug.js");
e2e_namespaceObject.test.describe('where table block can be added', ()=>{
    (0, e2e_namespaceObject.test)('page', async (param)=>{
        let { page, mockPage } = param;
        await mockPage().goto();
        await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
        await (0, e2e_namespaceObject.createBlockInPage)(page, 'Table');
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CardItem-users-table')).toBeVisible();
    });
    (0, e2e_namespaceObject.test)('popup', async (param)=>{
        let { page, mockPage, mockRecord } = param;
        await mockPage(external_templatesOfBug_js_namespaceObject.T3686).goto();
        await mockRecord('parentCollection');
        const childRecord = await mockRecord('childCollection');
        await page.getByLabel('action-Action.Link-View').click();
        await page.getByLabel('schema-initializer-Grid-popup').hover();
        await page.getByRole('menuitem', {
            name: 'table Table right'
        }).hover();
        await page.getByRole('menuitem', {
            name: 'Associated records'
        }).hover();
        await page.getByRole('menuitem', {
            name: 'childAssociationField'
        }).click();
        await page.getByTestId('drawer-Action.Container-childCollection-View record').getByLabel('schema-initializer-TableV2-').hover();
        await page.getByRole('menuitem', {
            name: 'childTargetText'
        }).click();
        await page.getByLabel('schema-initializer-Grid-popup').hover();
        await page.getByRole('menuitem', {
            name: 'table Table right'
        }).hover();
        await page.getByRole('menuitem', {
            name: 'Associated records'
        }).hover();
        await page.getByRole('menuitem', {
            name: 'parentAssociationField'
        }).click();
        await page.getByLabel('schema-initializer-TableV2-table:configureColumns-parentTargetCollection').hover();
        await page.getByRole('menuitem', {
            name: 'parentTargetText'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CardItem-childTargetCollection-table').getByText(childRecord.childAssociationField[0].childTargetText)).toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CardItem-parentTargetCollection-table').getByText(childRecord.parentAssociationField[0].parentTargetText)).toBeVisible();
    });
});
e2e_namespaceObject.test.describe('configure actions', ()=>{
    (0, e2e_namespaceObject.test)('filter & add new & delete & refresh', async (param)=>{
        let { page, mockPage } = param;
        await mockPage(e2e_namespaceObject.oneEmptyTable).goto();
        await page.getByLabel('schema-initializer-ActionBar-table:configureActions-t_unp4scqamw9').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-t_unp4scqamw9').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: add record', async (param)=>{
        let { page, mockPage } = param;
        await mockPage(e2e_namespaceObject.oneEmptyTable).goto();
        await page.getByLabel('schema-initializer-ActionBar-table:configureActions-t_unp4scqamw9').hover();
        await page.getByRole('menuitem', {
            name: 'Customize'
        }).hover();
        await page.getByRole('menuitem', {
            name: 'add record'
        }).click();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Add record'
        })).toBeVisible();
    });
});
e2e_namespaceObject.test.describe('configure columns', ()=>{
    e2e_namespaceObject.test.describe.configure({
        retries: process.env.CI ? 4 : 0
    });
    (0, e2e_namespaceObject.test)('action column & display collection fields & display association fields', async (param)=>{
        let { page, mockPage } = param;
        await mockPage(e2e_namespaceObject.oneEmptyTable).goto();
        const configureColumnButton = page.getByLabel('schema-initializer-TableV2-table:configureColumns-t_unp4scqamw9');
        await (0, e2e_namespaceObject.expect)(page.getByText('Actions', {
            exact: true
        })).toBeVisible();
        await configureColumnButton.hover();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Action column'
        }).getByRole('switch')).toBeChecked();
        await page.getByRole('menuitem', {
            name: 'Action column'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Action column'
        }).getByRole('switch')).not.toBeChecked();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByText('Actions', {
            exact: true
        })).not.toBeVisible();
        await configureColumnButton.hover();
        await page.getByRole('menuitem', {
            name: 'Action column'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Action column'
        }).getByRole('switch')).toBeChecked();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByText('Actions', {
            exact: true
        })).toBeVisible();
        await configureColumnButton.hover();
        await page.getByRole('menuitem', {
            name: 'ID',
            exact: true
        }).click();
        await page.getByRole('menuitem', {
            name: 'One to one (belongs to)'
        }).first().click();
        await page.getByRole('menuitem', {
            name: 'One to one (has one)'
        }).first().click();
        await page.getByRole('menuitem', {
            name: 'Many to one'
        }).first().click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'ID',
            exact: true
        }).getByRole('switch')).toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'One to one (belongs to)'
        }).first().getByRole('switch')).toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'One to one (has one)'
        }).first().getByRole('switch')).toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Many to one'
        }).first().getByRole('switch')).toBeChecked();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'ID',
            exact: true
        })).toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'One to one (belongs to)',
            exact: true
        })).toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'One to one (has one)',
            exact: true
        })).toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Many to one',
            exact: true
        })).toBeVisible();
        await configureColumnButton.hover();
        await page.getByRole('menuitem', {
            name: 'ID',
            exact: true
        }).click();
        await page.getByRole('menuitem', {
            name: 'One to one (belongs to)'
        }).first().click();
        await page.getByRole('menuitem', {
            name: 'One to one (has one)'
        }).first().click();
        await page.getByRole('menuitem', {
            name: 'Many to one'
        }).first().click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'ID',
            exact: true
        }).getByRole('switch')).not.toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'One to one (belongs to)'
        }).first().getByRole('switch')).not.toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'One to one (has one)'
        }).first().getByRole('switch')).not.toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Many to one'
        }).first().getByRole('switch')).not.toBeChecked();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'ID',
            exact: true
        })).not.toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'One to one (belongs to)',
            exact: true
        })).not.toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'One to one (has one)',
            exact: true
        })).not.toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Many to one',
            exact: true
        })).not.toBeVisible();
        await configureColumnButton.hover();
        await page.getByRole('menuitem', {
            name: 'One to one (belongs to)'
        }).nth(1).hover();
        await page.getByRole('menuitem', {
            name: 'Nickname'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Nickname'
        }).getByRole('switch')).toBeChecked();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Nickname',
            exact: true
        })).toBeVisible();
        await configureColumnButton.hover();
        await page.getByRole('menuitem', {
            name: 'One to one (belongs to)'
        }).nth(1).hover();
        await page.getByRole('menuitem', {
            name: 'Nickname'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Nickname'
        }).getByRole('switch')).not.toBeChecked();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Nickname',
            exact: true
        })).not.toBeVisible();
    });
    e2e_namespaceObject.test.pgOnly('display inherit fields', async (param)=>{
        let { page, mockPage } = param;
    });
});
e2e_namespaceObject.test.describe('configure actions column', ()=>{
    (0, e2e_namespaceObject.test)('view & edit & delete & duplicate & customize', async (param)=>{
        let { page, mockPage, mockRecord } = param;
        const nocoPage = await mockPage(e2e_namespaceObject.oneEmptyTable).waitForInit();
        await mockRecord('t_unp4scqamw9');
        await nocoPage.goto();
        await page.getByText('Actions', {
            exact: true
        }).hover();
        await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-t_unp4scqamw9').hover();
        await page.getByRole('menuitem', {
            name: 'View'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Edit'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Delete'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Duplicate'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'View'
        }).getByRole('switch')).toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Edit'
        }).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: 'Duplicate'
        }).getByRole('switch')).toBeChecked();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByLabel('action-Action.Link-View-view-t_unp4scqamw9-table-0')).toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('action-Action.Link-Edit-update-t_unp4scqamw9-table-0')).toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('action-Action.Link-Delete-destroy-t_unp4scqamw9-table-0')).toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('action-Action.Link-Duplicate-duplicate-t_unp4scqamw9-table-0')).toBeVisible();
        await page.getByText('Actions', {
            exact: true
        }).hover();
        await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-t_unp4scqamw9').hover();
        await page.getByRole('menuitem', {
            name: 'View'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Edit'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Delete'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Duplicate'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'View'
        }).getByRole('switch')).not.toBeChecked();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Edit'
        }).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: 'Duplicate'
        }).getByRole('switch')).not.toBeChecked();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByLabel('action-Action.Link-View-view-t_unp4scqamw9-table-0')).not.toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('action-Action.Link-Edit-update-t_unp4scqamw9-table-0')).not.toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('action-Action.Link-Delete-destroy-t_unp4scqamw9-table-0')).not.toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('action-Action.Link-Duplicate-duplicate-t_unp4scqamw9-table-0')).not.toBeVisible();
        await page.getByText('Actions', {
            exact: true
        }).hover();
        await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-t_unp4scqamw9').hover();
        await page.getByRole('menuitem', {
            name: 'Customize'
        }).hover();
        await page.getByRole('menuitem', {
            name: 'Popup'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Update record'
        }).click();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByLabel('action-Action.Link-Popup-customize:popup-t_unp4scqamw9-table-0')).toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('action-Action.Link-Update record-customize:update-t_unp4scqamw9-table-0')).toBeVisible();
    });
    (0, e2e_namespaceObject.test)('column width', async (param)=>{
        let { page, mockPage } = param;
        await mockPage(e2e_namespaceObject.oneEmptyTable).goto();
        await (0, e2e_namespaceObject.expect)(page.getByRole('columnheader', {
            name: 'Actions',
            exact: true
        })).toHaveJSProperty('offsetWidth', 200);
        await page.getByText('Actions', {
            exact: true
        }).hover();
        await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-t_unp4scqamw9').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.getByRole('button', {
            name: 'Submit'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('columnheader', {
            name: 'Actions',
            exact: true
        })).toHaveJSProperty('offsetWidth', 400);
    });
});
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
});
