3939
4040 //todo: remove this later, once aem image is released, since sites rotary aem base image has "2.25.4"
4141 //let wcmVersion = ci.sh('mvn help:evaluate -Dexpression=core.wcm.components.version -q -DforceStdout', true);
42- let wcmVersion = "2.30.0 " ;
42+ let wcmVersion = "2.30.2 " ;
4343 ci . stage ( "Integration Tests" ) ;
4444 ci . dir ( qpPath , ( ) => {
4545 // Connect to QP
9696 ${ extras } \
9797 ${ ! CORE_COMPONENTS ? ci . addQpFileDependency ( config . modules [ 'core-forms-components-apps' ] /*, isLatestAddon ? true : false */ ) : '' } \
9898 ${ ! CORE_COMPONENTS ? ci . addQpFileDependency ( config . modules [ 'core-forms-components-af-apps' ] /*, isLatestAddon ? true : false */ ) : '' } \
99+ ${ ! CORE_COMPONENTS ? ci . addQpFileDependency ( config . modules [ 'core-forms-components-core' ] ) : '' } \
99100 ${ ! CORE_COMPONENTS ? ci . addQpFileDependency ( config . modules [ 'core-forms-components-af-core' ] ) : '' } \
100101 ${ ! CORE_COMPONENTS ? ci . addQpFileDependency ( config . modules [ 'core-forms-components-examples-apps' ] ) : '' } \
101102 ${ ! CORE_COMPONENTS ? ci . addQpFileDependency ( config . modules [ 'core-forms-components-examples-content' ] ) : '' } \
@@ -120,34 +121,136 @@ try {
120121 });
121122 }
122123 */
123-
124+ // add a sleep for 8 mins since 23482 version aem has become slow
125+ //ci.sh(`sleep 2m`);
124126 // Run UI tests
125127 if ( TYPE === 'cypress' ) {
126128 if ( AEM && AEM . includes ( "addon" ) ) {
127129 // explicitly add the rum bundle, since it is only available on publish tier
128130 // upload webvitals and disable api region
129131 const disableApiRegion = "curl -u admin:admin -X POST -d 'apply=true' -d 'propertylist=disable' -d 'disable=true' http://localhost:4502/system/console/configMgr/org.apache.sling.feature.apiregions.impl" ;
130132 ci . sh ( disableApiRegion ) ;
131- const installWebVitalBundle = `curl -u admin:admin \
132- -F bundlefile=@'${ buildPath } /it/core/src/main/resources/com.adobe.granite.webvitals-1.2.2.jar' \
133- -F name='com.adobe.granite.webvitals' \
134- -F action=install \
135- http://localhost:4502/system/console/bundles` ;
136- ci . sh ( installWebVitalBundle ) ;
137- // get the bundle id
138- const webVitalBundleId = ci . sh ( "curl -s -u admin:admin http://localhost:4502/system/console/bundles.json | jq -r '.data | map(select(.symbolicName == \"com.adobe.granite.webvitals\")) | .[0].id'" , true ) ;
139- console . log ( "Web Vital Bundle Id " + webVitalBundleId ) ;
140- if ( webVitalBundleId ) {
141- // start the web vital bundle
142- ci . sh ( `curl -u admin:admin -F action=start http://localhost:4502/system/console/bundles/${ webVitalBundleId } ` )
133+
134+ // Only remove duplicate bundles when testing SNAPSHOT builds (not specific CORE_COMPONENTS versions)
135+ if ( ! CORE_COMPONENTS ) {
136+ // Uninstall old af-core bundles to prevent adaptTo() conflicts
137+ // First, log all af-core bundles to debug which one we're keeping
138+ const allBundles = ci . sh ( 'curl -s -u admin:admin http://localhost:4502/system/console/bundles.json | jq -r \'.data | map(select(.symbolicName == "com.adobe.aem.core-forms-components-af-core")) | sort_by(.id | tonumber) | reverse | .[] | "ID: \\(.id) | Version: \\(.version) | State: \\(.state)"\'' , true ) ;
139+ console . log ( 'Found af-core bundles:' ) ;
140+ console . log ( allBundles ) ;
141+
142+ // Get SNAPSHOT bundle ID for later restart
143+ const afCoreSnapshotId = ci . sh ( 'curl -s -u admin:admin http://localhost:4502/system/console/bundles.json | jq -r \'.data | map(select(.symbolicName == "com.adobe.aem.core-forms-components-af-core" and (.version | contains("SNAPSHOT")))) | .[0].id\'' , true ) ;
144+
145+ // Keep the SNAPSHOT version (from build) and uninstall all others
146+ const oldBundlesInfo = ci . sh ( 'curl -s -u admin:admin http://localhost:4502/system/console/bundles.json | jq -r \'.data | map(select(.symbolicName == "com.adobe.aem.core-forms-components-af-core" and (.version | contains("SNAPSHOT") | not))) | .[] | "\\(.id)|\\(.version)"\'' , true ) ;
147+ if ( oldBundlesInfo && oldBundlesInfo . trim ( ) !== '' && oldBundlesInfo !== 'null' ) {
148+ console . log ( 'Uninstalling old af-core bundle versions to avoid conflicts' ) ;
149+ oldBundlesInfo . trim ( ) . split ( '\n' ) . forEach ( bundleInfo => {
150+ if ( bundleInfo && bundleInfo !== 'null' && bundleInfo . trim ( ) !== '' ) {
151+ const [ bundleId , version ] = bundleInfo . split ( '|' ) ;
152+ console . log ( ` Uninstalling bundle ${ bundleId } (version ${ version } )` ) ;
153+ ci . sh ( `curl -s -u admin:admin -F action=uninstall http://localhost:4502/system/console/bundles/${ bundleId } ` ) ;
154+ }
155+ } ) ;
156+ }
157+
158+ // Similarly, uninstall old core bundle versions
159+ const allCoreBundles = ci . sh ( 'curl -s -u admin:admin http://localhost:4502/system/console/bundles.json | jq -r \'.data | map(select(.symbolicName == "com.adobe.aem.core-forms-components-core")) | sort_by(.id | tonumber) | reverse | .[] | "ID: \\(.id) | Version: \\(.version) | State: \\(.state)"\'' , true ) ;
160+ console . log ( 'Found core bundles:' ) ;
161+ console . log ( allCoreBundles ) ;
162+
163+ // Get SNAPSHOT bundle ID for later restart
164+ const coreSnapshotId = ci . sh ( 'curl -s -u admin:admin http://localhost:4502/system/console/bundles.json | jq -r \'.data | map(select(.symbolicName == "com.adobe.aem.core-forms-components-core" and (.version | contains("SNAPSHOT")))) | .[0].id\'' , true ) ;
165+
166+ const oldCoreBundlesInfo = ci . sh ( 'curl -s -u admin:admin http://localhost:4502/system/console/bundles.json | jq -r \'.data | map(select(.symbolicName == "com.adobe.aem.core-forms-components-core" and (.version | contains("SNAPSHOT") | not))) | .[] | "\\(.id)|\\(.version)"\'' , true ) ;
167+ if ( oldCoreBundlesInfo && oldCoreBundlesInfo . trim ( ) !== '' && oldCoreBundlesInfo !== 'null' ) {
168+ console . log ( 'Uninstalling old core bundle versions to avoid conflicts' ) ;
169+ oldCoreBundlesInfo . trim ( ) . split ( '\n' ) . forEach ( bundleInfo => {
170+ if ( bundleInfo && bundleInfo !== 'null' && bundleInfo . trim ( ) !== '' ) {
171+ const [ bundleId , version ] = bundleInfo . split ( '|' ) ;
172+ console . log ( ` Uninstalling bundle ${ bundleId } (version ${ version } )` ) ;
173+ ci . sh ( `curl -s -u admin:admin -F action=uninstall http://localhost:4502/system/console/bundles/${ bundleId } ` ) ;
174+ }
175+ } ) ;
176+ }
177+
178+ // Restart SNAPSHOT bundles to ensure clean wiring after uninstalling old bundles
179+ if ( ( oldBundlesInfo && oldBundlesInfo . trim ( ) !== '' && oldBundlesInfo !== 'null' ) ||
180+ ( oldCoreBundlesInfo && oldCoreBundlesInfo . trim ( ) !== '' && oldCoreBundlesInfo !== 'null' ) ) {
181+
182+ // Stop SNAPSHOT bundles (using IDs fetched earlier)
183+ if ( afCoreSnapshotId && afCoreSnapshotId . trim ( ) !== '' && afCoreSnapshotId !== 'null' ) {
184+ console . log ( `Stopping af-core SNAPSHOT bundle (ID: ${ afCoreSnapshotId . trim ( ) } )...` ) ;
185+ ci . sh ( `curl -s -u admin:admin -F action=stop http://localhost:4502/system/console/bundles/${ afCoreSnapshotId . trim ( ) } ` ) ;
186+ }
187+ if ( coreSnapshotId && coreSnapshotId . trim ( ) !== '' && coreSnapshotId !== 'null' ) {
188+ console . log ( `Stopping core SNAPSHOT bundle (ID: ${ coreSnapshotId . trim ( ) } )...` ) ;
189+ ci . sh ( `curl -s -u admin:admin -F action=stop http://localhost:4502/system/console/bundles/${ coreSnapshotId . trim ( ) } ` ) ;
190+ }
191+
192+ console . log ( 'Waiting 10 seconds for bundles to stop...' ) ;
193+ ci . sh ( 'sleep 10' ) ;
194+
195+ // Start SNAPSHOT bundles
196+ if ( afCoreSnapshotId && afCoreSnapshotId . trim ( ) !== '' && afCoreSnapshotId !== 'null' ) {
197+ console . log ( `Starting af-core SNAPSHOT bundle (ID: ${ afCoreSnapshotId . trim ( ) } )...` ) ;
198+ ci . sh ( `curl -s -u admin:admin -F action=start http://localhost:4502/system/console/bundles/${ afCoreSnapshotId . trim ( ) } ` ) ;
199+ }
200+ if ( coreSnapshotId && coreSnapshotId . trim ( ) !== '' && coreSnapshotId !== 'null' ) {
201+ console . log ( `Starting core SNAPSHOT bundle (ID: ${ coreSnapshotId . trim ( ) } )...` ) ;
202+ ci . sh ( `curl -s -u admin:admin -F action=start http://localhost:4502/system/console/bundles/${ coreSnapshotId . trim ( ) } ` ) ;
203+ }
204+
205+ console . log ( 'Waiting 30 seconds for OSGi to re-wire bundles...' ) ;
206+ ci . sh ( 'sleep 10' ) ;
207+
208+ console . log ( 'Checking bundle stability...' ) ;
209+ let attempts = 0 ;
210+ const maxAttempts = 30 ; // 450 seconds additional wait if needed
211+ while ( attempts < maxAttempts ) {
212+ const inactiveBundles = ci . sh ( 'curl -s -u admin:admin http://localhost:4502/system/console/bundles.json | jq -r \'[.data[] | select(.state != "Active" and .state != "Fragment")] | length\'' , true ) ;
213+ const count = parseInt ( inactiveBundles . trim ( ) ) ;
214+ if ( count === 0 ) {
215+ console . log ( 'All bundles are active' ) ;
216+ break ;
217+ }
218+ console . log ( ` ${ count } bundles not active yet, waiting... (attempt ${ attempts + 1 } /${ maxAttempts } )` ) ;
219+ ci . sh ( 'sleep 15' ) ;
220+ attempts ++ ;
221+ }
222+
223+ if ( attempts >= maxAttempts ) {
224+ console . log ( 'Warning: Some bundles still not active, checking critical bundles...' ) ;
225+ const criticalBundles = ci . sh ( 'curl -s -u admin:admin http://localhost:4502/system/console/bundles.json | jq -r \'.data | map(select((.symbolicName | contains("core-forms-components")) and (.version | contains("SNAPSHOT")))) | .[] | "\\(.symbolicName): \\(.state)"\'' , true ) ;
226+ console . log ( 'Critical SNAPSHOT bundle states:' ) ;
227+ console . log ( criticalBundles ) ;
228+ }
229+ }
143230 }
231+
232+ // const installWebVitalBundle = `curl -u admin:admin \
233+ // -F bundlefile=@'${buildPath}/it/core/src/main/resources/com.adobe.granite.webvitals-1.2.2.jar' \
234+ // -F name='com.adobe.granite.webvitals' \
235+ // -F action=install \
236+ // http://localhost:4502/system/console/bundles`;
237+ // ci.sh(installWebVitalBundle);
238+ // // get the bundle id
239+ // const webVitalBundleId = ci.sh("curl -s -u admin:admin http://localhost:4502/system/console/bundles.json | jq -r '.data | map(select(.symbolicName == \"com.adobe.granite.webvitals\")) | .[0].id'", true);
240+ // console.log("Web Vital Bundle Id " + webVitalBundleId);
241+ // if (webVitalBundleId) {
242+ // // start the web vital bundle
243+ // ci.sh(`curl -u admin:admin -F action=start http://localhost:4502/system/console/bundles/${webVitalBundleId}`)
244+ // }
144245 }
145246 const [ node , script , ...params ] = process . argv ;
146247 let testSuites = params . join ( ',' ) ;
147248 if ( CORE_COMPONENTS ) {
148249 // we run only some test suites for older core components
149250 testSuites = "specs/prefill/customprefill.cy.js,specs/prefill/repeatableprefillwithzerooccurrencefortabaccordionwizard.cy.js,specs/actions/submit/submit.runtime.cy.js,specs/actions/render/render_with_openapi.cy.js" ;
150251 }
252+ // add a sleep for 8 mins since 23482 version aem has become slow
253+ //ci.sh(`sleep 9m`);
151254 // start running the tests
152255 ci . dir ( 'ui.tests' , ( ) => {
153256 let command = `mvn verify -U -B -Pcypress-ci -DENV_CI=true -DFORMS_FAR=${ AEM } -DspecFiles="${ testSuites } "` ;
0 commit comments