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