64 Commits

Author SHA1 Message Date
Keith Solomon
2cb5038c00 🐞 fix: Fix encoding of URLs in test links
All checks were successful
Sync TODOs with Issues / sync_todos (push) Successful in 5s
2025-05-30 19:01:32 -05:00
Keith Solomon
c6070dffeb 🐞 fix: change url validation to require scheme and allow path 2025-05-29 07:15:29 -05:00
Keith Solomon
de88a320d7 feature: Add TODOs action 2025-05-29 06:43:30 -05:00
Keith Solomon
1b8235e3a5 🔵 other: Add TODO for other pages 2025-05-29 06:40:26 -05:00
Keith Solomon
8b94d14088 feature: Style main navigation 2025-05-29 06:38:51 -05:00
Keith Solomon
e844613eec feature: Add page for signle site test list 2025-05-28 22:13:54 -05:00
Keith Solomon
a994cd8266 🐞 fix: Adjust button position for consistency 2025-05-28 20:57:25 -05:00
Keith Solomon
ff4ff4c587 feature: Add padding for search label 2025-05-27 22:18:22 -05:00
Keith Solomon
3bbdf90ccf 🐞 fix: Fix card overflow 2025-05-27 21:58:54 -05:00
Keith Solomon
9659d93556 🐞 fix: Make header title a link to home 2025-05-27 19:50:20 -05:00
Keith Solomon
309e174a46 feature: Add success message display for site creation 2025-05-27 19:25:27 -05:00
Keith Solomon
cfba9672ef feature: Add basic template and wire up single domain list 2025-05-27 19:05:06 -05:00
Keith Solomon
1c6e96e94c feature: Incorporate new sites routes, add dummy favicon to stop 404 errors 2025-05-27 18:51:15 -05:00
Keith Solomon
c133603e43 feature: Add button for single domain page 2025-05-26 20:21:39 -05:00
Keith Solomon
5845bbeca3 feature: Make index page a grid of domains and tests in cards 2025-05-26 19:48:29 -05:00
Keith Solomon
f62012c13d feature: Reversed array to show latest entries first 2025-05-26 08:30:15 -05:00
Aarish
e0daee72da Redirect to home on successfully ading a new site 2025-05-25 18:24:42 -05:00
Keith Solomon
4020b33293 Refactor routes and views for improved clarity and functionality
- Commented out console log in the home route to reduce clutter in logs.
- Updated formatting and consistency in the sites route, including removing unused domain fetching functionality.
- Added form action to the add-form view for submitting new sites, ensuring the input field is properly named for backend processing.
2025-05-25 17:53:13 -05:00
Keith Solomon
88a6969f2f Merge branch 'feature/integrate-playwright' into feature/dashboard 2025-05-25 17:40:08 -05:00
Aarish
f86bfee3f3 Updat name - getByDomainName() returns an array 2025-05-25 17:14:26 -05:00
Aarish
57c393d939 Add a method to fetch by domain 2025-05-25 17:11:34 -05:00
Aarish
f28328dcc4 Remove name from insert method - this is removed from db schema 2025-05-25 17:06:37 -05:00
Aarish
b9967a8e66 handle errors thrown by model incase there is any error while fetching the site 2025-05-25 16:58:34 -05:00
Keith Solomon
4ba36081d2 feature: Wire up sites API listing, move add form to separate file 2025-05-25 14:51:37 -05:00
Keith Solomon
4c2576052f Update packages 2025-05-25 13:37:37 -05:00
Keith Solomon
841c416a93 Merge branch 'main' into feature/dashboard 2025-05-25 13:36:32 -05:00
Keith Solomon
08a1beff07 🐞 fix: Fix alignemnt and font size of site grid 2025-05-25 09:57:24 -05:00
Aarish
512d18ec23 update index.js to show domain_name 2025-05-24 21:09:27 -05:00
Aarish
c364e31ee3 handle exceptions while adding the site 2025-05-24 18:37:54 -05:00
Aarish
061f9121b9 add insert validation 2025-05-24 18:37:36 -05:00
Aarish
1ef5815f65 domain name validation logic 2025-05-24 18:36:56 -05:00
Aarish
f9710d4387 Fix insert request 2025-05-24 18:16:45 -05:00
Keith Solomon
380478d20a 🐞 fix: Update list to show url and adjust spacing 2025-05-24 17:48:58 -05:00
Aarish
9394dd2990 I don't know what this is... 2025-05-24 17:44:11 -05:00
Aarish
8fa0656366 loop the sites array 2025-05-24 17:43:57 -05:00
Aarish
712df1d8a0 example for querying sites stored in db 2025-05-24 17:43:45 -05:00
Aarish
9b523f0acf Fix package.json conflic errors 2025-05-24 17:43:18 -05:00
Aarish
96ea2af153 Merge remote-tracking branch 'origin/main' 2025-05-24 17:36:54 -05:00
Aarish
660c520561 Merge branch 'feature/integrate-playwright' 2025-05-24 17:33:39 -05:00
aarish
5f7fbab021 Merge pull request 'Feature: Integrate Tailwind' (#14) from feature/integrate-tailwind into main
Reviewed-on: #14
Reviewed-by: aarish <aarishgilani10@gmail.com>
2025-05-24 22:24:11 +00:00
Keith Solomon
4fce9ab108 feature: Dashboard mockup 2025-05-24 17:04:00 -05:00
Keith Solomon
fc6793df06 feature: Add DaisyUI library 2025-05-24 16:04:13 -05:00
Aarish
44a69a48a4 init site routes - to move this into api later 2025-05-24 00:05:47 -05:00
Aarish
5e7f97f2fb add export and fix async functions 2025-05-24 00:05:24 -05:00
Aarish
c1eabb9dac Build sites resource routes 2025-05-23 23:50:27 -05:00
Aarish
a1387db6b1 add get methods - siteModel 2025-05-23 23:35:12 -05:00
Aarish
a30942daae build a model to interact with sites table 2025-05-23 22:39:21 -05:00
Aarish
fc360fd2ca Build a autheticaiton module for supabase 2025-05-23 22:38:59 -05:00
Aarish
369a2cc1b7 include client to interact with supabase api 2025-05-23 22:38:39 -05:00
Aarish
a27ffb3016 Add a todoComment 2025-05-23 00:55:45 -05:00
Aarish
d79c581ea8 Better comments 2025-05-23 00:55:04 -05:00
Aarish
355837ffd0 Better comments 2025-05-23 00:48:47 -05:00
Aarish
7773e85811 refactor playwright service class 2025-05-23 00:42:55 -05:00
Aarish
b194ff6924 Update api route timeout, this is resource intensive task, find a better way to handle this 2025-05-23 00:42:22 -05:00
Aarish
365c599cd3 Include JSDOM dependency - using it to parse page.content returned by playwright 2025-05-23 00:41:49 -05:00
Aarish
4ccbef77d2 refactor to use rootUrl method 2025-05-22 23:46:37 -05:00
Aarish
966b3f1c1f Add block comment for runAccessibilityTest method 2025-05-22 23:46:11 -05:00
Aarish
38da11fd99 build methods to return site map url and site root url 2025-05-22 23:45:50 -05:00
Aarish
eece05bced remove unwanted instance variables 2025-05-22 23:45:24 -05:00
Aarish
79c4ecdc7a Include playright and axe-core dependencies 2025-05-22 22:51:26 -05:00
Aarish
67b91d9624 Build a service class to handle Playwright Testing 2025-05-22 22:51:11 -05:00
Aarish
1f77198683 register /api endpoints 2025-05-22 22:50:28 -05:00
Aarish
a624b4c8a2 build api endpoints /api 2025-05-22 22:50:19 -05:00
Aarish
6d17cdacc1 axe test helper - to reuse accessibility test fixures. If future these can be test options/types 2025-05-22 22:50:05 -05:00
23 changed files with 4368 additions and 284 deletions

26
.github/workflows/todos.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: Sync TODOs with Issues
on:
workflow_dispatch:
push:
paths-ignore:
- '**.md'
jobs:
sync_todos:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Sync TODOs
uses: Solo-Web-Works/TODO-Sync@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
summary_file: TODO_SUMMARY.md
dry_run: false
commit: false

11
app.js
View File

@@ -4,8 +4,10 @@ const path = require('path');
const cookieParser = require('cookie-parser'); const cookieParser = require('cookie-parser');
const logger = require('morgan'); const logger = require('morgan');
const indexRouter = require('./routes/index'); var indexRouter = require('./routes/index');
const usersRouter = require('./routes/users'); var usersRouter = require('./routes/users');
const apiRouter = require('./routes/api');
const sitesRouter = require('./routes/sites');
const app = express(); const app = express();
@@ -20,8 +22,13 @@ app.use(express.urlencoded({ extended: false }));
app.use(cookieParser()); app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public'))); app.use(express.static(path.join(__dirname, 'public')));
/**
* Register routers for different routes
*/
app.use('/', indexRouter); app.use('/', indexRouter);
app.use('/api', apiRouter);
app.use('/users', usersRouter); app.use('/users', usersRouter);
app.use('/sites', sitesRouter);
// catch 404 and forward to error handler // catch 404 and forward to error handler
app.use(function(req, res, next) { app.use(function(req, res, next) {

8
auth.js Normal file
View File

@@ -0,0 +1,8 @@
const { createClient } = require('@supabase/supabase-js');
const supabase = createClient(
'https://rwulmnzzmieuosakijoe.supabase.co',
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJ3dWxtbnp6bWlldW9zYWtpam9lIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDgwNTQ4NDEsImV4cCI6MjA2MzYzMDg0MX0.ZEBJ6v0-u77z1cqRJvA8WOcGRxd8fcN0vqeYJNQgd_U'
);
module.exports.supabase = supabase;

17
helpers/axe-test.js Normal file
View File

@@ -0,0 +1,17 @@
const base = require('@playwright/test');
const AxeBuilder = require('@axe-core/playwright').default;
// Extend base test by providing "makeAxeBuilder"
//
// This new "test" can be used in multiple test files, and each of them will get
// a consistently configured AxeBuilder instance.
exports.test = base.test.extend({
makeAxeBuilder: async ({ page }, use) => {
const makeAxeBuilder = () => new AxeBuilder({ page })
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
.exclude('#commonly-reused-element-with-known-issue');
await use(makeAxeBuilder);
}
});
exports.expect = base.expect;

17
helpers/utils.js Normal file
View File

@@ -0,0 +1,17 @@
/**
* Utility functions for the application.
*/
const isValidDomain = (domain) => {
// Regular expression to validate a domain name
// const domainRegex = /^(?!:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/;
// Regular expression to validate a domain name. Requires http or https prefix.
// Allows for optional path after the domain.
const domainRegex = /^https?:\/\/[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(\/[^\s]*)?\/?$/;
return domainRegex.test(domain);
}
module.exports = {
isValidDomain
};

103
models/SiteModel.js Normal file
View File

@@ -0,0 +1,103 @@
/**
* Model for managing sites table in the database.
*/
const { supabase } = require('../auth');
const { isValidDomain } = require('../helpers/utils');
class SiteModel {
static tableName = 'sites';
/**
* Inserts a new site into the database.
*
* @param {string} domainName - The domain name of the site.
*
* @returns {Promise<Object>} - The result of the insert operation.
*/
async insert(domainName) {
// validate inputs
if (!domainName) {
throw new Error('Domain name is required to insert a site.');
}
// validate domain name format
if (!isValidDomain(domainName)) {
throw new Error('Invalid domain name format.');
}
// check if the domain name already exists
if (await this.getByDomainName(domainName).then(data => data.length !== 0)) {
throw new Error('Domain name already exists.');
}
const { data, error } = await supabase.from(SiteModel.tableName).insert({
domain_name: domainName,
}).select();
if (error) {
console.error('Error inserting site:', error);
throw error;
}
return data;
}
/**
* Retrieves all sites from the database.
*
* @returns {Promise<Array>} - An array of site objects.
*/
async getAll() {
const { data, error } = await supabase.from(SiteModel.tableName).select('*');
if (error) {
console.error('Error fetching sites:', error);
throw error;
}
data.reverse(); // Reverse the order to show the most recent sites first
return data;
}
/**
* Retrieves a site by its ID.
*
* @param {number} id - The ID of the site.
*
* @returns {Promise<Object>} - The site object.
*/
async getById(id) {
const { data, error } = await supabase.from(SiteModel.tableName).select('*').eq('id', id).single();
if (error) {
console.error('Error fetching site by ID:', error);
throw error;
}
return data;
}
/**
* Retrieves a site by its domain name.
*
* @param {string} domainName - The domain name of the site.
*
* @returns {Promise<Object>} - The site object.
*/
async getByDomainName(domainName) {
const { data, error } = await supabase.from(SiteModel.tableName).select('*').eq('domain_name', domainName);
if (error) {
console.error('Error fetching site by domain name:', error);
throw error;
}
return data;
}
}
module.exports = SiteModel;

1101
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -9,17 +9,23 @@
"build:css": "tailwindcss -i ./styles/base.css -o ./public/stylesheets/style.css --minify" "build:css": "tailwindcss -i ./styles/base.css -o ./public/stylesheets/style.css --minify"
}, },
"dependencies": { "dependencies": {
"@axe-core/playwright": "^4.10.1",
"@playwright/test": "^1.52.0",
"@supabase/supabase-js": "^2.49.8",
"axe-playwright": "^2.1.0",
"cookie-parser": "~1.4.4", "cookie-parser": "~1.4.4",
"debug": "~2.6.9", "debug": "~2.6.9",
"ejs": "^3.1.10", "ejs": "^3.1.10",
"express": "~4.16.1", "express": "~4.16.1",
"http-errors": "~1.6.3", "http-errors": "~1.6.3",
"jsdom": "^26.1.0",
"morgan": "~1.9.1" "morgan": "~1.9.1"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/cli": "^4.1.7", "@tailwindcss/cli": "^4.1.7",
"@tailwindcss/typography": "^0.5.16", "@tailwindcss/typography": "^0.5.16",
"tailwindcss": "^4.1.7", "concurrently": "^8.2.0",
"concurrently": "^8.2.0" "daisyui": "^5.0.37",
"tailwindcss": "^4.1.7"
} }
} }

1
public/favicon.ico Normal file
View File

@@ -0,0 +1 @@

File diff suppressed because it is too large Load Diff

27
routes/api.js Normal file
View File

@@ -0,0 +1,27 @@
// import router from express
var express = require('express');
const PlaywrightService = require('../services/PlaywrightService');
var router = express.Router();
/**
* GET run accessibility test on domain
* Only works for homepage
* // TODO: Crawl site map and queue all pages
*/
router.get('/test/accessibility/:domain', function(req, res) {
req.setTimeout(5000000000000);
const domain = req.params.domain; // Get the domain from the request parameters
const playwrightService = new PlaywrightService(domain);
// Call the runAccessibilityTest method
playwrightService.getAccessibilityResults().then(results => {
// Send the results as a JSON response
res.json(results);
}).catch(err => {
// Handle any errors that occur during the test
res.status(500).json({ error: err.message });
});
});
module.exports = router;

View File

@@ -1,9 +1,13 @@
var express = require('express'); const express = require('express');
var router = express.Router(); const router = express.Router();
const SiteModel = require('../models/SiteModel');
const sitesModel = new SiteModel();
/* GET home page. */ /* GET home page. */
router.get('/', function(req, res, next) { router.get('/', async function(req, res, next) {
res.render('index', { title: 'Express' }); const sites = await sitesModel.getAll();
// console.log('Sites:', sites);
res.render('index', { title: 'Playwright Testing Dashboard', sites: sites, msg: '' });
}); });
module.exports = router; module.exports = router;

106
routes/sites.js Normal file
View File

@@ -0,0 +1,106 @@
const express = require('express');
const router = express.Router();
const SiteModel = require('../models/SiteModel');
const siteModel = new SiteModel();
/**
* GET sites listing.
*
* Returns a list of all sites in JSON format.
*/
router.get('/', async function (req, res, next) {
const sites = await siteModel.getAll();
res.json(sites);
});
/**
* GET site by ID.
*
* Returns a specific site by its ID in JSON format.
*/
router.get('/:id', async function (req, res, next) {
const siteId = req.params.id;
let site = null;
try {
site = await siteModel.getById(siteId);
} catch (error) {
console.error('Error fetching site by ID:', error);
return res.status(400).send('Error fetching site: ' + error.message);
}
if (!site) {
return res.status(404).send('Site not found');
} else {
res.json(site);
}
});
/**
* GET site by domain name.
*
* Returns a specific site by its domain name in JSON format.
*/
router.get('/domain/:domain', async function (req, res, next) {
const domainName = req.params.domain;
let sites = null;
try {
sites = await siteModel.getByDomainName(domainName);
} catch (error) {
console.error('Error fetching site by domain name:', error);
return res.status(400).send('Error fetching site: ' + error.message);
}
if (!sites || sites.length === 0) {
return res.status(404).send('Site not found');
} else {
res.render('sites', { title: 'Playwright Testing Dashboard', sites: sites });
}
});
/**
* POST create a new site.
*
* Creates a new site with the provided domain name.
*
* // TODO: Ability to add additional site properties (e.g., name, description)
*/
router.post('/add', async function (req, res, next) {
const domain = req.body.domain;
let newSite = null;
// insert method passes a lot of validation errors to the caller
try {
newSite = await siteModel.insert(domain);
} catch (error) {
console.error('Error creating site:', error);
return res.status(400).send('Error creating site: ' + error.message);
}
if (!newSite) {
res.status(400).send('Error creating site');
} else {
// res.status(201).json(newSite);
const sites = await siteModel.getAll();
res.render('index', { title: 'Playwright Testing Dashboard', sites: sites, msg: 'Site created successfully!' });
}
});
/**
* PUT update an existing site.
*
* Updates an existing site with the provided ID and new data.
*/
// TODO: Implement update functionality
/**
* DELETE remove a site by ID.
*/
// TODO: Implement delete functionality
module.exports = router;

View File

@@ -0,0 +1,110 @@
// import playwright dependencies
const { chromium } = require('playwright');
const { injectAxe, checkA11y } = require('axe-playwright');
const jsdom = require("jsdom");
/**
* PlaywrightService class
*
* This class is used to interact with the Playwright library
*/
class PlaywrightService {
#domain; // domain of the site to be tested
// constructor
constructor(domain) {
this.#domain = domain;
}
// get sitemap url for the this domain
sitemapUrl() {
return `${this.rootUrl()}/sitemap.xml`;
}
// get the url of the site to be tested
rootUrl() {
return `https://${this.#domain}`;
}
/**
* Get the list of urls to be tested by querying
* the sitemap and returning the list of urls
*
* @param {string} url - The URL of the sitemap
*
* @returns {Array} - The list of urls to be tested
*/
async getUrlList() {
const browser = await chromium.launch();
const page = await browser.newPage();
let urls = [];
try {
await page.goto(this.sitemapUrl());
const content = await page.content();
const dom = new jsdom.JSDOM(content);
const sitemapUrls = dom.window.document.querySelectorAll('a[href]');
urls = Array.from(sitemapUrls).map(link => link.href);
console.log('Sitemap URLs:', urls);
} catch (error) {
console.error('Error fetching sitemap:', error);
} finally {
await browser.close();
}
return urls;
}
/**
* Loops through the list of urls and runs the
* accessibility test on each url
*
* @returns {Array} - The list of results from the accessibility test
*/
async getAccessibilityResults() {
const urls = await this.getUrlList();
let results = [];
while (urls.length > 0) {
const url = urls.pop();
console.log('Running accessibility test on:', url);
const result = await PlaywrightService.#runAccessibilityTest(url);
results.push([url, result]);
}
return results;
}
/**
* Run accessibility test on given url
*
* @param {string} url - The URL of the page to test
*
* @returns {Array} - The list of results from the accessibility test
*/
static async #runAccessibilityTest(url) {
const browser = await chromium.launch();
const page = await browser.newPage();
let results = [];
try {
await page.goto(url); // TODO: Retry if this times out
await injectAxe(page);
results = await page.evaluate(async () => {
return await window.axe.run();
});
} catch(error) {
console.error('Error running accessibility test:', error);
} finally {
await browser.close();
}
return results?.violations || 'No violations found';
}
}
module.exports = PlaywrightService;

View File

@@ -1,5 +1,9 @@
@import 'tailwindcss'; @import 'tailwindcss';
@source "./views/*.ejs";
@source "./styles/*.css";
@import './colors.css'; @import './colors.css';
@import './typography.css'; @import './typography.css';
@plugin "daisyui";
@plugin "@tailwindcss/typography"; @plugin "@tailwindcss/typography";

View File

@@ -108,12 +108,15 @@ p {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
li ul, li ol { margin: 0 1rem; }
ul { list-style-type: disc; } ul { list-style-type: disc; }
#main-nav ul { list-style-type: none; }
ol { list-style-type: decimal; } ol { list-style-type: decimal; }
li ul, li ol { margin: 0 1rem; }
ol ol { list-style: lower-alpha; } ol ol { list-style: lower-alpha; }
ol ol ol { list-style: lower-roman; } ol ol ol { list-style: lower-roman; }

12
views/add-form.ejs Normal file
View File

@@ -0,0 +1,12 @@
<form action="/sites/add" method="POST" class="w-full">
<fieldset class="fieldset bg-base-100 rounded-box px-8 py-4 shadow-md">
<legend class="fieldset-legend h3">Start a new test</legend>
<div class="flex gap-0">
<div class="w-fit m-0 p-0">
<input type="text" class="input w-full border-r-0 rounded-r-none" name="domain" id="domain" placeholder="https://example.com/" />
<p class="label pt-2">Single URL or link to sitemap, including "http" or "https"</p>
</div>
<button type="submit" class="btn btn-info">Test</button>
</div>
</fieldset>
</form>

49
views/domain-cards.ejs Normal file
View File

@@ -0,0 +1,49 @@
<%
// Helper function to format date
function formatDate(dateString) {
let date = new Date(dateString);
return date.toLocaleString('en-CA', {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
minute: '2-digit'
});
}
// Group data by unique domain_name
let groupedDomains = {};
data.forEach(item => {
let domain = item.domain_name?.trim();
if (!domain) return;
if (!groupedDomains[domain]) {
groupedDomains[domain] = [];
}
groupedDomains[domain].push(item);
});
%>
<div class="card-container grid gap-6 grid-cols-1 md:grid-cols-3 lg:grid-cols-4">
<% Object.keys(groupedDomains).forEach(domain => { %>
<%
// Sort entries by created_at descending and limit to 5
let sortedEntries=groupedDomains[domain]
.sort((a, b) => new Date(b.created_at) - new Date(a.created_at))
.slice(0, 5);
%>
<div class="card w-full bg-base-100 card-lg shadow-sm wrap-anywhere">
<div class="card-body">
<h2 class="card-title"><%= domain %></h2>
<% sortedEntries.forEach(entry => { %>
<div class="flex font-normal">
<p class="w-fit"><%= entry.id %></p>
<p class="flex-grow-1"><%= formatDate(entry.created_at) %></p>
</div>
<% }) %>
<div class="card-actions justify-end mt-auto">
<a href="/sites/domain/<%= encodeURIComponent(domain) %>" class="btn btn-info text-info-content! hover:text-info-content!">View All Tests</a>
</div>
</div>
</div>
<% }) %>
</div>

View File

@@ -1,3 +1,59 @@
<!DOCTYPE html>
<html>
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Raleway:wght@100..900&display=swap">
<title>
Playwright Dashboard - ERROR
</title>
<link rel='stylesheet' href='/stylesheets/style.css' />
</head>
<body>
<main class="">
<header class="bg-gray-200 w-full">
<div class="container mx-auto flex justify-between items-center text-gray-800 py-4">
<div class="flex items-center">
<!-- <img src="/images/logo.png" alt="Logo" class="h-8 mr-2"> -->
<h1 class="">
Playwright Dashboard - ERROR
</h1>
</div>
<nav>
<ul class="flex space-x-4">
<li><a href="/" class="text-white hover:text-gray-400">Home</a></li>
<li><a href="/about" class="text-white hover:text-gray-400">About</a></li>
<li><a href="/contact" class="text-white hover:text-gray-400">Contact</a></li>
</ul>
</nav>
</div>
</header>
<article class="container mx-auto py-4 min-h-[70dvh]">
<h1><%= message %></h1> <h1><%= message %></h1>
<h2><%= error.status %></h2> <h2><%= error.status %></h2>
<pre><%= error.stack %></pre> <pre><%= error.stack %></pre>
</article>
<footer class="bg-gray-800 text-white p-4 mt-8">
<div class="container mx-auto text-center">
<div class="flex justify-center gap-8 items-center mb-4">
<p>&copy; <%= new Date().getFullYear() %>
Playwright Dashboard. All rights reserved.</p>
<p>Powered by <a href="https://example.com" class="text-bodylinks">Your Company</a></p>
</div>
<p>
<a href="/privacy" class="text-blue-400">Privacy Policy</a> |
<a href="/terms" class="text-blue-400">Terms of Service</a>
</p>
</div>
</footer>
</main>
</body>
</html>

View File

@@ -19,11 +19,12 @@
<div class="container mx-auto flex justify-between items-center text-gray-800 py-4"> <div class="container mx-auto flex justify-between items-center text-gray-800 py-4">
<div class="flex items-center"> <div class="flex items-center">
<!-- <img src="/images/logo.png" alt="Logo" class="h-8 mr-2"> --> <!-- <img src="/images/logo.png" alt="Logo" class="h-8 mr-2"> -->
<h1 class=""><%= title %></h1> <h1 class=""><a class="no-underline!" href="/"><%= title %></a></h1>
</div> </div>
<nav> <nav id="main-nav" class="flex items-center">
<ul class="flex space-x-4"> <ul class="flex space-x-4">
<li><a href="/" class="text-white hover:text-gray-400">Home</a></li> <li><a href="/" class="text-white hover:text-gray-400">Home</a></li>
<!-- TODO: Make these routes/pages -->
<li><a href="/about" class="text-white hover:text-gray-400">About</a></li> <li><a href="/about" class="text-white hover:text-gray-400">About</a></li>
<li><a href="/contact" class="text-white hover:text-gray-400">Contact</a></li> <li><a href="/contact" class="text-white hover:text-gray-400">Contact</a></li>
</ul> </ul>

View File

@@ -1,8 +1,20 @@
<%- include('header'); -%> <%- include('header'); -%>
<article class="container mx-auto py-4 min-h-[70dvh]"> <article class="container mx-auto py-4 min-h-[70dvh]">
<h2>Welcome to the <%= title %> EJS Template</h2> <h2>Welcome to <%= title %></h2>
<p>This is a simple example of using EJS for templating.</p>
<%- include('add-form'); -%>
<% if (msg) { %>
<div class="alert alert-success mt-4">
<div class="text-xl"><%= msg %></div>
</div>
<% } %>
<h2 class="text-25px font-bold mt-8">Your Tests</h2>
<div class="mt-8">
<%- include('domain-cards', { data: sites }); -%>
</div>
</article> </article>
<%- include('footer'); -%> <%- include('footer'); -%>

15
views/sites.ejs Normal file
View File

@@ -0,0 +1,15 @@
<%- include('header'); -%>
<article class="container mx-auto py-4 min-h-[70dvh]">
<h2>Welcome to <%= title %></h2>
<%- include('add-form'); -%>
<h2 class="text-25px font-bold mt-8">Tests for <%= sites[0].domain_name %></h2>
<div class="mt-8">
<%- include('test-list', { sites: sites }); -%>
</div>
</article>
<%- include('footer'); -%>

23
views/test-list.ejs Normal file
View File

@@ -0,0 +1,23 @@
<%
// Helper function to format date
function formatDate(dateString) {
let date = new Date(dateString);
return date.toLocaleString('en-CA', {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
minute: '2-digit'
});
}
%>
<ul class="list bg-base-100 rounded-box shadow-md mt-8">
<% for (let i=0; i < sites.length; i++) { %>
<li class="list-row list-none items-center gap-8">
<h3 class="text-slate-300 m-0 p-0"><a href="/test/<%= i %>" class="text-slate-300 link">Test <%= i+1 %></a></h3>
<span class="site-name list-col-grow text-18px"><%= sites[i].domain_name %> - <%= formatDate(sites[i].created_at) %></span>
<span class="badge badge-info">In Progress</span>
</li>
<% } %>
</ul>