فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

test(native): isolate transient error toasts between E2E phases

Davood Mehraban committed Nov 23, 2026 at 10:19 UTC fe366a8821800dde55fc9c1e274c4e6f515a883f
2 files changed +33
tests/windows-vm-native-functional-matrix-contract.test.mjs
+22
@@ -16,3 +16,25 @@ test('A05 cheque approval compares against a journal baseline taken after the va
16 assert.doesNotMatch(source.slice(apply,check),/length===journalCount\)/,
17 'Cheque approval must not compare against the pre-transfer journal count');
18 });
19 +
20 +test('native matrix dismisses stale global toasts only between completed scenarios',async()=>{
21 + const {createRequire}=await import('node:module');
22 + const require=createRequire(import.meta.url);
23 + const matrix=require('./windows-vm-native-functional-matrix.cjs');
24 + const expressions=[];
25 + const cdp={evaluate:async expression=>{
26 + expressions.push(expression);
27 + if(expression.startsWith('(() => {'))return undefined;
28 + return {verified:true};
29 + }};
30 + const result=await matrix(cdp);
31 + const phases=Object.keys(result);
32 + assert.equal(phases.length,24);
33 + assert.equal(expressions.length,phases.length*2);
34 + for(let i=0;i<expressions.length;i+=2){
35 + assert.match(expressions[i],/\.toast-error, \.toast-warning/);
36 + assert.match(expressions[i],/\.toast-close/);
37 + assert.doesNotMatch(expressions[i],/\.modal-backdrop|FINORA\.Storage/);
38 + assert.match(expressions[i+1],/^\(async function /);
39 + }
40 +});
tests/windows-vm-native-functional-matrix.cjs
+11
@@ -1949,6 +1949,17 @@ module.exports = async function nativeFunctionalMatrix(cdp) {
1949 ];
1950 const report = {};
1951 for (const [name, fn] of phases) {
1952 + // Toasts are transient global UI state, unlike the persistent accounting
1953 + // stores. A previous phase can intentionally produce an error toast while
1954 + // verifying that an invalid operation was rejected. Dismiss only those
1955 + // completed-phase notices before checking the next phase's own errors.
1956 + // Never dismiss modals or change any accounting data at this boundary.
1957 + await cdp.evaluate(`(() => {
1958 + for (const toast of document.querySelectorAll('.toast-error, .toast-warning')) {
1959 + const close = toast.querySelector('.toast-close');
1960 + if (close) close.click();
1961 + }
1962 + })()`);
1963 const value = await cdp.evaluate('(' + fn.toString() + ')()');
1964 assert.ok(value && typeof value === 'object', 'invalid native E2E result from ' + name);
1965 report[name] = value;