From 4932494a9cdf22b92e508a44676b8f301e9b27cd Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Tue, 25 Jul 2023 18:56:44 +0200 Subject: [PATCH] Use new Root API to render Admin UI (#21102) --- .../cypress/e2e/realm_settings_general_tab_test.spec.ts | 4 ++++ .../support/pages/admin-ui/manage/users/CredentialsPage.ts | 2 +- js/apps/admin-ui/src/main.tsx | 7 +++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/js/apps/admin-ui/cypress/e2e/realm_settings_general_tab_test.spec.ts b/js/apps/admin-ui/cypress/e2e/realm_settings_general_tab_test.spec.ts index 8b0f91b173..8d221ea777 100644 --- a/js/apps/admin-ui/cypress/e2e/realm_settings_general_tab_test.spec.ts +++ b/js/apps/admin-ui/cypress/e2e/realm_settings_general_tab_test.spec.ts @@ -52,6 +52,10 @@ describe("Realm settings general tab tests", () => { realmSettingsPage.disableRealm(); masthead.checkNotificationMessage("Realm successfully updated", true); + // Sometimes it takes the Keycloak server a while to disable the realm, even though the notification message has been displayed. + // To prevent flaky tests, we wait a second before continuing. + cy.wait(1000); + // Re-enable realm realmSettingsPage.toggleSwitch(`${realmName}-switch`); masthead.checkNotificationMessage("Realm successfully updated"); diff --git a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/users/CredentialsPage.ts b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/users/CredentialsPage.ts index 799f38d7b8..035ee3b963 100644 --- a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/users/CredentialsPage.ts +++ b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/users/CredentialsPage.ts @@ -63,7 +63,7 @@ export default class CredentialsPage { } clickConfirmationBtn() { - cy.findByTestId(this.confirmationButton).dblclick(); + cy.findByTestId(this.confirmationButton).click(); return this; } diff --git a/js/apps/admin-ui/src/main.tsx b/js/apps/admin-ui/src/main.tsx index edbe3b7207..bcdfb4e1c6 100644 --- a/js/apps/admin-ui/src/main.tsx +++ b/js/apps/admin-ui/src/main.tsx @@ -2,8 +2,7 @@ import "@patternfly/react-core/dist/styles/base.css"; import "@patternfly/patternfly/patternfly-addons.css"; import { StrictMode } from "react"; -// eslint-disable-next-line react/no-deprecated -import { render } from "react-dom"; +import { createRoot } from "react-dom/client"; import { createHashRouter, RouterProvider } from "react-router-dom"; import { i18n } from "./i18n/i18n"; @@ -18,10 +17,10 @@ await i18n.init(); const router = createHashRouter([RootRoute]); const container = document.getElementById("app"); +const root = createRoot(container!); -render( +root.render( , - container, );