|
| 1 | +import { expect, test } from './helpers/fixtures'; |
| 2 | + |
| 3 | +test.describe('disclaimer', () => { |
| 4 | + test('should accept the disclaimer', async ({ getProjectAuth, page }) => { |
| 5 | + // Get the auth token |
| 6 | + const auth = await getProjectAuth(); |
| 7 | + |
| 8 | + // Set localStorage to ensure disclaimer appears and set auth |
| 9 | + await page.addInitScript((accessToken) => { |
| 10 | + window.__PLAYWRIGHT_ACCESS_TOKEN__ = accessToken; |
| 11 | + // Set the app localStorage item to ensure disclaimer is not accepted |
| 12 | + localStorage.setItem('app', JSON.stringify({ state: { isDisclaimerAccepted: false }, version: 1 })); |
| 13 | + }, auth.accessToken); |
| 14 | + |
| 15 | + // Navigate to dashboard |
| 16 | + await page.goto('/dashboard'); |
| 17 | + |
| 18 | + // Wait for the disclaimer dialog to appear |
| 19 | + const disclaimerDialog = page.getByRole('dialog', { name: 'Disclaimer' }); |
| 20 | + await expect(disclaimerDialog).toBeVisible(); |
| 21 | + |
| 22 | + // Click the accept disclaimer button |
| 23 | + const acceptButton = page.getByRole('button', { name: 'Accept' }); |
| 24 | + await expect(acceptButton).toBeVisible(); |
| 25 | + await acceptButton.click(); |
| 26 | + |
| 27 | + // Verify the disclaimer dialog is no longer visible |
| 28 | + await expect(disclaimerDialog).not.toBeVisible(); |
| 29 | + |
| 30 | + // Verify we're still on the dashboard |
| 31 | + const pageHeader = page.getByTestId('page-header'); |
| 32 | + await expect(pageHeader).toBeVisible(); |
| 33 | + await expect(pageHeader).toContainText('Dashboard'); |
| 34 | + }); |
| 35 | +}); |
0 commit comments