added messages list, new client form, logic for client Apps plus others

This commit is contained in:
Kwesi Banson Jnr
2026-03-22 22:29:28 +00:00
parent c68c007945
commit 4ab0fda326
858 changed files with 242393 additions and 337 deletions

View File

@@ -0,0 +1,97 @@
// @ts-check
import { test, expect } from "@playwright/test";
import { join } from "path";
test.describe("Tabulator functionality", () => {
test.beforeEach(async ({ page }) => {
const htmlPath = join(__dirname, "index.html");
await page.goto(`file://${htmlPath}`);
await page.waitForSelector(".tabulator");
});
test("should initialize table correctly", async ({ page }) => {
// Check that table is initialized
const tableExists = await page.isVisible(".tabulator");
expect(tableExists).toBeTruthy();
// Check row count
await page.waitForSelector(".tabulator-row");
const rowCount = await page.locator(".tabulator-row").count();
expect(rowCount).toBe(5);
// Check column count
const columnCount = await page.locator(".tabulator-col").count();
expect(columnCount).toBe(4);
});
test.describe("Row operations", () => {
test("should add a new row", async ({ page }) => {
await page.evaluate(() => {
window.testTable.addRow({
id: 6,
name: "Frank",
age: 29,
gender: "Male",
});
});
await page.waitForTimeout(300);
const newRowCount = await page.locator(".tabulator-row").count();
expect(newRowCount).toBe(6);
});
test("should update an existing row", async ({ page }) => {
await page.evaluate(() => {
window.testTable.updateRow(1, { name: "Alice Updated" });
});
await page.waitForTimeout(300);
const updatedName = await page.evaluate(() => {
return window.testTable.getRow(1).getData().name;
});
expect(updatedName).toBe("Alice Updated");
});
test("should delete a row", async ({ page }) => {
await page.evaluate(() => {
window.testTable.deleteRow(1);
});
await page.waitForTimeout(300);
const finalRowCount = await page.locator(".tabulator-row").count();
expect(finalRowCount).toBe(4); // Original count minus one
});
});
test.describe("Filtering functionality", () => {
test("should filter rows by gender", async ({ page }) => {
await page.evaluate(() => {
window.testTable.setFilter("gender", "=", "Female");
});
await page.waitForTimeout(300);
const filteredRowCount = await page.locator(".tabulator-row").count();
expect(filteredRowCount).toBe(2); // 2 females in our data
});
test("should clear filters", async ({ page }) => {
// First apply a filter
await page.evaluate(() => {
window.testTable.setFilter("gender", "=", "Female");
});
await page.waitForTimeout(300);
// Then clear it
await page.evaluate(() => {
window.testTable.clearFilter();
});
await page.waitForTimeout(300);
const rowCountAfterClearingFilter = await page
.locator(".tabulator-row")
.count();
expect(rowCountAfterClearingFilter).toBe(5); // Back to original count
});
});
});

View File

@@ -0,0 +1,51 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>Tabulator Test</title>
<link rel="stylesheet" href="../../dist/css/tabulator.min.css" />
<script src="../../dist/js/tabulator.js"></script>
<style>
body {
padding: 20px;
font-family: Arial, sans-serif;
}
#test-table {
width: 100%;
height: 400px;
margin-bottom: 20px;
}
</style>
</head>
<body>
<h1>Tabulator Test</h1>
<div id="test-table"></div>
<script>
// Initialize table with test data
document.addEventListener("DOMContentLoaded", function () {
const testData = [
{ id: 1, name: "Alice", age: 25, gender: "Female" },
{ id: 2, name: "Bob", age: 32, gender: "Male" },
{ id: 3, name: "Charlie", age: 45, gender: "Male" },
{ id: 4, name: "Diana", age: 27, gender: "Female" },
{ id: 5, name: "Ethan", age: 35, gender: "Male" },
];
const columns = [
{ title: "ID", field: "id", sorter: "number" },
{ title: "Name", field: "name", sorter: "string" },
{ title: "Age", field: "age", sorter: "number" },
{ title: "Gender", field: "gender", sorter: "string" },
];
// Create global reference for tests to access
window.testTable = new Tabulator("#test-table", {
data: testData,
columns: columns,
layout: "fitColumns",
});
});
</script>
</body>
</html>