Skip to content

Commit a2a56d5

Browse files
committed
fix e2e failures and unskip skipped tests
1 parent eaa5337 commit a2a56d5

22 files changed

Lines changed: 276 additions & 112 deletions

File tree

workspaces/homepage/docs/cards/jokes.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

workspaces/homepage/e2e-tests/homepageCards.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ test.describe('Homepage Card Individual Tests', () => {
4949

5050
const actualHeadingText = await greetingHeading.textContent();
5151
// Use the full greeting phrase (e.g. "Good afternoon") to locate the card.
52-
// Using only the first word ("Good") would be too broad — other cards like
53-
// Random Joke can contain that word and match first (hasText is case-insensitive).
52+
// Using only the first word ("Good") would be too broad — other cards can
53+
// contain that word and match first (hasText is case-insensitive).
5454
const cardHeading = actualHeadingText
5555
? actualHeadingText.split(',')[0].trim()
5656
: translations.onboarding.greeting.goodMorning;

workspaces/homepage/e2e-tests/homepageCustomizable.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ test.describe.serial('Dynamic Home Page Customization', () => {
4747
await runAccessibilityTests(sharedPage, testInfo);
4848
});
4949

50-
// Skipping as of now; re-enable after https://github.com/backstage/backstage/issues/33317 is fixed
51-
test.skip('Verify All Cards Can Be Resized in Edit Mode', async ({
50+
test('Verify All Cards Can Be Resized in Edit Mode', async ({
5251
browser: _browser,
5352
}, testInfo) => {
5453
await homePageCustomization.enterEditMode();
@@ -86,7 +85,7 @@ test.describe.serial('Dynamic Home Page Customization', () => {
8685
sharedPage.getByText(/Good (morning|afternoon|evening)/),
8786
).toBeVisible();
8887

89-
await homePageCustomization.addWidget('Quick Access Card');
88+
await homePageCustomization.addWidget('Quick Access');
9089
await expect(sharedPage.getByText('Quick Access')).toBeVisible();
9190
});
9291

workspaces/homepage/mkdocs.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ nav:
2020
- Recently visited: cards/recently-visited.md
2121
- Top visited: cards/top-visited.md
2222
- Featured docs: cards/featured-docs.md
23-
- Jokes: cards/jokes.md
2423
- World clock: cards/worldclock.md
2524
- Extend with plugins:
2625
- Create a new card: create-a-new-card.md

workspaces/homepage/packages/app-legacy/src/App.tsx

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ import {
8181
RecentlyVisitedCard,
8282
TopVisitedCard,
8383
FeaturedDocsCard,
84-
JokeCard,
8584
WorldClock,
8685
HomePageCardMountPoint,
8786
} from '@red-hat-developer-hub/backstage-plugin-dynamic-home-page';
@@ -221,6 +220,7 @@ const cardMountPoints: HomePageCardMountPoint[] = [
221220
Component: EntitySection,
222221
config: {
223222
id: 'rhdh-entity-section',
223+
titleKey: 'entities.title',
224224
priority: 201,
225225
layouts: layouts.entity,
226226
},
@@ -229,6 +229,7 @@ const cardMountPoints: HomePageCardMountPoint[] = [
229229
Component: TemplateSection,
230230
config: {
231231
id: 'rhdh-template-section',
232+
titleKey: 'templates.title',
232233
priority: 200,
233234
layouts: layouts.template,
234235
},
@@ -239,7 +240,7 @@ const cardMountPoints: HomePageCardMountPoint[] = [
239240
config: {
240241
priority: 202,
241242
id: 'quickaccess-card',
242-
title: 'Quick Access Card',
243+
titleKey: 'quickAccess.title',
243244
layouts: layouts.quickAccessCard,
244245
},
245246
},
@@ -321,35 +322,28 @@ const cardMountPoints: HomePageCardMountPoint[] = [
321322
Component: CatalogStarredEntitiesCard,
322323
config: {
323324
id: 'catalog-starred-entities-card',
324-
title: 'Starred catalog entities',
325+
titleKey: 'starredEntities.title',
325326
},
326327
},
327328
{
328329
Component: RecentlyVisitedCard as ComponentType,
329330
config: {
330331
id: 'recently-visited-card',
331-
title: 'Recently visited',
332+
titleKey: 'recentlyVisited.title',
332333
},
333334
},
334335
{
335336
Component: TopVisitedCard as ComponentType,
336337
config: {
337338
id: 'top-visited-card',
338-
title: 'Top visited',
339+
titleKey: 'topVisited.title',
339340
},
340341
},
341342
{
342343
Component: FeaturedDocsCard as ComponentType,
343344
config: {
344345
id: 'featured-docs-card',
345-
title: 'Featured docs',
346-
},
347-
},
348-
{
349-
Component: JokeCard,
350-
config: {
351-
id: 'joke-card',
352-
title: 'Random joke',
346+
titleKey: 'featuredDocs.title',
353347
},
354348
},
355349
{

workspaces/homepage/plugins/dynamic-home-page/dev/legacy.tsx

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import {
4343
DynamicHomePageProps,
4444
FeaturedDocsCard,
4545
Headline,
46-
JokeCard,
4746
Markdown,
4847
MarkdownCard,
4948
Placeholder,
@@ -178,13 +177,6 @@ const defaultMountPoints: HomePageCardMountPoint[] = [
178177
title: 'Featured docs card',
179178
},
180179
},
181-
{
182-
Component: JokeCard,
183-
config: {
184-
id: 'JokeCard',
185-
title: 'Joke card',
186-
},
187-
},
188180
];
189181

190182
const createHeadline = ({
@@ -724,17 +716,6 @@ createDevApp()
724716
],
725717
}),
726718
)
727-
.addPage(
728-
createPage({
729-
navTitle: 'JokeCard',
730-
pageTitle: 'JokeCard',
731-
mountPoints: [
732-
{
733-
Component: JokeCard,
734-
},
735-
],
736-
}),
737-
)
738719
.addPage(
739720
createPage({
740721
navTitle: 'WorldClock',

workspaces/homepage/plugins/dynamic-home-page/report-alpha.api.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,30 @@ export const homePageModule: FrontendModule;
1414
export const homepageTranslationRef: TranslationRef<
1515
'plugin.homepage',
1616
{
17-
readonly 'header.local': string;
1817
readonly 'header.welcome': string;
1918
readonly 'header.welcomePersonalized': string;
20-
readonly 'search.placeholder': string;
19+
readonly 'header.local': string;
2120
readonly 'homePage.empty': string;
21+
readonly 'search.placeholder': string;
2222
readonly 'quickAccess.title': string;
23-
readonly 'quickAccess.error': string;
2423
readonly 'quickAccess.fetchError': string;
24+
readonly 'quickAccess.error': string;
25+
readonly 'featuredDocs.title': string;
2526
readonly 'featuredDocs.learnMore': string;
26-
readonly 'templates.title': string;
27-
readonly 'templates.error': string;
27+
readonly 'starredEntities.title': string;
28+
readonly 'recentlyVisited.title': string;
29+
readonly 'topVisited.title': string;
2830
readonly 'templates.empty': string;
31+
readonly 'templates.title': string;
2932
readonly 'templates.fetchError': string;
33+
readonly 'templates.error': string;
3034
readonly 'templates.emptyDescription': string;
3135
readonly 'templates.register': string;
3236
readonly 'templates.viewAll': string;
33-
readonly 'onboarding.guest': string;
3437
readonly 'onboarding.greeting.goodMorning': string;
3538
readonly 'onboarding.greeting.goodAfternoon': string;
3639
readonly 'onboarding.greeting.goodEvening': string;
40+
readonly 'onboarding.guest': string;
3741
readonly 'onboarding.getStarted.title': string;
3842
readonly 'onboarding.getStarted.description': string;
3943
readonly 'onboarding.getStarted.buttonText': string;
@@ -46,11 +50,11 @@ export const homepageTranslationRef: TranslationRef<
4650
readonly 'onboarding.learn.description': string;
4751
readonly 'onboarding.learn.buttonText': string;
4852
readonly 'onboarding.learn.ariaLabel': string;
49-
readonly 'entities.title': string;
50-
readonly 'entities.error': string;
5153
readonly 'entities.close': string;
5254
readonly 'entities.empty': string;
55+
readonly 'entities.title': string;
5356
readonly 'entities.fetchError': string;
57+
readonly 'entities.error': string;
5458
readonly 'entities.emptyDescription': string;
5559
readonly 'entities.register': string;
5660
readonly 'entities.description': string;

workspaces/homepage/plugins/dynamic-home-page/report.api.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,6 @@ export interface HomePageCardMountPointConfig {
144144
titleKey?: string;
145145
}
146146

147-
// @public (undocumented)
148-
export const JokeCard: ComponentType<{
149-
defaultCategory?: 'any' | 'programming';
150-
}>;
151-
152147
// @public (undocumented)
153148
export interface Layout {
154149
// (undocumented)
@@ -223,6 +218,8 @@ export interface QuickAccessCardProps {
223218
path?: string;
224219
// (undocumented)
225220
title?: string;
221+
// (undocumented)
222+
titleKey?: string;
226223
}
227224

228225
// @public (undocumented)

workspaces/homepage/plugins/dynamic-home-page/src/alpha/extensions/homePageCards.tsx

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { HomePageWidgetBlueprint } from '@backstage/plugin-home-react/alpha';
1818
import homePlugin from '@backstage/plugin-home/alpha';
1919
import { compatWrapper } from '@backstage/core-compat-api';
2020
import { homepageMessages } from '../../translations/ref';
21+
import { createTranslatedCardRenderer } from '../../utils/translatedCardRenderer';
2122

2223
const defaultCardLayout = {
2324
width: {
@@ -63,6 +64,7 @@ export const entitySectionWidget = HomePageWidgetBlueprint.make({
6364
components: () =>
6465
import('../../components/EntitySection/EntitySection').then(m => ({
6566
Content: m.EntitySectionContent,
67+
Renderer: createTranslatedCardRenderer('entities.title'),
6668
})),
6769
},
6870
});
@@ -80,6 +82,7 @@ export const templateSectionWidget = HomePageWidgetBlueprint.make({
8082
components: () =>
8183
import('../../components/TemplateSection/TemplateSection').then(m => ({
8284
Content: m.TemplateSectionContent,
85+
Renderer: createTranslatedCardRenderer('templates.title'),
8386
})),
8487
},
8588
});
@@ -97,6 +100,9 @@ export const quickAccessCardWidget = HomePageWidgetBlueprint.make({
97100
components: () =>
98101
import('../../components/QuickAccessCard').then(m => ({
99102
Content: m.QuickAccessCardContent,
103+
Renderer: createTranslatedCardRenderer('quickAccess.title', {
104+
quickAccessStyle: true,
105+
}),
100106
})),
101107
},
102108
});
@@ -128,15 +134,14 @@ export const searchBarWidget = HomePageWidgetBlueprint.make({
128134
});
129135

130136
/**
131-
* Renders a legacy plugin-home CardExtension directly, skipping the NFS
132-
* CardExtension InfoCard shell. Used when upstream only exports full cards
133-
* (not Content) from the public API.
137+
* Renders upstream home cards that include their own InfoCard shell.
138+
* @alpha
134139
*/
135-
const legacyHomeCardRenderer = ({
140+
const upstreamHomeCardRenderer = ({
136141
Content,
137142
}: {
138143
Content: React.ComponentType;
139-
}) => compatWrapper(<Content />);
144+
}) => <Content />;
140145

141146
/**
142147
* NFS widget: FeaturedDocsCard (migrated from mountPoint home.page/cards).
@@ -146,11 +151,12 @@ export const featuredDocsCardWidget = HomePageWidgetBlueprint.make({
146151
name: 'featured-docs-card',
147152
params: {
148153
name: 'Featured docs',
154+
title: homepageMessages.featuredDocs.title,
149155
layout: defaultCardLayout,
150156
components: () =>
151157
import('../../components/FeaturedDocsCard').then(m => ({
152158
Content: m.FeaturedDocsCard,
153-
Renderer: legacyHomeCardRenderer,
159+
Renderer: upstreamHomeCardRenderer,
154160
})),
155161
},
156162
});
@@ -164,7 +170,14 @@ export const catalogStarredWidget = homePlugin
164170
.override({
165171
params: {
166172
name: 'CatalogStarred',
167-
title: 'Starred catalog entities',
173+
title: homepageMessages.starredEntities.title,
174+
components: () =>
175+
import('../../components/legacy/TranslatedUpstreamHomePageCards').then(
176+
m => ({
177+
Content: m.CatalogStarredEntitiesCard,
178+
Renderer: upstreamHomeCardRenderer,
179+
}),
180+
),
168181
},
169182
});
170183

@@ -187,11 +200,14 @@ export const RecentlyVisitedWidget = HomePageWidgetBlueprint.make({
187200
params: {
188201
layout: defaultCardLayout,
189202
name: 'Recently visited',
203+
title: homepageMessages.recentlyVisited.title,
190204
components: () =>
191-
import('@backstage/plugin-home').then(m => ({
192-
Content: m.HomePageRecentlyVisited,
193-
Renderer: legacyHomeCardRenderer,
194-
})),
205+
import('../../components/legacy/TranslatedUpstreamHomePageCards').then(
206+
m => ({
207+
Content: m.RecentlyVisitedCard,
208+
Renderer: upstreamHomeCardRenderer,
209+
}),
210+
),
195211
},
196212
});
197213

@@ -204,10 +220,13 @@ export const TopVisitedWidget = HomePageWidgetBlueprint.make({
204220
params: {
205221
layout: defaultCardLayout,
206222
name: 'Top visited',
223+
title: homepageMessages.topVisited.title,
207224
components: () =>
208-
import('@backstage/plugin-home').then(m => ({
209-
Content: m.HomePageTopVisited,
210-
Renderer: legacyHomeCardRenderer,
211-
})),
225+
import('../../components/legacy/TranslatedUpstreamHomePageCards').then(
226+
m => ({
227+
Content: m.TopVisitedCard,
228+
Renderer: upstreamHomeCardRenderer,
229+
}),
230+
),
212231
},
213232
});

0 commit comments

Comments
 (0)