Quick Start Guide
Get Webshot Archive up and running in your project in under 10 minutes.
Overview
This guide will walk you through:
- Creating a Webshot Archive account and project
- Setting up authentication credentials
- Configuring a basic GitHub Actions workflow
- Running your first visual regression test
Step 1: Create Your Account
- Go to webshotarchive.com
- Click "Sign Up" and create your account
- Verify your email address
Start with our free tier - you can always upgrade later as your needs grow.
Step 2: Create a Project
- After signing in, click "Create Project"
- Give your project a name (e.g., "My Web App")
- Choose a description (optional)
- Click "Create Project"
You'll be taken to your project dashboard where you can see your project ID and settings.
Step 3: Set Up Authentication
You need to create API credentials for GitHub Actions to upload screenshots.
3.1 Create Service Account
- Go to your Account Settings
- Click "Add User" → "Add Service Account User (GitHub Actions)"
- Click "Add Service Account"
3.2 Generate Credentials
- Find your service account in the users list
- Click "View / Add Credentials"
- Click "Create Credentials"
- Copy both the Client ID and Client Secret (you won't see the secret again!)
3.3 Add to GitHub Secrets
- Go to your GitHub repository
- Navigate to Settings → Secrets and variables → Actions
- Add these secrets:
WEBSHOT_ARCHIVE_CLIENT_ID
= Your Client IDWEBSHOT_ARCHIVE_CLIENT_SECRET
= Your Client SecretWEBSHOT_ARCHIVE_PROJECT_ID
= Your Project ID
Step 4: Set Up Screenshot Capture
Choose your testing framework:
Option A: Cypress (Recommended)
If you don't have Cypress set up:
# Install Cypress
pnpm add -D cypress
# Initialize Cypress
npx cypress open
Create a basic test in cypress/e2e/visual.cy.js
:
describe('Visual Regression Tests', () => {
it('should capture homepage screenshot', () => {
cy.visit('http://localhost:3000');
cy.wait(1000); // Wait for any animations
cy.screenshot('homepage');
});
it('should capture about page screenshot', () => {
cy.visit('http://localhost:3000/about');
cy.wait(1000);
cy.screenshot('about-page');
});
});
Option B: Playwright
# Install Playwright
pnpm add -D @playwright/test
# Initialize Playwright
npx playwright install
Create a test in tests/visual.spec.js
:
const { test, expect } = require('@playwright/test');
test('visual regression tests', async ({ page }) => {
await page.goto('http://localhost:3000');
await page.waitForTimeout(1000);
await page.screenshot({ path: 'screenshots/homepage.png' });
await page.goto('http://localhost:3000/about');
await page.waitForTimeout(1000);
await page.screenshot({ path: 'screenshots/about-page.png' });
});
Step 5: Install the GitHub App
⚠️ Critical Step: To enable the GitHub Action to comment on pull requests, you must install the Webshot Archive GitHub App.
- Go to Webshot Archive GitHub App
- Click "Install"
- Select the repositories you want to use with Webshot Archive
- Click "Install" to complete the setup
This gives Webshot Archive the necessary permissions to:
- Read and write access to pull requests (for commenting on pull requests)
- React access to content (allows the app to view branches in the webshot arch)
- Read access to metadata
Without installing the GitHub App, the action will still upload screenshots but won't be able to comment on pull requests with visual diffs or view commits / branches in the Webshot Archive UI.
Step 6: Create GitHub Actions Workflow
Create .github/workflows/visual-tests.yml
:
This is an example workflow that assumes a typical React/Node.js setup. You'll need to adapt the commands, ports, and paths to match your specific project structure and build process.
name: Visual Regression Tests
on:
pull_request:
branches: [main]
push:
branches: [main]
permissions:
contents: read
pull-requests: write
jobs:
visual-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: pnpm install
- name: Start application
run: pnpm start &
env:
CI: true
- name: Wait for app to be ready
run: npx wait-on http://localhost:3000
- name: Run visual tests
run: pnpm cypress:run
continue-on-error: true
- name: Upload to Webshot Archive
uses: webshotarchive/github-[email protected]
with:
screenshotsFolder: cypress/screenshots
clientId: ${{ secrets.WEBSHOT_ARCHIVE_CLIENT_ID }}
clientSecret: ${{ secrets.WEBSHOT_ARCHIVE_CLIENT_SECRET }}
projectId: ${{ secrets.WEBSHOT_ARCHIVE_PROJECT_ID }}
Step 7: Test Your Setup
-
Start your application locally:
pnpm start
-
Run your visual tests:
# For Cypress
pnpm cypress run
# For Playwright
pnpm playwright test -
Create a test pull request:
- Make a small change to your app
- Commit and push to a new branch
- Create a pull request
-
Check the results:
- The GitHub Action will run automatically
- You'll see a comment on your PR with visual diffs
- Visit your Webshot Archive dashboard to see the full history