fix: prevent e2e test pollution from preferences shared state

Settings tests set defaultNoteMode to 'markdown' without resetting,
causing parallel sharing test to timeout when TiptapEditor wasn't
rendered (textarea shown instead). Two fixes:
- Reset preferences in settings tests after changing them
- Create note via API in sharing test (tests sharing, not note creation)
This commit is contained in:
Frederic Cabassut
2026-03-10 15:54:40 +01:00
parent 0a6bb051bc
commit fa60c65337
2 changed files with 18 additions and 7 deletions
+12
View File
@@ -26,6 +26,13 @@ test.describe('Settings — Preferences', () => {
// Then the note editor opens in markdown mode (textarea visible)
await expect(page.getByTestId('note-content-input')).toBeVisible();
// Cleanup: reset to richtext so parallel tests aren't affected
await page.getByTestId('close-editor-btn').click();
await page.goto('/settings/preferences');
const resetResponse = page.waitForResponse((res) => res.url().includes('/api/preferences') && res.request().method() === 'PUT');
await page.getByTestId('pref-mode-richtext').click();
await resetResponse;
});
test('Scenario: Footer toggle hides and shows footer', async ({
@@ -65,6 +72,11 @@ test.describe('Settings — Preferences', () => {
// Then the Markdown button is still selected (has primary styling)
const mdBtn = page.getByTestId('pref-mode-markdown');
await expect(mdBtn).toHaveClass(/font-medium/);
// Cleanup: reset to richtext so parallel tests aren't affected
const resetResponse = page.waitForResponse((res) => res.url().includes('/api/preferences') && res.request().method() === 'PUT');
await page.getByTestId('pref-mode-richtext').click();
await resetResponse;
});
});
+6 -7
View File
@@ -35,13 +35,12 @@ test.describe('Note Sharing', () => {
authenticatedPage: page,
collabPage
}) => {
// When the owner creates a note titled "Share Test"
await page.getByTestId('new-note-btn').click();
await page.getByTestId('note-title-input').fill('Share Test');
const editor = page.getByTestId('tiptap-editor').locator('.tiptap');
await editor.click();
await editor.pressSequentially('Shared content');
await page.getByTestId('close-editor-btn').click();
// Given a note titled "Share Test" exists
await page.request.post('/api/notes', {
data: { title: 'Share Test', content: 'Shared content' }
});
await page.reload();
await page.waitForLoadState('networkidle');
await expect(noteCard(page, 'Share Test')).toBeVisible();
// And the owner opens the share dialog and adds the collaborator