diff --git a/frontend/src/lib/components/neurons/AddUserToHotkeys.svelte b/frontend/src/lib/components/neurons/AddUserToHotkeys.svelte index 92d224c64c7..ff6c73b3860 100644 --- a/frontend/src/lib/components/neurons/AddUserToHotkeys.svelte +++ b/frontend/src/lib/components/neurons/AddUserToHotkeys.svelte @@ -7,6 +7,7 @@ import type { NeuronId } from "@dfinity/nns"; import { createEventDispatcher } from "svelte"; import CalloutWarning from "$lib/components/common/CalloutWarning.svelte"; + import { ENABLE_PERIODIC_FOLLOWING_CONFIRMATION } from "$lib/stores/feature-flags.store"; export let account: Account; export let neuronId: NeuronId; @@ -31,7 +32,9 @@
{$i18n.neurons.add_user_as_hotkey_message}
diff --git a/frontend/src/tests/lib/modals/neurons/NnsStakeNeuronModal.spec.ts b/frontend/src/tests/lib/modals/neurons/NnsStakeNeuronModal.spec.ts index 2a1dbecd293..601c8816526 100644 --- a/frontend/src/tests/lib/modals/neurons/NnsStakeNeuronModal.spec.ts +++ b/frontend/src/tests/lib/modals/neurons/NnsStakeNeuronModal.spec.ts @@ -14,6 +14,7 @@ import { stakeNeuron, updateDelay, } from "$lib/services/neurons.services"; +import { overrideFeatureFlagsStore } from "$lib/stores/feature-flags.store"; import { neuronsStore } from "$lib/stores/neurons.store"; import { mockIdentity, resetIdentity } from "$tests/mocks/auth.store.mock"; import { @@ -443,6 +444,34 @@ describe("NnsStakeNeuronModal", () => { expect(addHotkeyForHardwareWalletNeuron).not.toBeCalled(); }); + it("should display missing rewards warning when feature flag on", async () => { + overrideFeatureFlagsStore.setFlag( + "ENABLE_PERIODIC_FOLLOWING_CONFIRMATION", + true + ); + const po = await renderComponent({}); + await createNeuron(po); + + expect(await po.getAddUserToHotkeysPo().isPresent()).toBe(true); + expect( + await po.getAddUserToHotkeysPo().isMissingRewardsWarningVisible() + ).toBe(true); + }); + + it("should not display missing rewards warning when feature flag off", async () => { + overrideFeatureFlagsStore.setFlag( + "ENABLE_PERIODIC_FOLLOWING_CONFIRMATION", + false + ); + const po = await renderComponent({}); + await createNeuron(po); + + expect(await po.getAddUserToHotkeysPo().isPresent()).toBe(true); + expect( + await po.getAddUserToHotkeysPo().isMissingRewardsWarningVisible() + ).toBe(false); + }); + it("should create neuron for hardwareWallet and add dissolve delay", async () => { neuronsStore.setNeurons({ neurons: [newNeuron], certified: true }); const po = await renderComponent({}); diff --git a/frontend/src/tests/page-objects/AddUserToHotkeys.page-object.ts b/frontend/src/tests/page-objects/AddUserToHotkeys.page-object.ts index da1089e704c..25e1e6f440e 100644 --- a/frontend/src/tests/page-objects/AddUserToHotkeys.page-object.ts +++ b/frontend/src/tests/page-objects/AddUserToHotkeys.page-object.ts @@ -1,3 +1,4 @@ +import { CalloutWarningPo } from "$tests/page-objects/CalloutWarning.page-object"; import { BasePageObject } from "$tests/page-objects/base.page-object"; import type { PageObjectElement } from "$tests/types/page-object.types"; @@ -8,6 +9,10 @@ export class AddUserToHotkeysPo extends BasePageObject { return new AddUserToHotkeysPo(element.byTestId(AddUserToHotkeysPo.TID)); } + isMissingRewardsWarningVisible(): Promise