fix(qa): verify private investor continuity across dossiers
This commit is contained in:
@@ -237,6 +237,7 @@ void test('contradictory record criteria remain explicit until the user chooses
|
||||
sector: '8',
|
||||
state: 'closed',
|
||||
certainty: 'documented',
|
||||
need: 'investment',
|
||||
},
|
||||
{ kind: ['Combinação incompatível.'] },
|
||||
);
|
||||
@@ -269,6 +270,51 @@ void test('contradictory record criteria remain explicit until the user chooses
|
||||
);
|
||||
});
|
||||
|
||||
void test('search needs both location and purpose; Enter and missing criteria cannot submit', () => {
|
||||
for (const filters of [
|
||||
{},
|
||||
{ need: 'investment' },
|
||||
{ province_id: 'province-qa' },
|
||||
]) {
|
||||
const h = harness(filters);
|
||||
const submit = nodes(h.tree()).find(
|
||||
(n) => n.type === 'button' && text(n) === 'Pesquisar',
|
||||
);
|
||||
assert.equal(submit.props.disabled, true);
|
||||
nodes(h.tree())
|
||||
.find((n) => n.type === 'form')
|
||||
.props.onSubmit({ preventDefault() {} });
|
||||
assert.equal(h.submitted(), undefined);
|
||||
assert.match(
|
||||
text(h.tree()),
|
||||
/Escolha a localização a pesquisar e a necessidade/,
|
||||
);
|
||||
}
|
||||
for (const location of [
|
||||
{ province_id: 'province-qa' },
|
||||
{ territory: 'district-qa' },
|
||||
]) {
|
||||
const h = harness({
|
||||
...location,
|
||||
need: 'investment',
|
||||
context: 'dossier-qa',
|
||||
opportunity: 'opportunity-qa',
|
||||
});
|
||||
assert.equal(
|
||||
nodes(h.tree()).find(
|
||||
(n) => n.type === 'button' && text(n) === 'Pesquisar',
|
||||
).props.disabled,
|
||||
false,
|
||||
);
|
||||
nodes(h.tree())
|
||||
.find((n) => n.type === 'form')
|
||||
.props.onSubmit({ preventDefault() {} });
|
||||
assert.equal(h.submitted().data.need, 'investment');
|
||||
assert.equal(h.submitted().data.context, 'dossier-qa');
|
||||
assert.equal(h.submitted().data.opportunity, 'opportunity-qa');
|
||||
}
|
||||
});
|
||||
|
||||
void test('local search defaults to documented presence and keeps the explicit unknown option and chosen territory', () => {
|
||||
const h = harness({ territory: 'district-qa', sector: '7' });
|
||||
h.select('Localização a pesquisar').props.onChange({
|
||||
|
||||
@@ -188,6 +188,15 @@ test('summary focus and click wait for the native open toggle; closing a stage d
|
||||
};
|
||||
try {
|
||||
let tree = render();
|
||||
const action = new Target(false);
|
||||
tree.props.children.props.onPointerDownCapture();
|
||||
tree.props.children.props.onFocusCapture({ target: action });
|
||||
assert.equal(
|
||||
render().props.value.active,
|
||||
null,
|
||||
'pointer focus must not insert help before the action receives its click',
|
||||
);
|
||||
tree.props.children.props.onPointerUpCapture();
|
||||
const summary = new Target(true);
|
||||
tree.props.children.props.onFocusCapture({ target: summary });
|
||||
tree.props.children.props.onClickCapture({ target: summary });
|
||||
@@ -200,6 +209,12 @@ test('summary focus and click wait for the native open toggle; closing a stage d
|
||||
target: new Disclosure(false, false),
|
||||
});
|
||||
assert.equal(render().props.value.active, null);
|
||||
tree.props.children.props.onClickCapture({ target: action });
|
||||
assert.equal(
|
||||
render().props.value.active,
|
||||
'S02',
|
||||
'the completed click may open automatic help',
|
||||
);
|
||||
listeners.toggle({
|
||||
target: new Disclosure(false, true),
|
||||
});
|
||||
|
||||
@@ -112,7 +112,12 @@ test('dossier provider retains tab focus across navigation/reload, honours expli
|
||||
}
|
||||
return { installed: true, focus: serverFocus };
|
||||
}
|
||||
return { case: { id: url.split('/').pop() } };
|
||||
const request = new URL(url, 'https://qa.invalid');
|
||||
return {
|
||||
case: { id: request.pathname.split('/').pop() },
|
||||
context_opportunity:
|
||||
request.searchParams.get('opportunity'),
|
||||
};
|
||||
},
|
||||
};
|
||||
return require(id);
|
||||
@@ -128,11 +133,13 @@ test('dossier provider retains tab focus across navigation/reload, honours expli
|
||||
while (pending.length) pending.shift()();
|
||||
return tree.props.value;
|
||||
};
|
||||
return async () => {
|
||||
const settle = async () => {
|
||||
render();
|
||||
await new Promise(setImmediate);
|
||||
return render();
|
||||
};
|
||||
settle.immediate = render;
|
||||
return settle;
|
||||
}
|
||||
try {
|
||||
let render = mount(),
|
||||
@@ -151,6 +158,11 @@ test('dossier provider retains tab focus across navigation/reload, honours expli
|
||||
'reload must not adopt the other tab server preference',
|
||||
);
|
||||
pageUrl = '/simulador?context=' + B;
|
||||
assert.equal(
|
||||
render.immediate().view,
|
||||
null,
|
||||
'the pending explicit dossier cannot display the previous dossier',
|
||||
);
|
||||
view = await render();
|
||||
assert.equal(view.active, B, 'explicit authorised dossier wins');
|
||||
assert.equal(readNavigationFocus(7, [A, B]).case_id, B);
|
||||
@@ -162,6 +174,71 @@ test('dossier provider retains tab focus across navigation/reload, honours expli
|
||||
15,
|
||||
);
|
||||
assert.equal(visits.at(-1), '/investimentos/' + A + '#S02');
|
||||
|
||||
pageUrl = '/fundos?context=' + A + '&opportunity=opportunity%3Ahotel';
|
||||
assert.equal(
|
||||
render.immediate().view,
|
||||
null,
|
||||
'a pending opportunity cannot be labelled with the previous scope',
|
||||
);
|
||||
view = await render();
|
||||
assert.equal(view.view.context_opportunity, 'opportunity:hotel');
|
||||
pageUrl = '/documentos';
|
||||
view = await render();
|
||||
assert.equal(view.active, A);
|
||||
assert.equal(
|
||||
view.view.context_opportunity,
|
||||
'opportunity:hotel',
|
||||
'general menus retain this tab opportunity',
|
||||
);
|
||||
render = mount();
|
||||
view = await render();
|
||||
assert.equal(
|
||||
view.view.context_opportunity,
|
||||
'opportunity:hotel',
|
||||
'reload retains the scope',
|
||||
);
|
||||
view.choose(A, 'S08');
|
||||
await new Promise(setImmediate);
|
||||
assert.equal(
|
||||
visits.at(-1),
|
||||
'/investimentos/' + A + '?opportunity=opportunity%3Ahotel#S08',
|
||||
);
|
||||
|
||||
pageUrl = '/investimentos/' + A;
|
||||
view = await render();
|
||||
assert.equal(
|
||||
view.view.context_opportunity,
|
||||
null,
|
||||
'explicit whole dossier clears the previous opportunity',
|
||||
);
|
||||
pageUrl = '/fundos?context=' + A + '&opportunity=opportunity%3Ahotel';
|
||||
view = await render();
|
||||
view.choose(B);
|
||||
await new Promise(setImmediate);
|
||||
assert.equal(
|
||||
visits.at(-1),
|
||||
'/investimentos/' + B,
|
||||
'deliberate dossier switch does not carry the other opportunity',
|
||||
);
|
||||
pageUrl = '/fundos?context=' + B;
|
||||
view = await render();
|
||||
assert.equal(view.active, B);
|
||||
assert.equal(view.view.context_opportunity, null);
|
||||
|
||||
calls.length = 0;
|
||||
pageUrl = '/fundos?context=15111500-0000-4000-8000-000000000099';
|
||||
view = await render();
|
||||
assert.equal(
|
||||
view.active,
|
||||
'',
|
||||
'unavailable explicit dossier must not show an old dossier',
|
||||
);
|
||||
assert.equal(view.view, null);
|
||||
assert.equal(
|
||||
calls.some((c) => c.url.startsWith('/investimentos/15111500')),
|
||||
false,
|
||||
);
|
||||
} finally {
|
||||
globalThis.sessionStorage = oldStorage;
|
||||
globalThis.window = oldWindow;
|
||||
|
||||
@@ -17,6 +17,21 @@ test('tab focus survives reload but is isolated by actor and rechecked against a
|
||||
const focus = { case_id: 'synthetic-A', step_code: 'S08', version: 3 };
|
||||
rememberNavigationFocus(1, focus);
|
||||
assert.deepEqual(readNavigationFocus(1, ['synthetic-A']), focus);
|
||||
rememberNavigationFocus(1, {
|
||||
...focus,
|
||||
opportunity: 'opportunity:hotel',
|
||||
});
|
||||
assert.equal(
|
||||
readNavigationFocus(1, ['synthetic-A']).opportunity,
|
||||
'opportunity:hotel',
|
||||
);
|
||||
assert.equal(readNavigationFocus(1, ['synthetic-B']), null);
|
||||
rememberNavigationFocus(1, {
|
||||
...focus,
|
||||
opportunity: { invalid: true },
|
||||
});
|
||||
assert.deepEqual(readNavigationFocus(1, ['synthetic-A']), focus);
|
||||
rememberNavigationFocus(1, focus);
|
||||
assert.equal(readNavigationFocus(2, ['synthetic-A']), null);
|
||||
assert.equal(readNavigationFocus(1, ['synthetic-B']), null);
|
||||
const firstTab = globalThis.sessionStorage;
|
||||
|
||||
Reference in New Issue
Block a user