diff --git a/web/__test__/components/Onboarding/OnboardingSummaryStep.test.ts b/web/__test__/components/Onboarding/OnboardingSummaryStep.test.ts index 1cb8b99d9a..32eb5cdf83 100644 --- a/web/__test__/components/Onboarding/OnboardingSummaryStep.test.ts +++ b/web/__test__/components/Onboarding/OnboardingSummaryStep.test.ts @@ -295,7 +295,7 @@ interface SummaryVm { applyResultSeverity: 'success' | 'warning' | 'error'; handleBootDriveWarningConfirm: () => Promise; handleBootDriveWarningCancel: () => void; - handleApplyResultConfirm: () => void; + handleApplyResultConfirm: () => Promise; } const getSummaryVm = (wrapper: ReturnType['wrapper']) => @@ -332,7 +332,7 @@ const clickButtonByText = async ( } else if (normalizedTarget === 'cancel') { vm.handleBootDriveWarningCancel(); } else if (normalizedTarget === 'ok') { - vm.handleApplyResultConfirm(); + await vm.handleApplyResultConfirm(); } else { expect(button).toBeTruthy(); } @@ -1015,6 +1015,28 @@ describe('OnboardingSummaryStep', () => { expect(onComplete).not.toHaveBeenCalled(); }); + it('advances to next steps before reloading after a successful server rename', async () => { + draftStore.serverName = 'Newtower'; + const reloadSpy = vi.spyOn(window.location, 'reload').mockImplementation(() => undefined); + const { wrapper, onComplete } = mountComponent(); + + await clickApply(wrapper); + + expect(updateServerIdentityMock).toHaveBeenCalledWith({ + name: 'Newtower', + comment: '', + sysModel: undefined, + }); + expect(onComplete).not.toHaveBeenCalled(); + + await clickButtonByText(wrapper, 'OK'); + + expect(onComplete).toHaveBeenCalledTimes(1); + expect(reloadSpy).toHaveBeenCalledTimes(1); + + reloadSpy.mockRestore(); + }); + it('retries final identity update after transient network errors when SSH changed', async () => { draftStore.useSsh = true; draftStore.serverDescription = 'Primary host'; diff --git a/web/src/components/Onboarding/steps/OnboardingSummaryStep.vue b/web/src/components/Onboarding/steps/OnboardingSummaryStep.vue index 86a1e89625..e26e6a4899 100644 --- a/web/src/components/Onboarding/steps/OnboardingSummaryStep.vue +++ b/web/src/components/Onboarding/steps/OnboardingSummaryStep.vue @@ -1,5 +1,5 @@