Keep completed wash after lane refresh
This commit is contained in:
@@ -1774,7 +1774,12 @@ watch(
|
||||
(newLaneId) => {
|
||||
if (newLaneId && newLaneId !== "Any" && !isRestoring.value) {
|
||||
fetchSelfServeData().then(() => {
|
||||
if (!allVisibleQuestionsAnswered.value && !washInProgress.value && currentStep.value > steps.QUESTIONS) {
|
||||
if (
|
||||
!allVisibleQuestionsAnswered.value &&
|
||||
!washInProgress.value &&
|
||||
currentStep.value > steps.QUESTIONS &&
|
||||
currentStep.value < steps.COMPLETED
|
||||
) {
|
||||
currentStep.value = steps.QUESTIONS;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -70,6 +70,7 @@ describe("MyWashStart.vue production recovery contracts", () => {
|
||||
expect(source).toContain("isCompletingWash.value ||");
|
||||
expect(source).toContain("currentStep.value === steps.COMPLETED");
|
||||
expect(source).toContain('<template v-if="shouldShowWashFlow">');
|
||||
expect(source).toContain("currentStep.value < steps.COMPLETED");
|
||||
});
|
||||
|
||||
it("does not treat the customer's active occupied lane as unavailable", () => {
|
||||
|
||||
@@ -391,7 +391,8 @@ describe("MyWashStart", () => {
|
||||
mocks.markDestroying.mockClear();
|
||||
mocks.fetchCustomerVehicles.mockClear();
|
||||
mocks.fetchVehicleTypeOptions.mockClear();
|
||||
mocks.fetchSelfServeDataInternal.mockClear();
|
||||
mocks.fetchSelfServeDataInternal.mockReset();
|
||||
mocks.fetchSelfServeDataInternal.mockResolvedValue(undefined);
|
||||
mocks.fetchWashSummary.mockClear();
|
||||
mocks.saveProgress.mockClear();
|
||||
mocks.clearProgress.mockClear();
|
||||
@@ -725,6 +726,62 @@ describe("MyWashStart", () => {
|
||||
expect(wrapper.find('[data-testid="completed-step-stub"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it("does not let a late lane refresh move a completed wash back to questions", async () => {
|
||||
mocks.doesCurrentDepartmentSelectionHaveSelfServeEnabled.value = false;
|
||||
mocks.restoredProgressPayload = {
|
||||
washInProgress: true,
|
||||
washLaneId: 7,
|
||||
washStartTime: Date.now() - 20_000,
|
||||
licensePlateInput: "AB12345",
|
||||
vehicleTypeSelect: 2,
|
||||
radioWashType: "Manual",
|
||||
radioLaneOption: 7,
|
||||
customerNumberInput: 12345679,
|
||||
isForcingNearestDepartment: false,
|
||||
forceNearestDepartmentEvaluationId: 0,
|
||||
answers: {},
|
||||
completedTasks: {},
|
||||
currentStep: 4,
|
||||
};
|
||||
|
||||
const pendingFetchResolvers = [];
|
||||
mocks.fetchSelfServeDataInternal.mockImplementation(
|
||||
() =>
|
||||
new Promise((resolve) => {
|
||||
pendingFetchResolvers.push(resolve);
|
||||
})
|
||||
);
|
||||
|
||||
const wrapper = mountWithApp(MyWashStart, {
|
||||
global: {
|
||||
stubs: stubComponents,
|
||||
},
|
||||
});
|
||||
|
||||
await flushPromises();
|
||||
|
||||
const guidedActions = wrapper
|
||||
.get('[data-testid="self-serve-bottom-actions"]')
|
||||
.get('[data-testid="self-serve-guided-bottom-actions"]');
|
||||
|
||||
for (let index = 0; index < 5; index += 1) {
|
||||
await guidedActions.get('[data-testid="self-serve-guided-next"]').trigger("click");
|
||||
}
|
||||
|
||||
await guidedActions.get('[data-testid="self-serve-nav-complete"]').trigger("click");
|
||||
await new Promise((resolve) => setTimeout(resolve, 260));
|
||||
await flushPromises();
|
||||
|
||||
expect(wrapper.find('[data-testid="completed-step-stub"]').exists()).toBe(true);
|
||||
|
||||
pendingFetchResolvers.forEach((resolve) => resolve(null));
|
||||
await flushPromises();
|
||||
await nextTick();
|
||||
|
||||
expect(wrapper.find('[data-testid="self-serve-disabled-warning"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="completed-step-stub"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it("adds an unknown registration as customer vehicle before continuing from vehicle step", async () => {
|
||||
const wrapper = mountWithApp(MyWashStart, {
|
||||
global: {
|
||||
|
||||
Reference in New Issue
Block a user