Skip to content
Merged
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
29 changes: 29 additions & 0 deletions __tests__/e2e/__snapshots__/done-migration-hint.e2e.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Done screen migration hint > shows /migrate-statsig hint when competitor is detected > done-with-migration-hint 1`] = `
" Confidence by Spotify https://confidence.spotify.com/


✔ Confidence is ready!

We've taught Claude Code Confidence skills—try them out with slash commands.
For example, run /migrate-statsig to migrate existing feature flags to Confidence.

What we have set up:
● Added feature flag example
● Created confidence.config.ts


Full report: [CONFIDENCE_QUICKSTART.md]
Documentation: https://confidence.spotify.com/docs
Dashboard: https://app.confidence.spotify.com


──────────────────────────────────────────────────────────────────────────────────────────────────
What's next?

❯ Continue work with Claude Code
Exit

↑↓ navigate enter confirm esc cancel vX.Y.Z"
`;
2 changes: 2 additions & 0 deletions __tests__/e2e/__snapshots__/happy-path.e2e.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ exports[`happy-path flow > navigates Welcome → SystemCheck → Authenticate
✔ Confidence is ready!
We've taught Claude Code Confidence skills—try them out with slash commands.
What we have set up:
● Added feature flag example
● Created confidence.config.ts
Expand Down
21 changes: 0 additions & 21 deletions __tests__/e2e/__snapshots__/select-goal.e2e.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,3 @@ exports[`SelectGoal screen > shows goal options for a browser framework > select

↑↓ navigate enter confirm vX.Y.Z"
`;

exports[`SelectGoal screen > shows migration directly for non-browser project with competitors > select-goal-migration 1`] = `
" Confidence by Spotify https://confidence.spotify.com/

Migrate existing flags? Todo (4/5)

Found Statsig in your project. Would you like to migrate their ● Check system
flags to Confidence? ● Sign in to Confidence
● Set up your agent
● Connect tools
▶ Onboard project


──────────────────────────────────────────────────────────────────────────────────────────────────
Found Statsig flags in code. How would you like to proceed?

❯ Just integrate Confidence
Integrate and migrate Statsig's flags

↑↓ navigate enter confirm vX.Y.Z"
`;
4 changes: 4 additions & 0 deletions __tests__/e2e/__snapshots__/skip-plugins.e2e.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ exports[`when the user skips installing AI plugin > does not show "Continue work
✔ Confidence is ready!
Check the quickstart report below for next steps.
What we have set up:
● Added feature flag example
● Created confidence.config.ts
Expand All @@ -30,6 +32,8 @@ exports[`when the user skips installing AI plugin > still shows report file and
✔ Confidence is ready!
Check the quickstart report below for next steps.
What we have set up:
● Added feature flag example
● Created confidence.config.ts
Expand Down
2 changes: 2 additions & 0 deletions __tests__/e2e/__snapshots__/skip-tools.e2e.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ exports[`when the user skips connecting tools > shows skip message and proceeds
✔ Confidence is ready!
We've taught Claude Code Confidence skills—try them out with slash commands.
What we have set up:
● Added feature flag example
● Created confidence.config.ts
Expand Down
24 changes: 23 additions & 1 deletion __tests__/e2e/chat-launch.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,29 @@ describe('when the user starts chat after onboarding', () => {
expect(prompt).toContain('I just set up Confidence');
expect(prompt).toContain('Changes made:');
expect(prompt).toContain('CONFIDENCE_QUICKSTART.md');
expect(prompt).toContain('continue working on my Confidence integration');
expect(prompt).toContain('Help me with next steps');
expect(prompt).toContain('Confidence AI plugin');
expect(prompt).toContain('/setup-warehouse');
expect(prompt).not.toContain('/migrate-');
});

it('includes migration hint when competitors are detected', async () => {
using session = createSession({ project: 'react-statsig' });

await navigateToOnboarding(session);
await session.press('Enter');
await session.waitForText('onboarding complete', { timeout: 30_000 });

await session.waitForText('Continue work with Claude Code');
await session.press('Enter');

const exitCode = await session.waitForExit();
expect(exitCode).toBe(0);

const prompt = readFileSync(join(session.cwd, CHAT_PROMPT_FILE), 'utf-8');
expect(prompt).toContain('Confidence AI plugin');
expect(prompt).toContain('/setup-warehouse');
expect(prompt).toContain('/migrate-');
});

it('sends an integration prompt when onboarding was skipped', async () => {
Expand Down
16 changes: 16 additions & 0 deletions __tests__/e2e/done-migration-hint.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createSession, navigateToOnboarding } from './testing-framework/index.js';

describe('Done screen migration hint', () => {
it('shows /migrate-statsig hint when competitor is detected', async () => {
using session = createSession({ project: 'react-statsig' });

await navigateToOnboarding(session);
await session.press('Enter');
await session.waitForText('onboarding complete', { timeout: 30_000 });

// Done
await session.waitForText('Confidence is ready');
await session.waitForText('/migrate-statsig');
expect(session.snapshot()).toMatchSnapshot('done-with-migration-hint');
});
});
10 changes: 5 additions & 5 deletions __tests__/e2e/select-goal.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ describe('SelectGoal screen', () => {
await session.waitForText('Onboarding skipped');
});

it('shows migration directly for non-browser project with competitors', async () => {
it('auto-advances for non-browser project', async () => {
using session = createSession({ project: 'statsig-node' });

await navigateToConnectTools(session);
session.checkpoint();
await session.press('Enter');

// Non-browser project with competitor + plugins → migration sub-phase
await session.waitForText('Migrate existing flags?');
await session.waitForText("Integrate and migrate Statsig's flags");
expect(session.snapshot()).toMatchSnapshot('select-goal-migration');
// Non-browser project auto-advances past goal selection to onboarding
await session.waitForText('Start onboarding?');
expect(session.snapshot()).toContain('add the Confidence SDK');
expect(session.snapshot()).toContain('create your first feature flag');
});
});
49 changes: 49 additions & 0 deletions __tests__/ui/screens/DoneScreen.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,55 @@ describe('DoneScreen', () => {
expect(sut.lastFrame()).toContain('confidence.config.ts');
});
});

it('shows continuation hint without plugins', async () => {
using sut = renderScreen(<DoneScreen />, { screen: ScreenId.Done, ide: 'claude' });
store.setCodeChanges(['Added @spotify-confidence/sdk']);
await waitFor(() => {
expect(sut.lastFrame()).toContain('Continue working in Claude Code');
});
});

it('shows skills hint when plugins are installed', async () => {
using sut = renderScreen(<DoneScreen />, {
screen: ScreenId.Done,
ide: 'claude',
plugins: ['claude'],
});
store.setCodeChanges(['Added @spotify-confidence/sdk']);
await waitFor(() => {
expect(sut.lastFrame()).toContain('Confidence skills');
expect(sut.lastFrame()).toContain('slash commands');
});
});

it('includes migration hint when providers are detected', async () => {
using sut = renderScreen(<DoneScreen />, {
screen: ScreenId.Done,
ide: 'claude',
plugins: ['claude'],
});
store.setDetectedProviders([
{ id: 'statsig', name: 'Statsig', skillName: 'migrate-statsig' },
]);
store.setCodeChanges(['Added @spotify-confidence/sdk']);
await waitFor(() => {
expect(sut.lastFrame()).toContain('/migrate-statsig');
});
});

it('omits migration hint when no providers are detected', async () => {
using sut = renderScreen(<DoneScreen />, {
screen: ScreenId.Done,
ide: 'claude',
plugins: ['claude'],
});
store.setCodeChanges(['Added @spotify-confidence/sdk']);
await waitFor(() => {
expect(sut.lastFrame()).toContain('slash commands');
expect(sut.lastFrame()).not.toContain('/migrate-');
});
});
});

describe('when a report file is generated', () => {
Expand Down
Loading