Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -221,20 +221,31 @@ export default function WelcomeContent({ isAuthenticated }: WelcomeContentProps)
/>
</div>

{!isAuthenticated ? (
<p
style={{ animationDelay: '540ms' }}
className="text-muted-foreground kilo-fade-up pt-1 text-center text-xs"
<p
style={{ animationDelay: '540ms' }}
className="text-muted-foreground kilo-fade-up pt-1 text-center text-xs"
>
Not ready to choose?{' '}
<Link
href="/profile"
className="inline-flex items-center gap-1 rounded font-semibold text-white outline-none hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand-primary/60"
>
Already have an account?{' '}
<Link
href={signInHref}
className="text-brand-primary rounded font-semibold outline-none hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand-primary/60"
>
Sign in
</Link>
</p>
) : null}
Skip to dashboard
<ArrowRight className="h-3 w-3" />
</Link>
{!isAuthenticated ? (
<>
<span className="mx-2 text-muted-foreground/60">·</span>
Already have an account?{' '}
<Link
href={signInHref}
className="text-brand-primary rounded font-semibold outline-none hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand-primary/60"
>
Sign in
</Link>
</>
) : null}
</p>
</section>
</div>
);
Expand Down
41 changes: 41 additions & 0 deletions apps/web/tests/e2e/get-started-dashboard-link.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { test, expect } from '@chromatic-com/playwright';
import { randomUUID } from 'crypto';

test.describe('/get-started dashboard escape hatch', () => {
test.use({ storageState: { cookies: [], origins: [] } });

test('shows the dashboard link to signed-out users', async ({ page }) => {
await page.goto('/get-started');

const skipLink = page.getByRole('link', { name: /skip to dashboard/i });
await expect(skipLink).toBeVisible();
await expect(skipLink).toHaveAttribute('href', '/profile');
});

test('shows the dashboard link after fake login and survey skip', async ({ page }) => {
const uniqueId = randomUUID().slice(0, 8);
const testEmail = `test-get-started-${uniqueId}+stytchpass@example.com`;

await page.goto(`/users/sign_in?fakeUser=${encodeURIComponent(testEmail)}`);
await page.waitForURL(
url =>
url.pathname === '/customer-source-survey' ||
url.pathname === '/get-started' ||
url.pathname === '/profile',
{ timeout: 30000, waitUntil: 'networkidle' }
);

if (new URL(page.url()).pathname === '/customer-source-survey') {
await page.getByRole('button', { name: 'Skip' }).click();
await page.waitForURL(url => url.pathname === '/get-started' || url.pathname === '/profile', {
timeout: 15000,
waitUntil: 'networkidle',
});
}

await page.goto('/get-started');
const skipLink = page.getByRole('link', { name: /skip to dashboard/i });
await expect(skipLink).toBeVisible();
await expect(skipLink).toHaveAttribute('href', '/profile');
});
});