Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions e2e/editor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,31 @@ test.describe('editor page', () => {
page.locator('.preview-console__messages')
).toContainText('hi from sketch', { timeout: 15_000 });
});

test('unauthenticated users cannot save sketches', async ({ page }) => {
// Verify save option is disabled in File menu
await page.getByRole('menuitem', { name: 'File' }).click();

const saveButton = page.locator('#file-save');

await expect(saveButton).toHaveAttribute('aria-disabled', 'true');
await expect(saveButton).toHaveAttribute(
'aria-label',
'Log in to save your sketch'
);

// Close menu if needed
await page.keyboard.press('Escape');

// Attempt save via keyboard shortcut
await page.locator('.editor-holder').click();
await page.keyboard.press('ControlOrMeta+S');

// Verify login prompt appears
await expect(
page.getByText(
'In order to save sketches, you must be logged in. Please Login or Sign Up.'
)
).toBeVisible();
});
});
Loading