diff --git a/generators/base-application/support/prepare-field.mjs b/generators/base-application/support/prepare-field.mjs index ff79c24d35f5..c859d2e0dfbe 100644 --- a/generators/base-application/support/prepare-field.mjs +++ b/generators/base-application/support/prepare-field.mjs @@ -51,11 +51,11 @@ const { BYTES, BYTE_BUFFER } = RelationalOnlyDBTypes; const fakeStringTemplateForFieldName = columnName => { let fakeTemplate; if (columnName === 'first_name') { - fakeTemplate = 'name.firstName'; + fakeTemplate = 'person.firstName'; } else if (columnName === 'last_name') { - fakeTemplate = 'name.lastName'; + fakeTemplate = 'person.lastName'; } else if (columnName === 'job_title') { - fakeTemplate = 'name.jobTitle'; + fakeTemplate = 'person.jobTitle'; } else if (columnName === 'telephone' || columnName === 'phone') { fakeTemplate = 'phone.number'; } else if (columnName === 'zip_code' || columnName === 'post_code') { @@ -89,7 +89,7 @@ const fakeStringTemplateForFieldName = columnName => { } else if (columnName === 'url') { fakeTemplate = 'internet.url'; } else { - fakeTemplate = 'random.words'; + fakeTemplate = 'word.words'; } return `{{${fakeTemplate}}}`; }; diff --git a/generators/base/support/faker.mts b/generators/base/support/faker.mts index e50ba08dcd97..27bcf1903f21 100644 --- a/generators/base/support/faker.mts +++ b/generators/base/support/faker.mts @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Faker, base } from '@faker-js/faker'; +import { Faker, base, en } from '@faker-js/faker'; import Randexp from 'randexp'; import { languageToJavaLanguage } from '../../languages/support/index.mjs'; @@ -67,7 +67,7 @@ export async function createFaker(nativeLanguage = 'en') { } const faker = new FakerWithRandexp({ - locale: [locale, base], + locale: [locale, base, en], }); faker.createRandexp = (pattern, m) => new RandexpWithFaker(pattern, m, faker); return faker; diff --git a/generators/cypress/templates/src/test/javascript/cypress/e2e/entity/_entity_.cy.ts.ejs b/generators/cypress/templates/src/test/javascript/cypress/e2e/entity/_entity_.cy.ts.ejs index 085cad90052f..f1a58ffe58fc 100644 --- a/generators/cypress/templates/src/test/javascript/cypress/e2e/entity/_entity_.cy.ts.ejs +++ b/generators/cypress/templates/src/test/javascript/cypress/e2e/entity/_entity_.cy.ts.ejs @@ -306,10 +306,11 @@ describe('<%= entityClass %> e2e test', () => { <%_ fields.filter(field => (!field.id || !field.autoGenerate) && !field.hidden && !field.readonly).forEach((field) => { const fieldName = field.fieldName; const fieldIsEnum = field.fieldIsEnum; - const fieldValue = !entityFakeData ? field.generateFakeData('cypress') : entityFakeData[field.fieldName]; + let fieldValue = !entityFakeData ? field.generateFakeData('cypress') : entityFakeData[field.fieldName]; if (fieldValue === undefined) { return; } + fieldValue = typeof fieldValue === 'string' ? fieldValue.replaceAll("'", "\\'") : fieldValue; _%> <%_ if (field.fieldTypeBoolean) { _%> @@ -321,15 +322,15 @@ describe('<%= entityClass %> e2e test', () => { cy.setFieldImageAsBytesOfEntity('<%= fieldName %>', 'integration-test.png', 'image/png'); <%_ } else if (fieldIsEnum) { _%> - cy.get(`[data-cy="<%= fieldName %>"]`).select('<%= fieldValue %>'); + cy.get(`[data-cy="<%= fieldName %>"]`).select('<%- fieldValue %>'); <%_ } else if (field.fieldTypeString || field.fieldTypeNumeric || field.fieldTypeLocalDate || field.fieldTypeTimed || field.fieldTypeDuration) { _%> - cy.get(`[data-cy="<%= fieldName %>"]`).type('<%= fieldValue %>'); - <% if (field.fieldTypeLocalDate || field.fieldTypeTimed || field.fieldTypeDuration) { %>cy.get(`[data-cy="<%= fieldName %>"]`).blur();<% } %> cy.get(`[data-cy="<%= fieldName %>"]`).should('have.value', '<%= fieldValue %>'); + cy.get(`[data-cy="<%= fieldName %>"]`).type('<%- fieldValue %>'); + <% if (field.fieldTypeLocalDate || field.fieldTypeTimed || field.fieldTypeDuration) { %>cy.get(`[data-cy="<%= fieldName %>"]`).blur();<% } %> cy.get(`[data-cy="<%= fieldName %>"]`).should('have.value', '<%- fieldValue %>'); <%_ } else { _%> - cy.get(`[data-cy="<%= fieldName %>"]`).type('<%= fieldValue %>'); - cy.get(`[data-cy="<%= fieldName %>"]`).invoke('val').should('match', new RegExp('<%= fieldValue %>')); + cy.get(`[data-cy="<%= fieldName %>"]`).type('<%- fieldValue %>'); + cy.get(`[data-cy="<%= fieldName %>"]`).invoke('val').should('match', new RegExp('<%- fieldValue %>')); <%_ } _%> <%_ }); _%> diff --git a/generators/liquibase-changelogs/__snapshots__/incremental-liquibase.spec.mts.snap b/generators/liquibase-changelogs/__snapshots__/incremental-liquibase.spec.mts.snap index afbe05c24bf3..359a556cc924 100644 --- a/generators/liquibase-changelogs/__snapshots__/incremental-liquibase.spec.mts.snap +++ b/generators/liquibase-changelogs/__snapshots__/incremental-liquibase.spec.mts.snap @@ -131,16 +131,16 @@ ROLE_USER }, "src/main/resources/config/liquibase/fake-data/20200102000100_entity_customer.csv": { "contents": "id;foo -1;ubiquitous -2;Awesome Hydrogen fluid -3;New AI -4;Bicycle -5;Chicken Views Mobility -6;similique elaborate -7;Officer -8;Planner Gasoline -9;sexy -10;redefine +1;yuck +2;for atop +3;uncurl +4;elaborate through weep +5;hopelessly +6;easily almost obvious +7;unionize joyously gah +8;half ink +9;psst majestically swiftly +10;ragged ", "stateCleared": "modified", }, @@ -263,16 +263,16 @@ ROLE_USER }, "src/main/resources/config/liquibase/fake-data/20200102000100_entity_customer.csv": { "contents": "id;foo -1;ubiquitous -2;Awesome Hydrogen fluid -3;New AI -4;Bicycle -5;Chicken Views Mobility -6;similique elaborate -7;Officer -8;Planner Gasoline -9;sexy -10;redefine +1;yuck +2;for atop +3;uncurl +4;elaborate through weep +5;hopelessly +6;easily almost obvious +7;unionize joyously gah +8;half ink +9;psst majestically swiftly +10;ragged ", "stateCleared": "modified", }, diff --git a/generators/liquibase-changelogs/incremental-liquibase.spec.mts b/generators/liquibase-changelogs/incremental-liquibase.spec.mts index 69af64102907..71a8cd49616f 100644 --- a/generators/liquibase-changelogs/incremental-liquibase.spec.mts +++ b/generators/liquibase-changelogs/incremental-liquibase.spec.mts @@ -1153,7 +1153,7 @@ entity Customer { entity: jdlApplicationEntitieWithByteTypes, bytesFields: true, testContent: - '1;geez;1369;../fake-data/blob/hipster.txt;../fake-data/blob/hipster.png;image/png;../fake-data/blob/hipster.png;image/png;Laptop;5650', + '1;so;27690;../fake-data/blob/hipster.txt;../fake-data/blob/hipster.png;image/png;../fake-data/blob/hipster.png;image/png;Desktop;28870', contentRequired: true, }, {