mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-26 11:56:25 -08:00
fix(room-nav): keep the mobile options sheet mounted while it is open
This commit is contained in:
7 files changed
+7
-25
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
default: patch
|
||||
---
|
||||
|
||||
Keep the mobile room options sheet open instead of dismissing it as soon as the pointer leaves the room.
|
||||
@@ -82,8 +82,6 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
{
|
||||
// Playwright fixtures take a `use` callback, which the React hook rule
|
||||
// mistakes for the `use` hook.
|
||||
files: ['tests/e2e/**'],
|
||||
rules: {
|
||||
'react/rules-of-hooks': 'off',
|
||||
|
||||
@@ -4,17 +4,11 @@ export default defineConfig({
|
||||
testDir: './tests/e2e',
|
||||
testMatch: '**/*.spec.ts',
|
||||
snapshotPathTemplate: 'tests/e2e/__screenshots__/{projectName}/{testFileName}/{arg}{ext}',
|
||||
// Every context shares one Matrix account and device id from the seeded
|
||||
// storageState, so concurrent clients contend over sync and crypto state.
|
||||
// Parallelising would need a worker-scoped account fixture; the suite runs in
|
||||
// well under a minute serially, so it is not worth the plumbing.
|
||||
fullyParallel: false,
|
||||
workers: 1,
|
||||
// Locally a failure should surface at once; CI keeps retries for flakes.
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
reporter: [['html', { open: 'never' }], ['list']],
|
||||
globalSetup: './tests/e2e/global-setup.ts',
|
||||
// Tests run in 3-6s against a built app; this is headroom, not a wait budget.
|
||||
timeout: 60_000,
|
||||
expect: {
|
||||
toHaveScreenshot: { maxDiffPixelRatio: 0.01 },
|
||||
@@ -35,14 +29,9 @@ export default defineConfig({
|
||||
},
|
||||
],
|
||||
webServer: {
|
||||
// A real build, not the dev server: no HMR and no dependency optimiser, both
|
||||
// of which invalidate the module graph mid-run and make the suite lie.
|
||||
command: 'pnpm run build && pnpm exec vite preview --port 8080 --strictPort',
|
||||
url: 'http://localhost:8080',
|
||||
// Never reuse: a leftover server would silently serve a stale build. The
|
||||
// build is ~30s, which is worth paying to know what is under test.
|
||||
reuseExistingServer: false,
|
||||
// ~35s observed (31s build + preview start), with headroom for a cold CI box.
|
||||
timeout: 180_000,
|
||||
env: { NODE_OPTIONS: '--max-old-space-size=8192' },
|
||||
},
|
||||
|
||||
@@ -439,7 +439,7 @@ export function RoomNavItem({
|
||||
navigate(linkPath);
|
||||
};
|
||||
|
||||
const optionsVisible = hover || !!menuAnchor;
|
||||
const optionsVisible = hover || !!menuAnchor || isMobileMenuOpen;
|
||||
const isMutedRoom = notificationMode === RoomNotificationMode.Mute;
|
||||
const shouldShowUnreadIndicator = !isMutedRoom && (!!unread || hasRoomUnread);
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import { test as base } from '@playwright/test';
|
||||
import { AppShell } from '../pages/AppShell';
|
||||
|
||||
type Fixtures = {
|
||||
/** The signed-in app, already loaded and past the device banner. */
|
||||
app: AppShell;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
import type { Locator, Page } from '@playwright/test';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* How long the Matrix client may take to sync and paint the room list. One
|
||||
* definition so a cold start and a warm one are held to the same bar.
|
||||
*/
|
||||
export const CLIENT_READY_TIMEOUT = 30_000;
|
||||
|
||||
/** The signed-in app: room list, rail, and the menus reachable from them. */
|
||||
export class AppShell {
|
||||
readonly leaveRoomPrompt: Locator;
|
||||
|
||||
@@ -18,7 +13,6 @@ export class AppShell {
|
||||
this.createRoomButton = page.getByRole('button', { name: 'Create Room' }).first();
|
||||
}
|
||||
|
||||
/** Loads the app and waits until the seeded rooms are on screen. */
|
||||
async open(): Promise<void> {
|
||||
await this.page.goto('/');
|
||||
await expect(this.room('General')).toBeVisible({ timeout: CLIENT_READY_TIMEOUT });
|
||||
@@ -29,7 +23,6 @@ export class AppShell {
|
||||
return this.page.getByText(name).first();
|
||||
}
|
||||
|
||||
/** The unverified-device banner is not always present, so this is best effort. */
|
||||
async dismissDeviceBanner(): Promise<void> {
|
||||
await this.page
|
||||
.getByRole('button', { name: 'Dismiss' })
|
||||
@@ -48,7 +41,6 @@ export class RoomOptionsMenu {
|
||||
constructor(readonly page: Page) {}
|
||||
|
||||
async leaveRoom(): Promise<void> {
|
||||
// The mobile sheet can overflow the viewport, where a real pointer click fails.
|
||||
await this.page.getByRole('button', { name: 'Leave Room' }).dispatchEvent('click');
|
||||
await this.page.getByRole('button', { name: 'Leave Room' }).click();
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ test.describe('app shell', () => {
|
||||
await expect(page.getByText('Layout baseline seed message.')).toBeVisible();
|
||||
});
|
||||
|
||||
// `app` is requested so the fixture loads the shell before the snapshot.
|
||||
test('matches the shell layout baseline', async ({ app, page }) => {
|
||||
test.skip(!containerised, 'run via pnpm test:e2e:docker');
|
||||
await expect(app.room('General')).toBeVisible();
|
||||
|
||||
Reference in new issue
Block a user