Skip to content

Commit

Permalink
First!
Browse files Browse the repository at this point in the history
  • Loading branch information
vpetersson committed Dec 7, 2024
1 parent 22a2e62 commit d2e8d20
Show file tree
Hide file tree
Showing 11 changed files with 8,246 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .cursorrules
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
You are a senior engineer writing a Zapier integration for Screenly.

You are going to use the Screenly API documentation from here:
https://developer.screenly.io/api_v4_1/

Include unit tests for 80% coverage or more. Don't manage lockfiles manually -- use the appropriate tooling.

Make sure to run `npm audit fix` and lint all code base.
86 changes: 86 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- name: Run tests with coverage
run: |
npm test
echo "# Test Results (Node ${{ matrix.node-version }})" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
cat coverage/lcov-report/index.html | grep -A 4 "<div class='fl pad1y space-right2'>" | grep -v "<div" | sed 's/<span class="strong">//g' | sed 's/<\/span>//g' | sed 's/^[ \t]*//' >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "## Coverage Report" >> $GITHUB_STEP_SUMMARY
echo "Full coverage report available as artifact." >> $GITHUB_STEP_SUMMARY
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report-${{ matrix.node-version }}
path: coverage
retention-days: 14

visual-test:
runs-on: ubuntu-latest
needs: test
container:
image: mcr.microsoft.com/playwright:v1.40.0-jammy
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: npm ci
- name: Run visual tests
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1280x800x24" npm run test:visual:ci
echo "# Visual Test Results" >> $GITHUB_STEP_SUMMARY
echo "## Screenshots" >> $GITHUB_STEP_SUMMARY
echo "The following forms were tested:" >> $GITHUB_STEP_SUMMARY
echo "- Upload Asset Form" >> $GITHUB_STEP_SUMMARY
echo "- Complete Workflow Form" >> $GITHUB_STEP_SUMMARY
echo "- Cleanup Confirmation Form" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Screenshots are available in the artifacts." >> $GITHUB_STEP_SUMMARY
if [ -d "__image_snapshots__/__diff_output__" ]; then
echo "## Visual Differences Detected" >> $GITHUB_STEP_SUMMARY
echo "Check the artifacts for diff images." >> $GITHUB_STEP_SUMMARY
fi
- name: Upload visual test artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: visual-test-output
path: |
__image_snapshots__
__image_snapshots__/__diff_output__
retention-days: 14
- name: Generate visual test report
if: always()
run: |
echo "## Visual Test Summary" >> $GITHUB_STEP_SUMMARY
echo "### Base Screenshots" >> $GITHUB_STEP_SUMMARY
ls -l __image_snapshots__ | grep -v diff | awk '{print "- "$9}' >> $GITHUB_STEP_SUMMARY
if [ -d "__image_snapshots__/__diff_output__" ]; then
echo "### Diff Images" >> $GITHUB_STEP_SUMMARY
ls -l __image_snapshots__/__diff_output__ | awk '{print "- "$9}' >> $GITHUB_STEP_SUMMARY
fi
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Dependencies
node_modules/

# Zapier build files
.zapierapprc
build/
.env

# Testing
coverage/
__image_snapshots__/

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# IDE
.idea/
.vscode/
*.swp
*.swo
.DS_Store

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history
Loading

0 comments on commit d2e8d20

Please sign in to comment.