Fix Cypress tests (#1569)
Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
d591e0d4a4
commit
ff4f58404a
4 changed files with 21 additions and 10 deletions
|
@ -28,7 +28,7 @@ describe("Events tests", () => {
|
|||
|
||||
realmSettingsPage
|
||||
.toggleSwitch(realmSettingsPage.enableEvents)
|
||||
.save(realmSettingsPage.modalConfirm);
|
||||
.save(realmSettingsPage.eventsUserSave);
|
||||
|
||||
masthead.signOut();
|
||||
loginPage.logIn();
|
||||
|
@ -78,7 +78,7 @@ describe("Events tests", () => {
|
|||
|
||||
realmSettingsPage
|
||||
.toggleSwitch(realmSettingsPage.enableAdminEvents)
|
||||
.save(realmSettingsPage.modalConfirm);
|
||||
.save(realmSettingsPage.eventsAdminSave);
|
||||
|
||||
sidebarPage.goToEvents();
|
||||
cy.findByTestId("admin-events-tab").click();
|
||||
|
|
|
@ -55,7 +55,7 @@ export default class UserEventsTab {
|
|||
|
||||
cy.get("[id^=remove_group]").click();
|
||||
cy.wait("@eventsFetch");
|
||||
cy.get("table").should("be.visible").contains("td", "LOGOUT");
|
||||
cy.get("table").should("not.contain", "LOGOUT");
|
||||
}
|
||||
|
||||
shouldHaveSearchBtnEnabled() {
|
||||
|
|
|
@ -33,10 +33,13 @@ export function useFetch<T>(
|
|||
const adminClient = useAdminClient();
|
||||
const onError = useErrorHandler();
|
||||
|
||||
const source = axios.CancelToken.source();
|
||||
adminClient.setConfig({ requestConfig: { cancelToken: source.token } });
|
||||
|
||||
useEffect(() => {
|
||||
const source = axios.CancelToken.source();
|
||||
|
||||
adminClient.setConfig({
|
||||
requestConfig: { cancelToken: source.token },
|
||||
});
|
||||
|
||||
adminClientCall()
|
||||
.then((result) => {
|
||||
if (!source.token.reason) {
|
||||
|
@ -49,6 +52,10 @@ export function useFetch<T>(
|
|||
}
|
||||
});
|
||||
|
||||
adminClient.setConfig({
|
||||
requestConfig: { cancelToken: undefined },
|
||||
});
|
||||
|
||||
return () => {
|
||||
source.cancel();
|
||||
};
|
||||
|
|
|
@ -15,6 +15,7 @@ import {
|
|||
DropdownToggle,
|
||||
Gallery,
|
||||
PageSection,
|
||||
Spinner,
|
||||
Split,
|
||||
SplitItem,
|
||||
Text,
|
||||
|
@ -50,9 +51,8 @@ export default function IdentityProvidersSection() {
|
|||
|
||||
const [addProviderOpen, setAddProviderOpen] = useState(false);
|
||||
const [manageDisplayDialog, setManageDisplayDialog] = useState(false);
|
||||
const [providers, setProviders] = useState<IdentityProviderRepresentation[]>(
|
||||
[]
|
||||
);
|
||||
const [providers, setProviders] =
|
||||
useState<IdentityProviderRepresentation[]>();
|
||||
const [selectedProvider, setSelectedProvider] =
|
||||
useState<IdentityProviderRepresentation>();
|
||||
|
||||
|
@ -142,7 +142,7 @@ export default function IdentityProvidersSection() {
|
|||
alias: selectedProvider!.alias!,
|
||||
});
|
||||
setProviders([
|
||||
...providers.filter((p) => p.alias !== selectedProvider?.alias),
|
||||
...providers!.filter((p) => p.alias !== selectedProvider?.alias),
|
||||
]);
|
||||
refresh();
|
||||
addAlert(t("deletedSuccess"), AlertVariant.success);
|
||||
|
@ -152,6 +152,10 @@ export default function IdentityProvidersSection() {
|
|||
},
|
||||
});
|
||||
|
||||
if (!providers) {
|
||||
return <Spinner />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<DeleteConfirm />
|
||||
|
|
Loading…
Reference in a new issue