Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(gfs-upload): harden large-file e2e setup

Alfredo Lopez8cf7bcdbafe2
diff --git a/control-ui/e2e/support/gfs-control-ui-session.ts b/control-ui/e2e/support/gfs-control-ui-session.ts
index d356bccc2..772c9d961 100644
--- a/control-ui/e2e/support/gfs-control-ui-session.ts
+++ b/control-ui/e2e/support/gfs-control-ui-session.ts
@@ -56,10 +56,25 @@ export async function loginControlUi(page: Page): Promise<void> {
.poll(() => page.evaluate(() => window.localStorage.getItem('controlUiAdminToken')))
.toBeNull()
- const remindLater = page.getByRole('button', { name: 'Remind me later' })
- if (await remindLater.isVisible({ timeout: 3_000 }).catch(() => false)) {
+ const accountAlert = page
+ .getByRole('status')
+ .filter({ hasText: /Set up your admin email|Confirm your admin email/ })
+ const remindLater = accountAlert.getByRole('button', {
+ name: 'Remind me later',
+ exact: true,
+ })
+
+ // The account reminder is allowed to arrive after the shell becomes ready.
+ // Register a user-visible dismissal handler so it cannot intercept a later
+ // GFS action, while retaining an immediate dismissal for the already-rendered
+ // case. This is test setup only; it does not mutate account state or mock the
+ // Control UI request path.
+ await page.addLocatorHandler(accountAlert, async () => {
+ if (await remindLater.isVisible().catch(() => false)) await remindLater.click()
+ })
+ if (await accountAlert.isVisible({ timeout: 3_000 }).catch(() => false)) {
await remindLater.click()
- await expect(remindLater).toBeHidden({ timeout: 10_000 })
+ await expect(accountAlert).toBeHidden({ timeout: 10_000 })
}
}
diff --git a/desktop-app/test/e2e-playwright/gfs-upload-v2.test.ts b/desktop-app/test/e2e-playwright/gfs-upload-v2.test.ts
index 69e837775..418eabffd 100644
--- a/desktop-app/test/e2e-playwright/gfs-upload-v2.test.ts
+++ b/desktop-app/test/e2e-playwright/gfs-upload-v2.test.ts
@@ -218,14 +218,37 @@ async function openFolder(
page: Page,
folderName: string
): Promise<{ browser: Locator; manageDialog: Locator }> {
- const accessibleResponse = page.waitForResponse(
- response => response.request().method() === 'GET' && response.url().includes('/external/gfs')
- )
- await openResourcesNavItem(page, 'nav-files')
- await accessibleResponse.catch(() => undefined)
- await expect(page.getByRole('heading', { name: 'Files', exact: true })).toBeVisible({
- timeout: 30_000,
- })
+ const filesHeading = page.getByRole('heading', { name: 'Files', exact: true })
+ const openFilesAttempt = async (timeout: number): Promise<void> => {
+ const accessibleResponse = page
+ .waitForResponse(
+ response =>
+ response.request().method() === 'GET' && response.url().includes('/external/gfs'),
+ { timeout }
+ )
+ .then(() => true)
+ .catch(() => false)
+ await openResourcesNavItem(page, 'nav-files')
+ await expect(filesHeading).toBeVisible({ timeout })
+ if (!(await accessibleResponse)) {
+ throw new Error('Desktop Files navigation did not produce the GFS accessibility response')
+ }
+ }
+
+ try {
+ await openFilesAttempt(15_000)
+ } catch (firstNavigationError) {
+ // The authenticated Desktop shell can finish its initial data refresh just
+ // after the first visible menu click and restore Chat. Retry the same user
+ // action once, bounded by the Files heading and its GFS request, instead of
+ // hiding the race behind a fixed sleep or navigating directly to a terminal
+ // route.
+ try {
+ await openFilesAttempt(30_000)
+ } catch {
+ throw firstNavigationError
+ }
+ }
const browser = page.getByRole('region', { name: 'Global File System browser' })
await expect(browser.getByRole('button', { name: folderName, exact: true })).toBeVisible({
timeout: 60_000,