-
Notifications
You must be signed in to change notification settings - Fork 598
🩺(project) reload app if front and back unsync #2276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import path from 'path'; | |
| import { Locator, Page, TestInfo, expect } from '@playwright/test'; | ||
|
|
||
| import theme_customization from '../../../../../backend/impress/configuration/theme/default.json'; | ||
| import { version as packageJsonVersion } from '../../package.json'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the Impress package version, not the E2E package version, for
✅ Suggested fix-import { version as packageJsonVersion } from '../../package.json';
+import { version as packageJsonVersion } from '../../../impress/package.json';Also applies to: 44-44 🤖 Prompt for AI Agents |
||
|
|
||
| export type BrowserName = 'chromium' | 'firefox' | 'webkit'; | ||
| export const BROWSERS: BrowserName[] = ['chromium', 'webkit', 'firefox']; | ||
|
|
@@ -40,6 +41,7 @@ export const CONFIG = { | |
| ], | ||
| LANGUAGE_CODE: 'en-us', | ||
| POSTHOG_KEY: {}, | ||
| RELEASE_VERSION: packageJsonVersion, | ||
| SENTRY_DSN: null, | ||
| TRASHBIN_CUTOFF_DAYS: 30, | ||
| theme_customization, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the reload assertion deterministic to avoid flaky CI failures.
Line 165 uses a fixed sleep, and Line 174 expects an exact
/users/me/count. This is timing-sensitive and can intermittently fail with retries/background refetches. Also, register the route before triggering mismatch logic so the first hit is never missed.Suggested stabilization
test('checks redirect if unsync version', async ({ page }) => { + let counterReload = 0; + await page.route(/.*\/users\/me\/$/, async (route) => { + counterReload += 1; + await route.continue(); + }); + await overrideConfig(page, { RELEASE_VERSION: '0.0.0', }); - let counterReload = 0; - await page.route(/.*\/users\/me\/$/, async (route) => { - counterReload += 1; - await route.continue(); - }); - - await page.waitForTimeout(1000); - - // The sessionStorage guard should be set to the mismatched backend version. - const reloadVersion = await page.evaluate(() => - sessionStorage.getItem('reload-version'), - ); - expect(reloadVersion).toBe('0.0.0'); - - // The page should have reloaded once - expect(counterReload).toBe(2); + await expect + .poll( + () => page.evaluate(() => sessionStorage.getItem('reload-version')), + { timeout: 10000 }, + ) + .toBe('0.0.0'); + + // At least 2 calls proves initial load + post-reload load. + await expect.poll(() => counterReload, { timeout: 10000 }).toBeGreaterThanOrEqual(2); });🤖 Prompt for AI Agents