Skip to content

Commit 0eeb132

Browse files
committed
resolved failed ci checkes
Signed-off-by: Yi Cai <[email protected]>
1 parent 4cd78f4 commit 0eeb132

File tree

6 files changed

+78
-11
lines changed

6 files changed

+78
-11
lines changed

workspaces/orchestrator/plugins/orchestrator-backend/src/service/api/mapping/V2Mappings.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ describe('scenarios to verify mapToProcessInstanceDTO', () => {
118118
const end = DateTime.fromISO(processIntanceV1.end as string, {
119119
setZone: true,
120120
});
121-
const duration = Duration.fromMillis(end.diff(start).toMillis()).toHuman();
121+
const duration = Duration.fromMillis(end.diff(start).toMillis())
122+
.shiftTo('hours', 'minutes', 'seconds')
123+
.toHuman({ unitDisplay: 'long' });
122124
// Act
123125
const result = mapToProcessInstanceDTO(processIntanceV1);
124126

@@ -144,7 +146,6 @@ describe('scenarios to verify mapToProcessInstanceDTO', () => {
144146
);
145147
expect(result.end).toEqual(processIntanceV1.end);
146148
expect(result.duration).toEqual(duration);
147-
expect(result.duration).toEqual('1 hour');
148149
expect(result.description).toEqual(processIntanceV1.description);
149150
expect(result.workflowdata).toEqual(
150151
// @ts-ignore

workspaces/orchestrator/plugins/orchestrator-backend/src/service/api/mapping/V2Mappings.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ export function mapToProcessInstanceDTO(
9494
setZone: true,
9595
});
9696
const duration = processInstance.end
97-
? Duration.fromMillis(end.diff(start).toMillis()).toHuman()
97+
? Duration.fromMillis(end.diff(start).toMillis())
98+
.shiftTo('hours', 'minutes', 'seconds')
99+
.toHuman({ unitDisplay: 'long' })
98100
: undefined;
99101

100102
let variables: Record<string, unknown> | undefined;

workspaces/quickstart/packages/app/e2e-tests/quick-start-admin-guest.spec.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,27 @@ test.describe('Test Quick Start plugin', () => {
9292
// Click and verify configureGit step
9393
// This is critical: both setupAuthentication and configureGit have the same CTA text "En savoir plus" in French
9494
// So we need to ensure we're getting the button from the configureGit step, not the setupAuthentication step
95-
await page.getByText(translations.steps.configureGit.title).click();
95+
const configureGitStepTitle = page.getByText(
96+
translations.steps.configureGit.title,
97+
);
98+
await configureGitStepTitle.click();
9699
// Wait for the configureGit step description to be visible to ensure the step has expanded
97100
const configureGitDescription = page.getByText(
98101
translations.steps.configureGit.description,
99102
);
100103
await configureGitDescription.waitFor({ state: 'visible' });
101-
// Find the button that's in the same parent container as the configureGit description
102-
// This ensures we get the button from the configureGit step, not from setupAuthentication
103-
const configureGitButton = configureGitDescription
104-
.locator('..')
105-
.locator('..')
104+
// Find the parent container (List) that contains both the description and the CTA
105+
// The structure is: List > ListItem (description) > ListItem (CTA)
106+
const parentList = configureGitDescription
107+
.locator('..') // ListItemText
108+
.locator('..') // ListItem
109+
.locator('..'); // List
110+
// Find the CTA button within this specific List container to avoid matching the setupAuthentication button
111+
const configureGitCta = parentList
106112
.getByRole('button', { name: translations.steps.configureGit.ctaTitle })
107113
.first();
108-
const href = await configureGitButton.getAttribute('href');
114+
await configureGitCta.waitFor({ state: 'visible' });
115+
const href = await configureGitCta.getAttribute('href');
109116
expect(href).toContain(
110117
'https://docs.redhat.com/en/documentation/red_hat_developer_hub/latest/html/integrating_red_hat_developer_hub_with_github/',
111118
);

workspaces/quickstart/packages/app/e2e-tests/quick-start-developer.spec.ts

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,42 @@ test.describe('Test Quick Start plugin', () => {
4444
});
4545

4646
test('Access Quick start as User', async ({ page }, testInfo: TestInfo) => {
47-
await page.waitForTimeout(1000);
47+
// Wait for the page to be ready
48+
await page.waitForLoadState('domcontentloaded');
49+
50+
// Wait for the quickstart drawer to be open (it adds a class to body when open)
51+
// If it's not open after a short wait, try to open it via the sidebar
52+
const drawerOpen = await page.evaluate(() => {
53+
return document.body.classList.contains('quickstart-drawer-open');
54+
});
55+
56+
if (!drawerOpen) {
57+
// Drawer might not be open, try to open it via sidebar or wait for it
58+
try {
59+
const quickstartSidebarItem = page
60+
.locator('nav')
61+
.getByText('Quickstart');
62+
await quickstartSidebarItem.waitFor({
63+
state: 'visible',
64+
timeout: 5000,
65+
});
66+
await quickstartSidebarItem.click();
67+
} catch {
68+
// Sidebar item might not be available, wait for drawer to open automatically
69+
// This can happen if role detection is still in progress
70+
}
71+
72+
// Wait for drawer to be open
73+
await page.waitForFunction(
74+
() => {
75+
return document.body.classList.contains('quickstart-drawer-open');
76+
},
77+
{ timeout: 15000 },
78+
);
79+
}
80+
81+
// Wait a bit more for the content to render
82+
await page.waitForTimeout(500);
4883
await uiHelper.verifyText(translations.header.title);
4984
await runAccessibilityTests(
5085
page,

workspaces/quickstart/packages/app/e2e-tests/utils/helper.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,24 @@ export async function switchToLocale(
6363
page: Page,
6464
locale: string,
6565
): Promise<void> {
66+
// Wait for the page to be ready and Settings link to be available
67+
// Use a more reliable approach - wait for the Settings link with a reasonable timeout
68+
await page.waitForLoadState('domcontentloaded');
69+
await page
70+
.getByRole('link', { name: 'Settings' })
71+
.waitFor({ state: 'visible', timeout: 10000 });
6672
await page.getByRole('link', { name: 'Settings' }).click();
73+
await page
74+
.getByRole('button', { name: 'English' })
75+
.waitFor({ state: 'visible', timeout: 5000 });
6776
await page.getByRole('button', { name: 'English' }).click();
77+
await page
78+
.getByRole('option', { name: locale })
79+
.waitFor({ state: 'visible', timeout: 5000 });
6880
await page.getByRole('option', { name: locale }).click();
81+
await page
82+
.locator('a')
83+
.filter({ hasText: 'Home' })
84+
.waitFor({ state: 'visible', timeout: 5000 });
6985
await page.locator('a').filter({ hasText: 'Home' }).click();
7086
}

workspaces/quickstart/packages/app/e2e-tests/utils/translations.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import { quickstartMessages } from '../../../../plugins/quickstart/src/translati
1919
import quickstartTranslationDe from '../../../../plugins/quickstart/src/translations/de.js';
2020
import quickstartTranslationFr from '../../../../plugins/quickstart/src/translations/fr.js';
2121
import quickstartTranslationEs from '../../../../plugins/quickstart/src/translations/es.js';
22+
import quickstartTranslationIt from '../../../../plugins/quickstart/src/translations/it.js';
23+
import quickstartTranslationJa from '../../../../plugins/quickstart/src/translations/ja.js';
2224
/* eslint-enable @backstage/no-relative-monorepo-imports */
2325

2426
export type QuickstartMessages = typeof quickstartMessages;
@@ -52,6 +54,10 @@ export function getTranslations(locale: string) {
5254
return transform(quickstartTranslationDe.messages);
5355
case 'es':
5456
return transform(quickstartTranslationEs.messages);
57+
case 'it':
58+
return transform(quickstartTranslationIt.messages);
59+
case 'ja':
60+
return transform(quickstartTranslationJa.messages);
5561
default:
5662
return quickstartMessages;
5763
}

0 commit comments

Comments
 (0)