Initial Playwright ERP UAT VAPT test suite v2.4.1 IMAP
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
require('dotenv').config();
|
||||
const required = [
|
||||
'SYSTEM_ADMIN_EMAIL','SYSTEM_ADMIN_PASSWORD','FIRM_ADMIN_EMAIL','FIRM_ADMIN_PASSWORD','PARTNER_EMAIL','PARTNER_PASSWORD','MANAGER_EMAIL','MANAGER_PASSWORD','STAFF_EMAIL','STAFF_PASSWORD','CLIENT_EMAIL','CLIENT_PASSWORD','CONSULTANT_EMAIL','CONSULTANT_PASSWORD','TENANT_B_ADMIN_EMAIL','TENANT_B_ADMIN_PASSWORD'
|
||||
];
|
||||
const missing = required.filter(k => !process.env[k]);
|
||||
if (missing.length) {
|
||||
console.error('Missing required .env values:', missing.join(', '));
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('Seed credential configuration looks complete. For full IDOR/cross-tenant tests also fill TENANT_A_ID, TENANT_B_ID, CLIENT_A_ID, CLIENT_B_ID, NOTICE_CASE_A_ID, etc.');
|
||||
@@ -0,0 +1,24 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const matrix = JSON.parse(fs.readFileSync('data/generated-test-matrix.json','utf8'));
|
||||
const resultPath = 'results/playwright-results.json';
|
||||
const outPath = 'results/merged-results.json';
|
||||
let results = {};
|
||||
if (fs.existsSync(resultPath)) {
|
||||
const raw = JSON.parse(fs.readFileSync(resultPath,'utf8'));
|
||||
function walk(suite) {
|
||||
for (const spec of suite.specs || []) {
|
||||
for (const test of spec.tests || []) {
|
||||
const title = spec.title;
|
||||
const m = title.match(/\[([^\]]+)\]/);
|
||||
if (m) results[m[1]] = test.outcome || test.status || 'unknown';
|
||||
}
|
||||
}
|
||||
for (const child of suite.suites || []) walk(child);
|
||||
}
|
||||
for (const s of raw.suites || []) walk(s);
|
||||
}
|
||||
const merged = matrix.map(v => ({...v, result: results[v.variantId] || (v.automation === 'manual' ? 'manual' : 'not_run')}));
|
||||
fs.mkdirSync(path.dirname(outPath), {recursive:true});
|
||||
fs.writeFileSync(outPath, JSON.stringify(merged,null,2));
|
||||
console.log(`Wrote ${outPath}`);
|
||||
@@ -0,0 +1,10 @@
|
||||
const fs = require('fs');
|
||||
const rows = JSON.parse(fs.readFileSync('data/checklist-rows.json','utf8'));
|
||||
const vars = JSON.parse(fs.readFileSync('data/generated-test-matrix.json','utf8'));
|
||||
const bySheet = {};
|
||||
for (const r of rows) bySheet[r.Sheet] = (bySheet[r.Sheet] || 0) + 1;
|
||||
console.log('Source Excel rows:', rows.length);
|
||||
console.log('Generated variants:', vars.length);
|
||||
console.log('Automated variants:', vars.filter(v=>v.automation==='automated').length);
|
||||
console.log('Manual variants:', vars.filter(v=>v.automation==='manual').length);
|
||||
console.table(bySheet);
|
||||
@@ -0,0 +1,48 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const XLSX = require('xlsx');
|
||||
require('dotenv').config();
|
||||
const source = process.env.MASTER_EXCEL || 'Audit_Firm_ERP_Master_UAT_VAPT_Checklist.xlsx';
|
||||
const output = process.env.UPDATED_EXCEL || 'results/Audit_Firm_ERP_Master_UAT_VAPT_Checklist_v2_2_Results.xlsx';
|
||||
const mergedPath = 'results/merged-results.json';
|
||||
if (!fs.existsSync(mergedPath)) {
|
||||
console.error('Run npm run report:json first.'); process.exit(1);
|
||||
}
|
||||
const merged = JSON.parse(fs.readFileSync(mergedPath,'utf8'));
|
||||
const wb = XLSX.readFile(source);
|
||||
const byId = {};
|
||||
for (const v of merged) {
|
||||
byId[v.sourceId] = byId[v.sourceId] || [];
|
||||
byId[v.sourceId].push(v);
|
||||
}
|
||||
for (const sheet of wb.SheetNames) {
|
||||
if (!sheet.startsWith('UAT_') && !sheet.startsWith('VAPT_')) continue;
|
||||
const ws = wb.Sheets[sheet];
|
||||
const data = XLSX.utils.sheet_to_json(ws, {header:1, blankrows:false});
|
||||
if (data.length < 2) continue;
|
||||
const headers = data[1];
|
||||
let statusCol = headers.indexOf('Status');
|
||||
let remarksCol = headers.indexOf('Remarks');
|
||||
if (statusCol < 0) { statusCol = headers.length; headers.push('Status'); }
|
||||
if (remarksCol < 0) { remarksCol = headers.length; headers.push('Remarks'); }
|
||||
for (let r=2; r<data.length; r++) {
|
||||
const id = data[r][0];
|
||||
if (!id || !byId[id]) continue;
|
||||
const vars = byId[id];
|
||||
const failed = vars.filter(v => ['failed','timedOut'].includes(v.result));
|
||||
const passed = vars.filter(v => v.result === 'passed');
|
||||
const manual = vars.filter(v => v.result === 'manual');
|
||||
const notRun = vars.filter(v => v.result === 'not_run');
|
||||
let status = 'Not Run';
|
||||
if (failed.length) status = 'Fail';
|
||||
else if (notRun.length && passed.length) status = 'Partial';
|
||||
else if (manual.length === vars.length) status = 'Manual';
|
||||
else if (passed.length === vars.length || passed.length + manual.length === vars.length) status = 'Pass';
|
||||
data[r][statusCol] = status;
|
||||
data[r][remarksCol] = `v2.2 variants: ${passed.length} pass, ${failed.length} fail, ${manual.length} manual, ${notRun.length} not run.`;
|
||||
}
|
||||
wb.Sheets[sheet] = XLSX.utils.aoa_to_sheet(data);
|
||||
}
|
||||
fs.mkdirSync(path.dirname(output), {recursive:true});
|
||||
XLSX.writeFile(wb, output);
|
||||
console.log(`Updated Excel written: ${output}`);
|
||||
Reference in New Issue
Block a user