Compare commits

...

3 Commits

Author SHA1 Message Date
mahula
5c8ac4df57 a little linting 2025-10-07 11:18:15 +02:00
mahula
d69912ca35 Revert "make test fail to verify artefact upload"
This reverts commit 05a9b566892fb9393806db1e0b1ded1145311005.
2025-10-07 11:05:41 +02:00
mahula
d3a7881d38 refactor report generation fpr artefact upload job 2025-10-07 09:55:12 +02:00
3 changed files with 90 additions and 25 deletions

View File

@ -30,15 +30,4 @@ describe('Utopia Map Login Form Elements', () => {
.should('be.visible')
.should('contain.text', 'Forgot Password?')
})
it('should fail intentionally to test artifact upload', () => {
// This test is intentionally failing to verify artifact creation and upload
cy.get('h2').should('contain.text', 'Login')
// Take a screenshot before the intentional failure
cy.screenshot('before-intentional-failure')
// This assertion will fail intentionally
cy.get('body').should('contain.text', 'This text does not exist on the page')
})
})

View File

@ -81,12 +81,49 @@ export default tseslint.config(
}
},
// Node.js CommonJS files (plugins, etc.) - exclude TypeScript rules
{
files: ['plugins/**/*.js'],
languageOptions: {
ecmaVersion: 2020,
sourceType: 'commonjs',
globals: {
require: 'readonly',
module: 'readonly',
exports: 'readonly',
process: 'readonly',
console: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
Buffer: 'readonly',
global: 'readonly'
}
},
rules: {
// Disable TypeScript-specific rules for CommonJS files
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
// Allow CommonJS patterns
'no-undef': 'off',
'no-console': 'off',
// Keep basic JS rules
'no-unused-vars': 'warn',
'prefer-const': 'error',
'no-var': 'error'
}
},
{
ignores: [
'node_modules/**',
'cypress/downloads/**',
'cypress/screenshots/**',
'cypress/videos/**',
'cypress/plugins/**', // Ignore Node.js CommonJS plugin files
'results/**',
'dist/**',
'build/**',

View File

@ -21,14 +21,9 @@ echo "Report size: $(wc -c < results/html/merged-report.html) bytes"
# Copy screenshots with proper structure for the HTML report
echo "Copying screenshots to HTML report directory..."
echo "DEBUG: Current working directory: $(pwd)"
echo "DEBUG: Available directories:"
ls -la
if [ -d "screenshots" ]; then
echo "DEBUG: Screenshots directory found"
echo "DEBUG: Screenshots directory structure:"
find screenshots -type f -name "*.png" | head -10
echo "Screenshots directory found"
# Remove unwanted screenshots (like before-intentional-failure)
echo "Cleaning up unwanted screenshots..."
@ -38,19 +33,63 @@ if [ -d "screenshots" ]; then
# Create screenshots directory in the HTML output
mkdir -p "results/html/screenshots"
# Copy all screenshots maintaining directory structure
cp -r screenshots/* results/html/screenshots/ 2>/dev/null || true
# Extract all screenshot paths expected by the HTML report and copy them accordingly
echo "Extracting screenshot paths from HTML report..."
# Create screenshots directory in the HTML output
mkdir -p "results/html/screenshots"
if [ -f "results/merged-report.json" ]; then
echo "Reading expected screenshot paths from JSON report..."
# Extract all screenshot paths referenced in the JSON report (from context fields)
grep -o 'screenshots/[^"]*\.png' results/merged-report.json | sort -u | while read expected_path; do
# Extract components from expected path: screenshots/parent-dir/test-file/filename.png
if [[ "$expected_path" =~ screenshots/([^/]+)/([^/]+)/(.+) ]]; then
parent_dir="${BASH_REMATCH[1]}"
test_file="${BASH_REMATCH[2]}"
filename="${BASH_REMATCH[3]}"
# Try to find the actual screenshot in various possible locations
actual_screenshot=""
# 1. Try full structure first: screenshots/parent-dir/test-file/filename.png
if [ -f "screenshots/$parent_dir/$test_file/$filename" ]; then
actual_screenshot="screenshots/$parent_dir/$test_file/$filename"
# 2. Try flat structure: screenshots/test-file/filename.png
elif [ -f "screenshots/$test_file/$filename" ]; then
actual_screenshot="screenshots/$test_file/$filename"
# 3. Try direct file: screenshots/filename.png
elif [ -f "screenshots/$filename" ]; then
actual_screenshot="screenshots/$filename"
fi
if [ -n "$actual_screenshot" ] && [ -f "$actual_screenshot" ]; then
# Create the expected directory structure in results/html
target_path="results/html/$expected_path"
target_dir=$(dirname "$target_path")
mkdir -p "$target_dir"
# Copy the screenshot to the expected location
cp "$actual_screenshot" "$target_path"
echo "Mapped screenshot: $(basename "$test_file") -> $parent_dir/$test_file"
fi
fi
done
else
echo "❌ No JSON report found, cannot determine expected screenshot paths"
# Fallback: copy whatever structure exists
if [ -d "screenshots" ] && [ "$(find screenshots -name '*.png' | wc -l)" -gt 0 ]; then
echo "Fallback: copying existing screenshot structure..."
cp -r screenshots/* results/html/screenshots/ 2>/dev/null || true
fi
fi
echo "✅ Screenshots copied successfully"
echo "DEBUG: Final screenshot structure in HTML output:"
echo "Final screenshot structure:"
find results/html/screenshots -type f -name "*.png" | head -10
echo "DEBUG: Full results/html structure:"
find results/html -type f | head -20
else
echo "⚠️ No screenshots directory found"
echo "DEBUG: Available files and directories:"
find . -maxdepth 2 -type d
fi
echo "=== Final consolidated report ready ==="