@@ -160,6 +160,7 @@ async function findItem(extSection: ExtensionsViewSection, title: string): Promi
160160 Logger . debug ( `Extension with title "${ searchTitle } " not found in section "${ sectionTitle } "` ) ;
161161 return undefined ;
162162}
163+
163164// get visible items from Extension view, transform this from array to sorted string and compares it with existed recommended extensions
164165async function getVisibleFilteredItemsAndCompareWithRecommended ( recommendations : string [ ] ) : Promise < boolean > {
165166 const extensionsView : SideBarView | undefined = await ( await new ActivityBar ( ) . getViewControl ( 'Extensions' ) ) ?. openView ( ) ;
@@ -180,20 +181,23 @@ async function getVisibleFilteredItemsAndCompareWithRecommended(recommendations:
180181 }
181182 Logger . debug ( 'marketplaceSection.getVisibleItems()' ) ;
182183 const allFoundRecommendedItems : ExtensionsViewItem [ ] = await marketplaceSection . getVisibleItems ( ) ;
184+
183185 const allFoundRecommendedAuthors : string [ ] = await Promise . all (
184186 allFoundRecommendedItems . map ( async ( item : ExtensionsViewItem ) : Promise < string > => await item . getAuthor ( ) )
185187 ) ;
186188
187189 const allFoundAuthorsAsSortedString : string = allFoundRecommendedAuthors . sort ( ) . toString ( ) ;
188- const allPublisherNamesAsSorString : string = recommendations . sort ( ) . toString ( ) ;
189- return allFoundAuthorsAsSortedString === allPublisherNamesAsSorString ;
190+ const allPublisherNamesAsSortedString : string = recommendations . sort ( ) . toString ( ) ;
191+ return allFoundAuthorsAsSortedString === allPublisherNamesAsSortedString ;
190192}
193+
191194// get visible items from Extension view, transform this from array to sorted string and compares it with existed installed extensions
192195async function getVisibleFilteredItemsAndCompareWithInstalled ( recommendations : string [ ] ) : Promise < boolean > {
193196 const extensionsView : SideBarView | undefined = await ( await new ActivityBar ( ) . getViewControl ( 'Extensions' ) ) ?. openView ( ) ;
194197 const [ marketplaceSection ] : ExtensionsViewSection [ ] = ( await extensionsView ?. getContent ( ) . getSections ( ) ) as ExtensionsViewSection [ ] ;
195198 Logger . debug ( 'marketplaceSection.getVisibleItems()' ) ;
196199 const allFoundRecommendedItems : ExtensionsViewItem [ ] = await marketplaceSection . getVisibleItems ( ) ;
200+
197201 const allFoundRecommendedAuthors : string [ ] = await Promise . all (
198202 allFoundRecommendedItems . map ( async ( item : ExtensionsViewItem ) : Promise < string > => await item . getAuthor ( ) )
199203 ) ;
@@ -203,6 +207,7 @@ async function getVisibleFilteredItemsAndCompareWithInstalled(recommendations: s
203207 // in some cases we can have installed not only recommended extensions with some samples (for example .Net)
204208 return allFoundAuthorsAsSortedString . includes ( allPublisherNamesAsSortString ) ;
205209}
210+
206211for ( const sample of samples ) {
207212 suite ( `Check if recommended extensions installed for ${ sample } ${ BASE_TEST_CONSTANTS . TEST_ENVIRONMENT } ` , function ( ) : void {
208213 const projectAndFileTests : ProjectAndFileTests = e2eContainer . get ( CLASSES . ProjectAndFileTests ) ;
@@ -292,10 +297,29 @@ for (const sample of samples) {
292297 recommendedExtensions = JSON . parse ( text . replace ( / \/ \* [ \s \S ] * ?\* \/ | (?< = [ ^ : ] ) \/ \/ .* | ^ \/ \/ .* / g, '' ) . trim ( ) ) ;
293298
294299 Logger . debug ( 'recommendedExtensions.recommendations: Get recommendations clear names using map().' ) ;
300+
301+ // skip the test if only redhat.fabric8-analytics extension is found in Dev Spaces 3.22.0 (issue CRW-9186)
302+ if ( BASE_TEST_CONSTANTS . OCP_VERSION === '3.22.0' && BASE_TEST_CONSTANTS . TESTING_APPLICATION_NAME ( ) === 'devspaces' ) {
303+ const dependencyAnalyticsExtensionName : string = 'redhat.fabric8-analytics' ;
304+ if (
305+ recommendedExtensions . recommendations . includes ( dependencyAnalyticsExtensionName ) &&
306+ recommendedExtensions . recommendations . length === 1
307+ ) {
308+ throw new Error (
309+ `Only '${ dependencyAnalyticsExtensionName } ' extension found. This extension will not be installed because of known issue https://issues.redhat.com/browse/CRW-9186`
310+ ) ;
311+ } else {
312+ recommendedExtensions . recommendations = recommendedExtensions . recommendations . filter (
313+ ( rec : string ) : boolean => ! rec . includes ( dependencyAnalyticsExtensionName )
314+ ) ;
315+ }
316+ }
317+
295318 parsedRecommendations = recommendedExtensions . recommendations . map ( ( rec : string ) : { name : string ; publisher : string } => {
296319 const [ publisher , name ] = rec . split ( '.' ) ;
297320 return { publisher, name } ;
298321 } ) ;
322+
299323 Logger . debug ( `Recommended extension for this workspace:\n${ JSON . stringify ( parsedRecommendations ) } .` ) ;
300324 publisherNames = parsedRecommendations . map ( ( rec : { name : string ; publisher : string } ) : string => rec . publisher ) ;
301325 expect ( parsedRecommendations , 'Recommendations not found' ) . not . empty ;
0 commit comments