Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always add ci:server:await script #26393

Merged
merged 1 commit into from
Jun 10, 2024
Merged
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
15 changes: 9 additions & 6 deletions generators/server/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,15 +557,18 @@ export default class JHipsterServerGenerator extends BaseApplicationGenerator {
packageJsonE2eScripts({ application }) {
const scriptsStorage = this.packageJson.createStorage('scripts');
const buildCmd = application.buildToolGradle ? 'gradlew' : 'mvnw';

const applicationWaitTimeout = WAIT_TIMEOUT * (application.applicationTypeGateway ? 2 : 1);
const applicationEndpoint = application.applicationTypeMicroservice
? `http-get://127.0.0.1:${application.gatewayServerPort}/${application.endpointPrefix}/management/health/readiness`
: 'http-get://127.0.0.1:$npm_package_config_backend_port/management/health';
scriptsStorage.set({
'ci:server:await': `echo "Waiting for server at port $npm_package_config_backend_port to start" && wait-on -t ${applicationWaitTimeout} ${applicationEndpoint} && echo "Server at port $npm_package_config_backend_port started"`,
});

// TODO add e2eTests property to application.
if (this.jhipsterConfig.testFrameworks?.includes('cypress')) {
const applicationWaitTimeout = WAIT_TIMEOUT * (application.applicationTypeGateway ? 2 : 1);
const applicationEndpoint = application.applicationTypeMicroservice
? `http-get://127.0.0.1:${application.gatewayServerPort}/${application.endpointPrefix}/management/health/readiness`
: 'http-get://127.0.0.1:$npm_package_config_backend_port/management/health';

scriptsStorage.set({
'ci:server:await': `echo "Waiting for server at port $npm_package_config_backend_port to start" && wait-on -t ${applicationWaitTimeout} ${applicationEndpoint} && echo "Server at port $npm_package_config_backend_port started"`,
'pree2e:headless': 'npm run ci:server:await',
'ci:e2e:run': 'concurrently -k -s first "npm run ci:e2e:server:start" "npm run e2e:headless"',
'e2e:dev': `concurrently -k -s first "./${buildCmd}" "npm run e2e"`,
Expand Down
Loading