import { CLIENT_TEST_SRC_DIR } from '../generator-constants.mjs';
import { clientRootTemplatesBlock } from '../client/support/index.mjs';
const CYPRESS_TEMPLATE_SOURCE_DIR = `${CLIENT_TEST_SRC_DIR}cypress/`;
export const cypressFiles = {
    common: [
        {
            templates: ['README.md.jhi.cypress'],
        },
        clientRootTemplatesBlock({
            templates: ['cypress.config.ts'],
        }),
    ],
    clientTestFw: [
        {
            path: CYPRESS_TEMPLATE_SOURCE_DIR,
            renameTo: (ctx, file) => `${ctx.cypressDir}${file}`,
            templates: [
                '.eslintrc.json',
                'fixtures/integration-test.png',
                'plugins/index.ts',
                'e2e/administration/administration.cy.ts',
                'support/commands.ts',
                'support/navbar.ts',
                'support/index.ts',
                'support/entity.ts',
                'support/management.ts',
                'tsconfig.json',
            ],
        },
        {
            condition: generator => !generator.authenticationTypeOauth2,
            path: CYPRESS_TEMPLATE_SOURCE_DIR,
            renameTo: (ctx, file) => `${ctx.cypressDir}${file}`,
            templates: ['e2e/account/login-page.cy.ts'],
        },
        {
            condition: generator => Boolean(generator.generateUserManagement),
            path: CYPRESS_TEMPLATE_SOURCE_DIR,
            renameTo: (ctx, file) => `${ctx.cypressDir}${file}`,
            templates: [
                'e2e/account/register-page.cy.ts',
                'e2e/account/settings-page.cy.ts',
                'e2e/account/password-page.cy.ts',
                'e2e/account/reset-password-page.cy.ts',
                'support/account.ts',
            ],
        },
        {
            condition: generator => generator.authenticationTypeOauth2,
            path: CYPRESS_TEMPLATE_SOURCE_DIR,
            renameTo: (ctx, file) => `${ctx.cypressDir}${file}`,
            templates: ['support/oauth2.ts'],
        },
    ],
    audit: [
        {
            condition: generator => generator.cypressAudit,
            path: CYPRESS_TEMPLATE_SOURCE_DIR,
            renameTo: (ctx, file) => `${ctx.cypressDir}${file}`,
            templates: ['e2e/lighthouse.audits.ts'],
        },
        clientRootTemplatesBlock({
            condition: generator => generator.cypressAudit,
            templates: ['cypress-audits.config.ts'],
        }),
    ],
    coverage: [
        {
            condition: generator => generator.cypressCoverage,
            path: CYPRESS_TEMPLATE_SOURCE_DIR,
            renameTo: (ctx, file) => `${ctx.cypressDir}${file}`,
            templates: ['plugins/global.d.ts'],
        },
    ],
};
export const cypressEntityFiles = {
    testsCypress: [
        {
            condition: ctx => !ctx.builtIn && !ctx.embedded,
            path: CYPRESS_TEMPLATE_SOURCE_DIR,
            renameTo: ctx => `${ctx.cypressDir}e2e/entity/${ctx.entityFileName}.cy.ts`,
            templates: ['e2e/entity/_entity_.cy.ts'],
        },
    ],
};
