# QA Tool — Automated Testing Platform

An in-house automated testing tool for web projects. Paste any URL, run tests, get a full bug report with screenshots.

## What it tests automatically
- HTTP errors (404, 500, etc.)
- Page load speed (flags slow pages)
- JavaScript console errors
- JavaScript runtime crashes
- Broken images
- Desktop & mobile layout overflow (design glitches)
- Form validation (missing submit buttons, unlabelled fields)
- Missing title tags and meta descriptions
- Missing viewport meta tag (mobile unfriendly)
- Mixed content on HTTPS pages
- Failed resource loads (CSS, JS, images)
- Empty visible sections

Works with: WordPress, CodeIgniter, Node.js, Laravel, React, Rise CRM, WooCommerce — anything with a URL.

---

## Installation on GoDaddy VPS (Ubuntu 20/22)

### Step 1 — Upload files
Upload this folder to your VPS. Recommended path: `/var/www/qa-tool`

```bash
# On your local machine
scp -r qa-tool/ root@YOUR_SERVER_IP:/var/www/qa-tool
```

### Step 2 — Run installer
```bash
cd /var/www/qa-tool
chmod +x install.sh
./install.sh
```

### Step 3 — Configure .env
```bash
nano .env
```
Edit APP_URL to your server IP or domain. SMTP is optional (for email reports).

### Step 4 — Start the tool
```bash
pm2 start ecosystem.config.js
pm2 save
pm2 startup
```

### Step 5 — Access the dashboard
Open: `http://YOUR_SERVER_IP:3000`

---

## Nginx Reverse Proxy (run on port 80)

Install Nginx and set up a reverse proxy so you can access the tool on port 80 (or with a domain name):

```bash
sudo apt install nginx -y
sudo nano /etc/nginx/sites-available/qa-tool
```

Paste this config:
```nginx
server {
    listen 80;
    server_name qa.yourdomain.com;  # or your server IP

    client_max_body_size 10M;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_read_timeout 120s;
    }

    location /screenshots/ {
        alias /var/www/qa-tool/screenshots/;
        expires 7d;
    }
}
```

Enable it:
```bash
sudo ln -s /etc/nginx/sites-available/qa-tool /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
```

---

## Useful PM2 commands

```bash
pm2 status              # see if tool is running
pm2 logs qa-tool        # view logs
pm2 restart qa-tool     # restart after code changes
pm2 stop qa-tool        # stop the tool
```

---

## Recommended VPS specs
- RAM: 4GB minimum (Chrome is memory hungry)
- Disk: 10GB+ (screenshots accumulate)
- OS: Ubuntu 20.04 or 22.04

---

## Folder structure
```
qa-tool/
├── server.js          # Express server + API routes
├── src/
│   ├── db.js          # SQLite database setup
│   └── runner.js      # Playwright test engine
├── public/
│   └── index.html     # Dashboard UI
├── screenshots/       # Auto-generated test screenshots
├── data/              # qa.db SQLite database
├── logs/              # PM2 log files
├── ecosystem.config.js
├── install.sh
└── .env
```
