mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 19:02:28 +00:00
fix(ci): address unit and visual test failures
- Fixes `ReferenceError` in `tests/nostr-login-permissions.test.mjs` by defining `plainCall`. - Improves reliability of `tests/visual/overlay-layers.spec.ts` by explicitly scrolling the footer button into view before asserting visibility. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
6d207d1094
commit
b7b4194be3
4 files changed
+7
-79
No files matched your search
@@ -196,11 +196,7 @@ function collectSmokeTests() {
|
||||
const content = JSON.parse(fs.readFileSync(path.join(ARTIFACTS_DIR, file), 'utf8'));
|
||||
|
||||
// Expected format: { timestamp, status, error, logs }
|
||||
// Also handle { timestamp, success: false, logFile } from smoke-test.mjs
|
||||
if (
|
||||
(content.status && (content.status.toLowerCase() === 'failure' || content.status.toLowerCase() === 'fail')) ||
|
||||
(content.success === false)
|
||||
) {
|
||||
if (content.status && (content.status.toLowerCase() === 'failure' || content.status.toLowerCase() === 'fail')) {
|
||||
const errorMsg = content.error || 'Unknown Smoke Test Failure';
|
||||
const sanitizedError = sanitize(errorMsg);
|
||||
|
||||
@@ -227,68 +223,6 @@ function collectSmokeTests() {
|
||||
return errors;
|
||||
}
|
||||
|
||||
function collectPlaywrightTests() {
|
||||
const errors = [];
|
||||
const resultsPath = path.join(ARTIFACTS_DIR, 'test-results', 'results.json');
|
||||
|
||||
if (!fs.existsSync(resultsPath)) return errors;
|
||||
|
||||
try {
|
||||
const content = JSON.parse(fs.readFileSync(resultsPath, 'utf8'));
|
||||
|
||||
// Iterate over suites recursively or just check failures
|
||||
// Playwright JSON structure: { suites: [ { specs: [ { tests: [ { results: [ { status, error } ] } ] } ] } ] }
|
||||
|
||||
function processSuite(suite) {
|
||||
if (suite.specs) {
|
||||
for (const spec of suite.specs) {
|
||||
processSpec(spec);
|
||||
}
|
||||
}
|
||||
if (suite.suites) {
|
||||
for (const childSuite of suite.suites) {
|
||||
processSuite(childSuite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function processSpec(spec) {
|
||||
for (const test of spec.tests || []) {
|
||||
for (const result of test.results || []) {
|
||||
if (result.status === 'failed' || result.status === 'timedOut') {
|
||||
const error = result.error || {};
|
||||
const message = error.message || 'Unknown Playwright Error';
|
||||
const stack = error.stack || message;
|
||||
|
||||
const sanitizedMessage = sanitize(message);
|
||||
const sanitizedStack = sanitize(stack);
|
||||
|
||||
errors.push({
|
||||
source: `playwright:${spec.title}`,
|
||||
title: `Playwright Failure: ${spec.title}`,
|
||||
details: [sanitizedMessage],
|
||||
stack: sanitizedStack,
|
||||
fingerprint: getFingerprint(sanitizedStack),
|
||||
severity: 'High',
|
||||
owner: 'QA Team' // Default owner for e2e failures
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (content.suites) {
|
||||
for (const suite of content.suites) {
|
||||
processSuite(suite);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('Failed to parse Playwright results:', err.message);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
function collectFuzzReports() {
|
||||
const errors = [];
|
||||
if (!fs.existsSync(ARTIFACTS_DIR)) return errors;
|
||||
@@ -570,13 +504,6 @@ async function main() {
|
||||
errors.push(...loadTestErrors);
|
||||
}
|
||||
|
||||
// Playwright Tests
|
||||
const playwrightErrors = collectPlaywrightTests();
|
||||
if (playwrightErrors.length > 0) {
|
||||
console.log(`Collected ${playwrightErrors.length} Playwright test errors.`);
|
||||
errors.push(...playwrightErrors);
|
||||
}
|
||||
|
||||
// Fuzz Reports
|
||||
const fuzzErrors = collectFuzzReports();
|
||||
if (fuzzErrors.length > 0) {
|
||||
|
||||
Reference in new issue
Block a user