diff --git a/e2e/playwright/flow-tests.spec.ts b/e2e/playwright/flow-tests.spec.ts index 79bb1b9d4..7a4ca29c4 100644 --- a/e2e/playwright/flow-tests.spec.ts +++ b/e2e/playwright/flow-tests.spec.ts @@ -8,7 +8,8 @@ import { TEST_SETTINGS, TEST_SETTINGS_KEY, TEST_SETTINGS_CORRUPTED, - TEST_SETTINGS_ONBOARDING, + TEST_SETTINGS_ONBOARDING_EXPORT, + TEST_SETTINGS_ONBOARDING_START, } from './storageStates' import * as TOML from '@iarna/toml' @@ -680,6 +681,45 @@ test('Project settings can be set and override user settings', async ({ await expect(page.locator('select[name="app-theme"]')).toHaveValue('light') }) +test('Click through each onboarding step', async ({ page }) => { + const u = getUtils(page) + + // Override beforeEach test setup + await page.addInitScript( + async ({ settingsKey, settings }) => { + // Give no initial code, so that the onboarding start is shown immediately + localStorage.setItem('persistCode', '') + localStorage.setItem(settingsKey, settings) + }, + { + settingsKey: TEST_SETTINGS_KEY, + settings: TOML.stringify({ settings: TEST_SETTINGS_ONBOARDING_START }), + } + ) + + await page.setViewportSize({ width: 1200, height: 1080 }) + await page.goto('/') + await u.waitForAuthSkipAppStart() + + // Test that the onboarding pane loaded + await expect(page.getByText('Welcome to Modeling App! This')).toBeVisible() + + const nextButton = page.getByTestId('onboarding-next') + + while ((await nextButton.innerText()) !== 'Finish') { + await expect(nextButton).toBeVisible() + await nextButton.click() + } + + // Finish the onboarding + await expect(nextButton).toBeVisible() + await nextButton.click() + + // Test that the onboarding pane is gone + await expect(page.getByTestId('onboarding-content')).not.toBeVisible() + await expect(page.url()).not.toContain('onboarding') +}) + test('Onboarding redirects and code updating', async ({ page }) => { const u = getUtils(page) @@ -692,7 +732,7 @@ test('Onboarding redirects and code updating', async ({ page }) => { }, { settingsKey: TEST_SETTINGS_KEY, - settings: TOML.stringify({ settings: TEST_SETTINGS_ONBOARDING }), + settings: TOML.stringify({ settings: TEST_SETTINGS_ONBOARDING_EXPORT }), } ) diff --git a/e2e/playwright/storageStates.ts b/e2e/playwright/storageStates.ts index 5c83483ed..b5343a588 100644 --- a/e2e/playwright/storageStates.ts +++ b/e2e/playwright/storageStates.ts @@ -22,11 +22,16 @@ export const TEST_SETTINGS = { }, } satisfies Partial -export const TEST_SETTINGS_ONBOARDING = { +export const TEST_SETTINGS_ONBOARDING_EXPORT = { ...TEST_SETTINGS, app: { ...TEST_SETTINGS.app, onboardingStatus: '/export' }, } satisfies Partial +export const TEST_SETTINGS_ONBOARDING_START = { + ...TEST_SETTINGS, + app: { ...TEST_SETTINGS.app, onboardingStatus: '' }, +} satisfies Partial + export const TEST_SETTINGS_CORRUPTED = { app: { theme: Themes.Dark, diff --git a/src/components/ModelingSidebar/ModelingPane.tsx b/src/components/ModelingSidebar/ModelingPane.tsx index 966dc0ffb..dd86ea872 100644 --- a/src/components/ModelingSidebar/ModelingPane.tsx +++ b/src/components/ModelingSidebar/ModelingPane.tsx @@ -24,6 +24,7 @@ export const ModelingPaneHeader = ({ export const ModelingPane = ({ title, + id, children, className, Menu, @@ -43,6 +44,7 @@ export const ModelingPane = ({
{filteredPanes.map((pane) => ( - + {pane.Content instanceof Function ? ( ) : ( diff --git a/src/routes/Onboarding/CodeEditor.tsx b/src/routes/Onboarding/CodeEditor.tsx index 0f3c9d8ff..1b70f50f7 100644 --- a/src/routes/Onboarding/CodeEditor.tsx +++ b/src/routes/Onboarding/CodeEditor.tsx @@ -14,11 +14,7 @@ export default function CodeEditor() {