generator-begcode
Version:
Spring Boot + Angular/React/Vue in one handy generator
97 lines (96 loc) • 3.67 kB
JavaScript
import { CLIENT_TEST_SRC_DIR } from '../generator-constants.js';
import { clientRootTemplatesBlock } from '../client/support/index.js';
const CYPRESS_TEMPLATE_SOURCE_DIR = `${CLIENT_TEST_SRC_DIR}cypress/`;
export const cypressFiles = {
common: [
{
templates: ['README.md.jhi.cypress'],
},
clientRootTemplatesBlock({
renameTo: (ctx, file) => `${ctx.clientDir}${file}`,
templates: ['cypress.config.ts'],
}),
clientRootTemplatesBlock({
condition: ctx => Boolean(ctx.eslintConfigFile),
templates: [{ sourceFile: 'eslint.config.js.jhi.cypress', destinationFile: ctx => `${ctx.eslintConfigFile}.jhi.cypress` }],
}),
],
clientTestFw: [
{
path: CYPRESS_TEMPLATE_SOURCE_DIR,
renameTo: (ctx, file) => `${ctx.cypressDir}${file}`,
templates: [
'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.applicationTypeMicroservice,
path: CYPRESS_TEMPLATE_SOURCE_DIR,
renameTo: (ctx, file) => `${ctx.cypressDir}${file}`,
templates: ['e2e/account/logout.cy.ts'],
},
{
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,
renameTo: (ctx, file) => `${ctx.clientDir}${file}`,
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: generator => !generator.skipMenu,
path: CYPRESS_TEMPLATE_SOURCE_DIR,
renameTo: ctx => `${ctx.cypressDir}e2e/entity/${ctx.entityFileName}.cy.ts`,
templates: ['e2e/entity/_entity_.cy.ts'],
},
],
};