From 9d54f266a83040ead59cecf369cf359208374ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Cie=C5=9Blak?= Date: Fri, 6 Dec 2024 11:52:12 +0100 Subject: [PATCH] Deflake teleport/Welcome/Welcome.test.tsx --- web/packages/teleport/src/Welcome/Welcome.test.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/web/packages/teleport/src/Welcome/Welcome.test.tsx b/web/packages/teleport/src/Welcome/Welcome.test.tsx index a4a468139d46c..cae693c2d3479 100644 --- a/web/packages/teleport/src/Welcome/Welcome.test.tsx +++ b/web/packages/teleport/src/Welcome/Welcome.test.tsx @@ -16,7 +16,6 @@ * along with this program. If not, see . */ -import React from 'react'; import { MemoryRouter, Route, Router } from 'react-router'; import { createMemoryHistory } from 'history'; import { fireEvent, render, screen, waitFor } from 'design/utils/testing'; @@ -89,7 +88,7 @@ describe('teleport/components/Welcome', () => { expect(auth.fetchPasswordToken).toHaveBeenCalled(); }); - expect(screen.getByText(/confirm password/i)).toBeInTheDocument(); + expect(await screen.findByText(/confirm password/i)).toBeInTheDocument(); }); it('should have correct welcome prompt flow for reset', async () => { @@ -123,7 +122,7 @@ describe('teleport/components/Welcome', () => { }); expect(auth.fetchPasswordToken).toHaveBeenCalled(); - expect(screen.getByText(/submit/i)).toBeInTheDocument(); + expect(await screen.findByText(/submit/i)).toBeInTheDocument(); }); it('reset password', async () => { @@ -217,7 +216,7 @@ describe('teleport/components/Welcome', () => { }); // Trigger submit. - await user.click(screen.getByText(/submit/i)); + await user.click(await screen.findByText(/submit/i)); expect(auth.resetPasswordWithWebauthn).toHaveBeenCalledWith( expect.objectContaining({