"use strict";
var __webpack_exports__ = {};
const schema_namespaceObject = require("@tachybase/schema");
const e2e_namespaceObject = require("@tachybase/test/e2e");
const external_templatesOfBug_js_namespaceObject = require("./templatesOfBug.js");
e2e_namespaceObject.test.describe('where creation form 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, 'Form');
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CardItem-users-form')).toBeVisible();
    });
});
e2e_namespaceObject.test.describe('configure fields', ()=>{
    (0, e2e_namespaceObject.test)('display collection fields & display association fields & add text', async (param)=>{
        let { page, mockPage } = param;
        await mockPage(e2e_namespaceObject.oneEmptyForm).goto();
        await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover();
        await page.getByRole('menuitem', {
            name: 'ID',
            exact: true
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'ID',
            exact: true
        }).getByRole('switch')).toBeChecked();
        await page.getByRole('menuitem', {
            name: 'Many to one'
        }).nth(1).hover();
        await page.getByRole('menuitem', {
            name: 'Nickname'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Many to one'
        }).nth(1).hover();
        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.getByLabel('block-item-CollectionField-general-form-general.id-ID')).toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CollectionField-general-form-general.manyToOne.nickname')).toBeVisible();
        await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover();
        await page.getByRole('menuitem', {
            name: 'ID',
            exact: true
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'ID',
            exact: true
        }).getByRole('switch')).not.toBeChecked();
        await page.getByRole('menuitem', {
            name: 'Many to one'
        }).nth(1).hover();
        await page.getByRole('menuitem', {
            name: 'Nickname'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Many to one'
        }).nth(1).hover();
        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.getByLabel('block-item-CollectionField-general-form-general.id-ID')).not.toBeVisible();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CollectionField-general-form-general.manyToOne.nickname')).not.toBeVisible();
        await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover();
        await page.getByRole('menuitem', {
            name: 'Text'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-Markdown.Void-general-form')).toBeVisible();
    });
    e2e_namespaceObject.test.pgOnly('display inherit fields', async (param)=>{
        let { page, mockPage } = param;
    });
});
e2e_namespaceObject.test.describe('configure actions', ()=>{
    (0, e2e_namespaceObject.test)('submit', async (param)=>{
        let { page, mockPage } = param;
        await mockPage(e2e_namespaceObject.oneEmptyForm).goto();
        await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-general').hover();
        await page.getByRole('menuitem', {
            name: 'Submit'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Submit'
        }).getByRole('switch')).toBeChecked();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Submit'
        })).toBeVisible();
        await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-general').hover();
        await page.getByRole('menuitem', {
            name: 'Submit'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('menuitem', {
            name: 'Submit'
        }).getByRole('switch')).not.toBeChecked();
        await page.mouse.move(300, 0);
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Submit'
        })).not.toBeVisible();
    });
    (0, e2e_namespaceObject.test)('subTable: should clear form value after submit', async (param)=>{
        let { page, mockPage } = param;
        await mockPage(external_templatesOfBug_js_namespaceObject.T3106).goto();
        await page.getByRole('button', {
            name: 'Add new'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CollectionField-users-form-users.nickname-Nickname').getByRole('textbox')).toHaveValue('test name');
        await page.getByLabel('action-Action-Submit-submit-').click();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CollectionField-users-form-users.nickname-Nickname').getByRole('textbox')).toBeHidden();
        await page.getByRole('button', {
            name: 'Add new'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CollectionField-users-form-users.nickname-Nickname').getByRole('textbox')).toHaveValue('test name');
    });
    (0, e2e_namespaceObject.test)('default values for fields should not be cleared after submission', async (param)=>{
        let { page, mockPage } = param;
        await mockPage(external_templatesOfBug_js_namespaceObject.T3469).goto();
        const username = (0, schema_namespaceObject.uid)();
        await page.getByLabel('block-item-CollectionField-users-form-users.username-Username').getByRole('textbox').fill(username);
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CollectionField-users-form-users.nickname-Nickname').getByRole('textbox')).toHaveValue('Should be cleared after submission');
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CollectionField-users-form-users.username-Username').getByRole('textbox')).toHaveValue(username);
        await page.getByLabel('action-Action-Submit-submit-').click();
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CollectionField-users-form-users.nickname-Nickname').getByRole('textbox')).toHaveValue('Should be cleared after submission');
        await (0, e2e_namespaceObject.expect)(page.getByLabel('block-item-CollectionField-users-form-users.username-Username').getByRole('textbox')).toHaveValue('');
    });
    (0, e2e_namespaceObject.test)('customize: save record', async (param)=>{
        let { page, mockPage } = param;
        await mockPage(e2e_namespaceObject.oneEmptyForm).goto();
        await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-general').hover();
        await page.getByRole('menuitem', {
            name: 'Customize'
        }).hover();
        await page.getByRole('menuitem', {
            name: 'Save record'
        }).click();
        await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
            name: 'Save record'
        })).toBeVisible();
    });
});
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
});
