Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 26 additions & 28 deletions generators/cucumber/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ exports[`generator - cucumber with default config should match files snapshot 1`
<artifactId>cucumber-java</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit-platform-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-spring</artifactId>
Expand All @@ -59,28 +54,6 @@ exports[`generator - cucumber with default config should match files snapshot 1`
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<!--Work around. Surefire does not use JUnit's Test Engine discovery functionality -->
<id>prepare cucumber feature files</id>
<phase>integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo message="Running JUnit Platform CLI"/>
<java classname="org.junit.platform.console.ConsoleLauncher" fork="true" failonerror="true" newenvironment="true" maxmemory="512m" classpathref="maven.test.classpath">
<jvmarg value="-Dspring.profiles.active=testprod"/>
<arg value="--include-engine"/>
<arg value="cucumber"/>
<arg value="--scan-classpath"/>
<arg value="\${project.build.testOutputDirectory}"/>
</java>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
Expand All @@ -91,6 +64,25 @@ exports[`generator - cucumber with default config should match files snapshot 1`
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>e2e</id>
<properties>
<profile.e2e>,e2e</profile.e2e>
</properties>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit-platform-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>e2e</finalName>
</build>
</profile>
</profiles>
</project>
",
"stateCleared": "modified",
Expand All @@ -103,6 +95,10 @@ exports[`generator - cucumber with gradle build tool should match files snapshot
"build.gradle": {
"contents": "
dependencies {
runtimeOnly libs.junit.platform.launcher
testImplementation libs.junit.platform.commons
testImplementation libs.junit.platform.engine
testImplementation "io.cucumber:cucumber-junit-platform-engine"
// jhipster-needle-gradle-dependency
}
plugins {
Expand Down Expand Up @@ -144,7 +140,6 @@ dependencies {
"buildSrc/src/main/groovy/jhipster.cucumber-conventions.gradle": {
"contents": "dependencies {
testImplementation "io.cucumber:cucumber-java"
testImplementation "io.cucumber:cucumber-junit-platform-engine"
testImplementation "io.cucumber:cucumber-spring"
testImplementation "org.junit.platform:junit-platform-console"
implementation platform(libs.cucumber.bom)
Expand Down Expand Up @@ -191,6 +186,9 @@ check.dependsOn(cucumberTest)
[libraries]
cucumber-bom = { module = "io.cucumber:cucumber-bom", version = "'CUCUMBER-BOM-VERSION'" }
testng = { module = "org.testng:testng", version = "'TESTNG-VERSION'" }
junit-platform-commons = { module = "org.junit.platform:junit-platform-commons", version = "1.14.0" }
junit-platform-engine = { module = "org.junit.platform:junit-platform-engine", version = "1.14.0" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version = "1.14.0" }
# jhipster-needle-gradle-dependency-catalog-libraries - JHipster will add additional libraries versions
[plugins]
Expand Down
70 changes: 35 additions & 35 deletions generators/cucumber/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export default class CucumberGenerator extends JavaApplicationGenerator {
type: 'pom',
scope: 'import',
},
{ groupId: 'io.cucumber', artifactId: 'cucumber-junit-platform-engine', scope: 'test' },
{ groupId: 'io.cucumber', artifactId: 'cucumber-java', scope: 'test' },
{ groupId: 'io.cucumber', artifactId: 'cucumber-spring', scope: 'test' },
{ groupId: 'org.junit.platform', artifactId: 'junit-platform-console', scope: 'test' },
Expand All @@ -88,40 +87,6 @@ export default class CucumberGenerator extends JavaApplicationGenerator {
{
groupId: 'org.apache.maven.plugins',
artifactId: 'maven-antrun-plugin',
additionalContent: `
<executions>
<execution>
<!--Work around. Surefire does not use JUnit's Test Engine discovery functionality -->
<id>prepare cucumber feature files</id>
<phase>integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo message="Running JUnit Platform CLI"/>
<java classname="org.junit.platform.console.ConsoleLauncher"
fork="true"
failonerror="true"
newenvironment="true"
maxmemory="512m"
classpathref="maven.test.classpath">
<jvmarg value="-Dspring.profiles.active=testprod"/>${
application.reactive
? `
<jvmarg value="-XX:+AllowRedefinitionToAddDeleteMethods"/>`
: ''
}
<arg value="--include-engine"/>
<arg value="cucumber"/>
<arg value="--scan-classpath"/>
<arg value="\${project.build.testOutputDirectory}"/>
</java>
</target>
</configuration>
</execution>
</executions>
`,
},
],
},
Expand All @@ -132,6 +97,41 @@ export default class CucumberGenerator extends JavaApplicationGenerator {
source.addGradlePlugin?.({ id: 'jhipster.cucumber-conventions' });
}
},
addCucumberJunitPlatformEngine({ application, source }) {
if (application.buildToolGradle) {
source.addJavaDefinitions?.({
dependencies: [
{ groupId: 'io.cucumber', artifactId: 'cucumber-junit-platform-engine', scope: 'test' },
{ groupId: 'org.junit.platform', artifactId: 'junit-platform-engine', scope: 'test', version: '1.14.0' },
{ groupId: 'org.junit.platform', artifactId: 'junit-platform-commons', scope: 'test', version: '1.14.0' },
{ groupId: 'org.junit.platform', artifactId: 'junit-platform-launcher', scope: 'runtime', version: '1.14.0' },
],
});
}
if (application.buildToolMaven) {
source.addMavenDefinition!({
profiles: [
{
id: 'e2e',
content: `
<properties>
<profile.e2e>,e2e</profile.e2e>
</properties>
<build>
<finalName>e2e</finalName>
</build>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit-platform-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>`,
},
],
});
}
},
});
}

Expand Down
17 changes: 13 additions & 4 deletions generators/cypress/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,17 +305,26 @@ export default class CypressGenerator extends BaseApplicationGenerator<CypressEn
}
},
mavenProfile({ source }) {
(source as JavaSource).addMavenProfile?.({
id: 'e2e',
content: `
try {
const pomContent = this.readDestination('pom.xml')?.toString() ?? '';
const hasE2eProfile = pomContent.includes('<id>e2e</id>');

if (!hasE2eProfile) {
(source as JavaSource).addMavenProfile?.({
id: 'e2e',
content: `
<properties>
<profile.e2e>,e2e</profile.e2e>
</properties>
<build>
<finalName>e2e</finalName>
</build>
`,
});
});
}
} catch {
// pom.xml doesn't exist, skip maven profile configuration
}
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion generators/server/resources/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ feign-reactor-bom = { module = 'com.playtika.reactivefeign:feign-reactor-bom', v

# Cucumber
testng = { module = 'org.testng:testng', version = '7.11.0' }
cucumber-bom = { module = 'io.cucumber:cucumber-bom', version = '7.23.0' }
cucumber-bom = { module = 'io.cucumber:cucumber-bom', version = '7.30.0' }

mongock-bom = { module = 'io.mongock:mongock-bom', version = '5.5.1' }

Expand Down
Loading