From 152e074c2d0218ffe16d4602ace8affed16bf371 Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Fri, 6 Sep 2024 13:45:22 +0200 Subject: [PATCH] test: improve onboarding test (#8121) --- .../src/component/onboarding/Onboarding.test.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/src/component/onboarding/Onboarding.test.tsx b/frontend/src/component/onboarding/Onboarding.test.tsx index 1ad2ba75d439..b0cf4152b341 100644 --- a/frontend/src/component/onboarding/Onboarding.test.tsx +++ b/frontend/src/component/onboarding/Onboarding.test.tsx @@ -10,7 +10,7 @@ const setupApi = () => { testServerRoute(server, '/api/admin/projects/default/api-tokens', { tokens: [ { - environment: 'development', + environment: 'production', type: 'client', secret: 'default:development.5c4150866d', }, @@ -24,7 +24,7 @@ const setupApi = () => { }); }; -test('Onboarding for SDK with existing key', async () => { +test('Onboarding for SDK', async () => { setupApi(); // on smaller screens we don't show concepts definitions resizeScreen(2000); @@ -34,7 +34,7 @@ test('Onboarding for SDK with existing key', async () => { project='default' onClose={() => {}} open={true} - environments={['development', 'productions']} + environments={['development', 'production']} feature='featureA' />, ); @@ -51,7 +51,13 @@ test('Onboarding for SDK with existing key', async () => { screen.getByText('API Key'); screen.getByText('Flags live in projects'); screen.getByText('development'); + await screen.findByText('Generate API Key'); + const envWithoutKey = screen.getByText('development'); + fireEvent.click(envWithoutKey); + + const envWithKey = screen.getByText('production'); + fireEvent.click(envWithKey); await screen.findByText('The API key secret'); await screen.findByText('5c4150866d');