From d3664697c61a15df4c07b2b2c3e6e0123292b133 Mon Sep 17 00:00:00 2001 From: Lisa Kim Date: Fri, 10 Jan 2025 11:53:06 -0800 Subject: [PATCH] Update test --- .../src/Apps/AddApp/Automatically.test.tsx | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/web/packages/teleport/src/Apps/AddApp/Automatically.test.tsx b/web/packages/teleport/src/Apps/AddApp/Automatically.test.tsx index f8215d02405db..ece5ce843aa57 100644 --- a/web/packages/teleport/src/Apps/AddApp/Automatically.test.tsx +++ b/web/packages/teleport/src/Apps/AddApp/Automatically.test.tsx @@ -16,8 +16,6 @@ * along with this program. If not, see . */ -import { act } from '@testing-library/react'; - import { fireEvent, render, screen } from 'design/utils/testing'; import { Automatically, createAppBashCommand } from './Automatically'; @@ -33,14 +31,14 @@ test('render command only after form submit', async () => { roles: [], content: '', }; - render( + const { rerender } = render( {}} onCreate={() => Promise.resolve(true)} labels={[]} setLabels={() => null} + token={null} /> ); @@ -58,8 +56,21 @@ test('render command only after form submit', async () => { target: { value: 'https://gravitational.com' }, }); + rerender( + {}} + onCreate={() => Promise.resolve(true)} + labels={[]} + setLabels={() => null} + token={token} + /> + ); + // click button - act(() => screen.getByRole('button', { name: /Generate Script/i }).click()); + fireEvent.click(screen.getByRole('button', { name: /Generate Script/i })); + + await screen.findByText(/Regenerate Script/i); // after form submission should show the command cmd = createAppBashCommand(token.id, 'app-name', 'https://gravitational.com');