Stage session-attributes dirty-nav via Enable instead of TTL

The unsaved-changes guard only needs a dirty page. Staging TTL opened a
nested submenu that flakes under Playwright. Enable is a single click;
TTL presets stay covered by the persist test.

Co-authored-by: mattermost-code <matty-code@mattermost.com>
This commit is contained in:
Cursor Agentandmattermost-code committed 2026-09-28 08:19:22 +00:00
1 parent 9b9509d439
commit f1be0169b7
2 files changed
+7 -6

No files matched your search

@@ -167,6 +167,7 @@ export default class SessionAttributes {
async enable(fieldId: string) {
await this.openDotMenu(fieldId);
await this.page.getByTestId(`session-attribute-enable-${fieldId}`).click();
await expect(this.dotMenu(fieldId)).toBeHidden();
}
/**
@@ -190,12 +190,12 @@ test.describe('System Console - Session Attributes', () => {
// # Navigate to Session Attributes page
await sa.goto();
// # Capture the rendered TTL, then stage a different TTL (24h)
const beforeTtl = (await sa.ttl(field.id).textContent())?.trim() ?? '';
await sa.setTtlPreset(field.id, 86400);
// # Stage Enable. This test only needs a dirty page; TTL/grace presets
// are covered by the persist test and their nested submenu is racy.
await sa.enable(field.id);
// * Verify the edit is staged and Save is enabled
await expect(sa.ttl(field.id)).toHaveText('24h');
await expect(sa.status(field.id)).toContainText('Enabled');
await expect(sa.saveButton).toBeEnabled();
// # Attempt to navigate away via the sidebar while dirty
@@ -213,8 +213,8 @@ test.describe('System Console - Session Attributes', () => {
// # Cancel the staged edit via the Save Changes panel
await sa.cancel();
// * Verify the TTL reverted and Save returned to disabled
await expect(sa.ttl(field.id)).toHaveText(beforeTtl);
// * Verify Enable reverted and Save returned to disabled
await expect(sa.status(field.id)).toContainText('Disabled');
await expect(sa.saveButton).toBeDisabled();
});