Compare commits

...
13 Commits
Author SHA1 Message Date
github-actions[bot] db9d23b5ec chore: release 1.11.2 2026-04-02 17:47:39 +00:00
47c74931d4 fix: upload file database extension (#250)
* fix: upload file database

* fix: getFileHeadersBasedOnDbms for default if no dbType compatible

---------

Co-authored-by: charles-gauthereau <charles.gauthereau@soluce-technologies.com>
2026-04-02 19:47:05 +02:00
github-actions[bot] be01031501 chore: release 1.11.1 2026-04-02 12:43:10 +00:00
2e656d9c41 fix: storage broken url (#248)
Co-authored-by: charles-gauthereau <charles.gauthereau@soluce-technologies.com>
2026-04-02 14:42:30 +02:00
github-actions[bot] 9071193c4d chore: release 1.11.0 2026-04-02 09:08:40 +00:00
27e1da6363 fix: smtp crash due to SMTP_SECURE (#246)
Co-authored-by: charles-gauthereau <charles.gauthereau@soluce-technologies.com>
2026-04-02 11:07:48 +02:00
e02c5496ae chore: readme [skip-release] (#244)
* fix: set default notification channel

* fix: readme

* fix: README.md

---------

Co-authored-by: charles-gauthereau <charles.gauthereau@soluce-technologies.com>
2026-04-01 17:22:21 +02:00
3fee236fd0 feat: adding end-to-end testing for notification [skip-release] (#228)
* fix: release.yml

* fix: S3ChannelConfigSchema type port mismatch

* fix(csp): Conditionally sets UPGRADE_INSECURE_REQUESTS based on the PROJECT_URL scheme.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: fix bug in github action.

* chore: adding e2e tesing for notification.

* fix: updating trivy-action to the latest version, using new tagging pattern (vX.XX.XX instead of (X.XX.XX).

* fix: removing browser targeting in e2e workflow as it is already specify in playwright.config.ts

* fix: mapping secrets to environment variables in the end-to-end workflow.

* fix: add a condition to allow end-to-end workflow execution only on main repo (fork are excluded).

* fix: adding some data-testid to rely on more stable locator.

* fix: adding some data-testid to rely on more stable locator.

* fix: removing unusued browsers in end-to-end workflow.

* fix: removing unused browsers in end-to-end workflow.

* fix: removing unused browsers in end-to-end workflow.

---------

Co-authored-by: charlesgauthereau <charles.gauthereau@soluce-technologies.com>
Co-authored-by: killianlarcher <killian.larcher@soluce-technologies.com>
2026-03-31 20:25:15 +02:00
github-actions[bot] 78ba42239d chore: release 1.10.0 2026-03-31 13:09:08 +00:00
Charles GTEandGitHub 8ffb672e26 feat: add firebird (#242) 2026-03-31 15:08:31 +02:00
Théo LAGACHEandGitHub 83ddc934ba fix: readme [skip-release] (#241)
* Update translations

* Add: firebird
2026-03-30 15:52:21 +02:00
github-actions[bot] 31cbd52703 chore: release 1.9.5 2026-03-29 12:11:43 +00:00
dd85f7a25d fix: trusted url missing, better auth crash due to update (#240)
* fix: release.yml

* fix: S3ChannelConfigSchema type port mismatch

* chore: package.json

* fix: refactoring logs and adding pino logger for production and dev.

* fix: trusted url error due to better auth update.

---------

Co-authored-by: charlesgauthereau <charles.gauthereau@soluce-technologies.com>
Co-authored-by: killianlarcher <killian.larcher@soluce-technologies.com>
2026-03-29 14:10:58 +02:00
68 changed files with 5206 additions and 731 deletions
+3
View File
@@ -58,3 +58,6 @@ AUTH_PASSKEY_ENABLED=true
# Retention # Retention
RETENTION_CRON="* * * * *" RETENTION_CRON="* * * * *"
TRUSTED_DOMAINS="http://localhost:8887, http://localhost:3055, http://localhost:3056"
+42 -2
View File
@@ -7,6 +7,7 @@ on:
jobs: jobs:
build-and-test: build-and-test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -57,12 +58,51 @@ jobs:
exit 1 exit 1
- name: Install Playwright browsers - name: Install Playwright browsers
run: pnpm exec playwright install --with-deps chromium firefox webkit run: pnpm exec playwright install --with-deps chromium
- name: Run Playwright tests - name: Run Playwright tests
run: pnpm exec playwright test --project chromium run: pnpm exec playwright test
env: env:
PROJECT_URL: http://localhost:8887 PROJECT_URL: http://localhost:8887
# E2E Notification
E2E_NOTIFICATION_SMTP_HOST: ${{ secrets.E2E_NOTIFICATION_SMTP_HOST }}
E2E_NOTIFICATION_SMTP_PORT: ${{ secrets.E2E_NOTIFICATION_SMTP_PORT }}
E2E_NOTIFICATION_SMTP_USER: ${{ secrets.E2E_NOTIFICATION_SMTP_USER }}
E2E_NOTIFICATION_SMTP_PASSWORD: ${{ secrets.E2E_NOTIFICATION_SMTP_PASSWORD }}
E2E_NOTIFICATION_SMTP_FROM: ${{ secrets.E2E_NOTIFICATION_SMTP_FROM }}
E2E_NOTIFICATION_SMTP_TO: ${{ secrets.E2E_NOTIFICATION_SMTP_TO }}
E2E_NOTIFICATION_SLACK_WEBHOOK: ${{ secrets.E2E_NOTIFICATION_SLACK_WEBHOOK }}
E2E_NOTIFICATION_DISCORD_WEBHOOK: ${{ secrets.E2E_NOTIFICATION_DISCORD_WEBHOOK }}
E2E_NOTIFICATION_TELEGRAM_BOT_TOKEN: ${{ secrets.E2E_NOTIFICATION_TELEGRAM_BOT_TOKEN }}
E2E_NOTIFICATION_TELEGRAM_CHAT_ID: ${{ secrets.E2E_NOTIFICATION_TELEGRAM_CHAT_ID }}
E2E_NOTIFICATION_TELEGRAM_TOPIC_ID: ${{ secrets.E2E_NOTIFICATION_TELEGRAM_TOPIC_ID }}
E2E_NOTIFICATION_GOTIFY_SERVER_URL: ${{ secrets.E2E_NOTIFICATION_GOTIFY_SERVER_URL }}
E2E_NOTIFICATION_GOTIFY_APP_TOKEN: ${{ secrets.E2E_NOTIFICATION_GOTIFY_APP_TOKEN }}
E2E_NOTIFICATION_NTFY_TOPIC: ${{ secrets.E2E_NOTIFICATION_NTFY_TOPIC }}
E2E_NOTIFICATION_NTFY_SERVER_URL: ${{ secrets.E2E_NOTIFICATION_NTFY_SERVER_URL }}
E2E_NOTIFICATION_NTFY_TOKEN: ${{ secrets.E2E_NOTIFICATION_NTFY_TOKEN }}
E2E_NOTIFICATION_NTFY_USERNAME: ${{ secrets.E2E_NOTIFICATION_NTFY_USERNAME }}
E2E_NOTIFICATION_NTFY_PASSWORD: ${{ secrets.E2E_NOTIFICATION_NTFY_PASSWORD }}
E2E_NOTIFICATION_WEBHOOK_URL: ${{ secrets.E2E_NOTIFICATION_WEBHOOK_URL }}
E2E_NOTIFICATION_WEBHOOK_SECRET_HEADER: ${{ secrets.E2E_NOTIFICATION_WEBHOOK_SECRET_HEADER }}
E2E_NOTIFICATION_WEBHOOK_SECRET: ${{ secrets.E2E_NOTIFICATION_WEBHOOK_SECRET }}
# E2E Storage
E2E_STORAGE_AWS_S3_ENDPOINT_URL: ${{ secrets.E2E_STORAGE_AWS_S3_ENDPOINT_URL }}
E2E_STORAGE_AWS_S3_REGION: ${{ secrets.E2E_STORAGE_AWS_S3_REGION }}
E2E_STORAGE_AWS_S3_ACCESS_KEY: ${{ secrets.E2E_STORAGE_AWS_S3_ACCESS_KEY }}
E2E_STORAGE_AWS_S3_SECRET_KEY: ${{ secrets.E2E_STORAGE_AWS_S3_SECRET_KEY }}
E2E_STORAGE_AWS_S3_BUCKET_NAME: ${{ secrets.E2E_STORAGE_AWS_S3_BUCKET_NAME }}
E2E_STORAGE_AWS_S3_PORT: ${{ secrets.E2E_STORAGE_AWS_S3_PORT }}
E2E_STORAGE_R2_ENDPOINT_URL: ${{ secrets.E2E_STORAGE_R2_ENDPOINT_URL }}
E2E_STORAGE_R2_REGION: ${{ secrets.E2E_STORAGE_R2_REGION }}
E2E_STORAGE_R2_ACCESS_KEY: ${{ secrets.E2E_STORAGE_R2_ACCESS_KEY }}
E2E_STORAGE_R2_SECRET_KEY: ${{ secrets.E2E_STORAGE_R2_SECRET_KEY }}
E2E_STORAGE_R2_BUCKET_NAME: ${{ secrets.E2E_STORAGE_R2_BUCKET_NAME }}
E2E_STORAGE_R2_PORT: ${{ secrets.E2E_STORAGE_R2_PORT }}
E2E_STORAGE_GOOGLE_DRIVE_CLIENT_ID: ${{ secrets.E2E_STORAGE_GOOGLE_DRIVE_CLIENT_ID }}
E2E_STORAGE_GOOGLE_DRIVE_CLIENT_SECRET: ${{ secrets.E2E_STORAGE_GOOGLE_DRIVE_CLIENT_SECRET }}
E2E_STORAGE_GOOGLE_DRIVE_FOLDER_ID: ${{ secrets.E2E_STORAGE_GOOGLE_DRIVE_FOLDER_ID }}
- name: Upload report if failed - name: Upload report if failed
if: failure() if: failure()
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: aquasecurity/trivy-action@0.35.0 - uses: aquasecurity/trivy-action@v0.35.0
with: with:
scan-type: 'fs' scan-type: 'fs'
format: 'table' format: 'table'
+1
View File
@@ -54,3 +54,4 @@ certificates
/blob-report/ /blob-report/
/playwright/.cache/ /playwright/.cache/
/playwright/.auth/ /playwright/.auth/
/e2e/local-storage.json
+1 -1
View File
@@ -31,5 +31,5 @@ keywords:
- web-ui - web-ui
- agent - agent
license: Apache-2.0 license: Apache-2.0
version: 1.9.4 version: 1.11.2
date-released: '2026-03-02' date-released: '2026-03-02'
+14
View File
@@ -46,3 +46,17 @@ export-keycloak:
@docker rm -f kc-exporter >/dev/null 2>&1 @docker rm -f kc-exporter >/dev/null 2>&1
@docker compose -f docker-compose.func.yml start keycloak >/dev/null 2>&1 @docker compose -f docker-compose.func.yml start keycloak >/dev/null 2>&1
@echo "Keycloak configuration and users exported to seeds/keycloak/*.json" @echo "Keycloak configuration and users exported to seeds/keycloak/*.json"
end-to-end:
@echo "Starting E2E testing..."
@docker compose -f docker-compose.e2e.yml up -d
@CI=true PROJECT_URL=http://localhost:8887 pnpm playwright test --project=chromium || (docker compose -f docker-compose.e2e.yml down --volumes && exit 1)
@docker compose -f docker-compose.e2e.yml down --volumes
@echo "Finished E2E testing successfully."
e2e-manual:
@echo "Starting E2E testing..."
@docker compose -f docker-compose.e2e.yml up -d
@pnpm playwright test --ui || (docker compose -f docker-compose.e2e.yml down --volumes && exit 1)
@docker compose -f docker-compose.e2e.yml down --volumes
@echo "Finished E2E testing successfully."
+15 -11
View File
@@ -13,6 +13,7 @@
[![License: Apache](https://img.shields.io/badge/License-apache-yellow.svg)](LICENSE) [![License: Apache](https://img.shields.io/badge/License-apache-yellow.svg)](LICENSE)
[![Docker Pulls](https://img.shields.io/docker/pulls/portabase/portabase?color=brightgreen)](https://hub.docker.com/r/portabase/portabase) [![Docker Pulls](https://img.shields.io/docker/pulls/portabase/portabase?color=brightgreen)](https://hub.docker.com/r/portabase/portabase)
[![Helm Chart](https://img.shields.io/badge/Helm-Kubernetes-326ce5?logo=helm&logoColor=white)](https://github.com/Portabase/portabase/pkgs/container/charts%2Fportabase)
[![Platform](https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20windows-lightgrey)](https://github.com/Portabase/portabase) [![Platform](https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20windows-lightgrey)](https://github.com/Portabase/portabase)
[![Support Portabase](https://img.shields.io/badge/Support-Portabase-orange)](https://www.buymeacoffee.com/portabase) [![Support Portabase](https://img.shields.io/badge/Support-Portabase-orange)](https://www.buymeacoffee.com/portabase)
@@ -21,8 +22,10 @@
[![MariaDB](https://img.shields.io/badge/MariaDB-003545?logo=mariadb&logoColor=white)](https://mariadb.org/) [![MariaDB](https://img.shields.io/badge/MariaDB-003545?logo=mariadb&logoColor=white)](https://mariadb.org/)
[![SQLite](https://img.shields.io/badge/-SQLite-blue?logo=sqlite&logoColor=white)](https://sqlite.org/) [![SQLite](https://img.shields.io/badge/-SQLite-blue?logo=sqlite&logoColor=white)](https://sqlite.org/)
[![Redis](https://img.shields.io/badge/Redis-DC382D?style=flat&logo=Redis&logoColor=white)](https://redis.io/) [![Redis](https://img.shields.io/badge/Redis-DC382D?style=flat&logo=Redis&logoColor=white)](https://redis.io/)
[![Valkey](https://img.shields.io/badge/Valkey-6284fc?style=flat&logo=Valkey&logoColor=white)](https://valkey.io/)
[![MongoDB](https://img.shields.io/badge/-MongoDB-13aa52?logo=mongodb&logoColor=white)](https://www.mongodb.com/) [![MongoDB](https://img.shields.io/badge/-MongoDB-13aa52?logo=mongodb&logoColor=white)](https://www.mongodb.com/)
[![Valkey](https://img.shields.io/badge/Valkey-6284fc?style=flat&logo=Valkey&logoColor=white)](https://valkey.io/)
[![Firebird](https://img.shields.io/badge/Firebird-f55b14?style=flat&logo=Firebird&logoColor=white)](https://firebirdsql.org/)
[![Self Hosted](https://img.shields.io/badge/self--hosted-yes-brightgreen)](https://github.com/Portabase/portabase) [![Self Hosted](https://img.shields.io/badge/self--hosted-yes-brightgreen)](https://github.com/Portabase/portabase)
[![Open Source](https://img.shields.io/badge/open%20source-❤️-red)](https://github.com/Portabase/portabase) [![Open Source](https://img.shields.io/badge/open%20source-❤️-red)](https://github.com/Portabase/portabase)
@@ -62,16 +65,17 @@ You have 4 ways to install Portabase:
## Supported databases ## Supported databases
| Engine | Support | Supported Versions | Restore | | Engine | Support | Supported Versions | Restore |
|:-------------------|:----------|:----------------------------------|:--------| |:-------------------|:-----------|:------------------------------|:--------|
| **PostgreSQL** | ✅ Stable | 12, 13, 14, 15, 16, 17 et 18 | Yes | | **PostgreSQL** | ✅ Stable | 12, 13, 14, 15, 16, 17 and 18 | Yes |
| **MySQL** | ✅ Stable | 5.7, 8 et 9 | Yes | | **MySQL** | ✅ Stable | 5.7, 8 and 9 | Yes |
| **MariaDB** | ✅ Stable | 10 et 11 | Yes | | **MariaDB** | ✅ Stable | 10 and 11 | Yes |
| **MongoDB** | ✅ Stable | 4, 5, 6, 7 et 8 | Yes | | **MongoDB** | ✅ Stable | 4, 5, 6, 7 and 8 | Yes |
| **SQLite** | ✅ Stable | 3.x | Yes | | **SQLite** | ✅ Stable | 3.x | Yes |
| **Redis** | ✅ Stable | 2.8+ | No | | **Redis** | ✅ Stable | 2.8+ | No |
| **Valkey** | ✅ Stable | 7.2+ | No | | **Valkey** | ✅ Stable | 7.2+ | No |
| **MSSQL Server** | ❌ Ongoing | - | Yes | | **Firebird** | ✅ Stable | 3.0, 4.0, 5.0 | Yes |
| **MSSQL Server** | ❌ Ongoing | - | Yes |
See the [Database Servers documentation](https://portabase.io/docs/agent/db) for version-specific backup and restore details. See the [Database Servers documentation](https://portabase.io/docs/agent/db) for version-specific backup and restore details.
+37
View File
@@ -0,0 +1,37 @@
services:
app:
build:
context: .
dockerfile: docker/dockerfile/Dockerfile
target: prod
ports:
- '8887:80'
environment:
TZ: "Europe/Paris"
env_file:
- .env
volumes:
- portabase-e2e-data:/data
depends_on:
db:
condition: service_healthy
db:
image: postgres:18-alpine
ports:
- "5433:5432"
volumes:
- postgres-e2e-data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=devdb
- POSTGRES_USER=devuser
- POSTGRES_PASSWORD=changeme
healthcheck:
test: ["CMD-SHELL", "pg_isready -U devuser -d devdb"]
interval: 10s
timeout: 5s
retries: 5
volumes:
portabase-e2e-data:
postgres-e2e-data:
+74
View File
@@ -0,0 +1,74 @@
import {expect, test} from "@playwright/test";
import {users} from "./helpers/auth";
import {changeUserRole, create, switchToDefault} from "./helpers/access-management";
import {LOCAL_STORAGE_PATH} from "./helpers/session";
test.use({storageState: LOCAL_STORAGE_PATH});
const firstOrganization = "Organization A";
const secondOrganization = "Organization B";
test.describe.serial(() => {
test("Create an organization from organizations page", async ({page}) => {
await page.goto("/dashboard/admin/organizations");
await expect(page.getByRole("heading", {name: "Active organizations"})).toBeVisible();
await create(page, "button", firstOrganization);
await expect(page.getByText(/Organization has been successfully created\./i)).toBeVisible();
await expect(page).toHaveURL("/dashboard/admin/organizations");
await expect(page.getByRole("button", {name: firstOrganization, exact: true})).toBeVisible();
await switchToDefault(page);
});
test("Create an organization from sidebar button", async ({page}) => {
await page.goto("/dashboard/home");
await expect(page.getByRole("heading", {name: "Dashboard"})).toBeVisible();
await create(page, "sidebar", secondOrganization);
await expect(page.getByText(/Organization has been successfully created\./i)).toBeVisible();
await expect(page).toHaveURL("/dashboard/home");
await expect(page.getByRole("button", {name: secondOrganization, exact: true})).toBeVisible();
await switchToDefault(page);
});
test("Change John Doe's role from pending to user", async ({page}) => {
await page.goto("/dashboard/admin/users");
await expect(page.getByText(users.normal.email, {exact: true})).toBeVisible();
const userRow = page.locator("tr").filter({hasText: users.normal.email}).first();
await expect(userRow).toBeVisible();
await userRow.locator("button").last().click();
await page.getByRole('menuitem', {name: 'Role'}).click();
await expect(page.getByRole("heading", {name: "Change the user's role"})).toBeVisible();
await changeUserRole(page, "user")
await expect(page.getByText("User role changed successfully.")).toBeVisible();
await expect(page.locator("tr").filter({hasText: users.normal.email}).getByText("user", {exact: true})).toBeVisible();
});
test("Add John Doe to Organization A", async ({page}) => {
await page.goto("/dashboard/admin/organizations");
await expect(page.getByRole("heading", {name: "Active organizations"})).toBeVisible();
const organizationRow = page.locator("tr").filter({hasText: firstOrganization}).first();
await expect(organizationRow).toBeVisible();
await organizationRow.locator('a[href*="/dashboard/admin/organizations/"], a[href*="organizations/"]').click();
await expect(page.getByText(firstOrganization, {exact: true})).toBeVisible();
await page.getByRole("button", {name: /Add member/i}).click();
await expect(page.getByRole("heading", {name: "Add member to your organization"})).toBeVisible();
await page.getByPlaceholder("Enter a user email").fill(users.normal.email);
await page.getByRole("option", {name: new RegExp(users.normal.email, "i")}).click();
await page.getByRole("button", {name: "Confirm"}).click();
await expect(page.getByText("Member successfully added!")).toBeVisible();
await expect(page.getByText(users.normal.email, {exact: true})).toBeVisible();
});
});
+116
View File
@@ -0,0 +1,116 @@
import {expect, test} from "@playwright/test";
import {execSync} from "child_process";
import fs from "fs";
import os from "os";
import path from "path";
import {createAgentWithDockerDatabases} from "./helpers/agent-cli";
import {create, edit, get, remove} from "./helpers/agent";
import {LOCAL_STORAGE_PATH} from "./helpers/session";
const agent = {
aName: "Agent A",
aUpdatedName: "Agent A Updated",
bName: "Agent B",
description: "Agent created by Playwright E2E",
updatedDescription: "Agent updated by Playwright E2E",
};
test.use({storageState: LOCAL_STORAGE_PATH});
test.describe.serial(() => {
let agentWorkspace: string | null = null;
test("Create agent A from empty state", async ({page}) => {
await page.goto("/dashboard/agents");
await expect(page.getByRole("heading", {name: "Agents"})).toBeVisible();
await expect(page.getByText("Create new Agent", {exact: true})).toBeVisible();
await create(page, "emptyState", agent.aName, agent.description);
await expect(page.getByText("Success creating agent")).toBeVisible();
await expect(get(page, agent.aName)).toBeVisible();
await expect(page.getByText("Create new Agent", {exact: true})).toHaveCount(0);
});
test("Edit agent A", async ({page}) => {
await page.goto("/dashboard/agents");
await expect(page.getByRole("heading", {name: "Agents"})).toBeVisible();
await expect(get(page, agent.aName)).toBeVisible();
await edit(page, agent.aName, agent.aUpdatedName, agent.updatedDescription);
await expect(page.getByText("Success updating agent")).toBeVisible();
await expect(page.getByText(agent.aUpdatedName, {exact: true})).toBeVisible();
await expect(page.getByText(agent.updatedDescription, {exact: true})).toBeVisible();
});
test("Create agent B from classic button", async ({page}) => {
await page.goto("/dashboard/agents");
await expect(page.getByRole("heading", {name: "Agents"})).toBeVisible();
await expect(page.getByRole("button", {name: /Create Agent/i})).toBeVisible();
await create(page, "button", agent.bName, agent.description);
await expect(page.getByText("Success creating agent")).toBeVisible();
await expect(get(page, agent.bName)).toBeVisible();
});
test("Delete Agent B", async ({page}) => {
await page.goto("/dashboard/agents");
await expect(page.getByRole("heading", {name: "Agents"})).toBeVisible();
await expect(get(page, agent.bName)).toBeVisible();
await remove(page, agent.bName);
await expect(page.getByText("Agent has been successfully deleted.")).toBeVisible();
await expect(page).toHaveURL("/dashboard/agents");
await expect(page.getByText(agent.bName)).toHaveCount(0);
});
// test("Launch the updated agent", async ({page}) => {
// await page.goto("/dashboard/agents");
// await expect(page.getByRole("heading", {name: "Agents"})).toBeVisible();
// await get(page, agent.aName).click();
//
// await expect(page).toHaveURL(/\/dashboard\/agents\/.+/);
// await expect(page.getByText(agent.aName, {exact: true})).toBeVisible();
// await expect(page.getByText("Registration & Setup")).toBeVisible();
//
// const commandInput = page.locator("input[readonly]").first();
// await page.locator("input[readonly]").first().locator("xpath=following-sibling::button[1]").click();
// const command = await commandInput.inputValue();
//
// agentWorkspace = fs.mkdtempSync(path.join(os.tmpdir(), "portabase-agent-"));
// await createAgentWithDockerDatabases(command, agentWorkspace);
// execSync(`portabase start "${agent.aName}"`, {
// cwd: agentWorkspace,
// stdio: "pipe",
// timeout: 120_000,
// });
//
// await expect(page.getByText("Never connected.")).toHaveCount(0, {timeout: 120_000});
// await expect(page.getByText("Action Required")).toHaveCount(0);
// });
test.afterAll(async () => {
if (agentWorkspace) {
try {
execSync(`portabase stop "${agent.aName}"`, {
cwd: agentWorkspace,
stdio: "pipe",
timeout: 30_000,
});
} catch {
}
try {
execSync(`portabase uninstall --force "${agent.aName}"`, {
cwd: agentWorkspace,
stdio: "pipe",
timeout: 30_000,
});
} catch {
}
fs.rmSync(agentWorkspace, {recursive: true, force: true});
agentWorkspace = null;
}
});
});
+14 -45
View File
@@ -1,43 +1,17 @@
import {test, expect, Page} from '@playwright/test'; import {test, expect} from '@playwright/test';
import {login, register, users} from "./helpers/auth";
import {LOCAL_STORAGE_PATH} from "./helpers/session";
const TIMEOUT = undefined
// const TIMEOUT = 5000
type UserCredentials = { test.use({storageState: LOCAL_STORAGE_PATH})
username: string
email: string
password: string
}
test.describe.serial( () => {
const users: Record<string, UserCredentials> = {
admin: {username: 'Admin', email: 'admin@example.com', password: 'testPASS123456!'},
normal: {username: 'John Doe', email: 'john.doe@example.com', password: 'testPASS123456!'},
}
async function register(page: Page, name: string, email: string, password: string, confirmPassword: string) {
await page.locator('input[name="name"]').fill(name)
await page.locator('input[name="email"]').fill(email)
await page.locator('input[name="password"]').fill(password)
await page.locator('input[name="confirmPassword"]').fill(confirmPassword)
await page.click('button[type="submit"]')
}
async function login(page: Page, email: string, password: string) {
await page.locator('input[name="email"]').fill(email)
await page.locator('input[name="password"]').fill(password)
await page.locator('button:has-text("Login")').click()
}
async function logout() {
//TODO
}
test.describe.serial('User signup and login flows', () => {
test('Redirect to login if not connected', async ({page}) => { test('Redirect to login if not connected', async ({page}) => {
await page.goto('/dashboard/projects'); await page.goto('/dashboard/projects');
await expect(page).toHaveURL("login?redirect=%2Fdashboard%2Fprojects"); await expect(page).toHaveURL("login?redirect=%2Fdashboard%2Fprojects", {timeout: TIMEOUT});
}); });
test('Password too short', async ({page}) => { test('Password too short', async ({page}) => {
@@ -85,7 +59,7 @@ test.describe.serial('User signup and login flows', () => {
await register(page, users["admin"].username, users["admin"].email, users["admin"].password, users["admin"].password) await register(page, users["admin"].username, users["admin"].email, users["admin"].password, users["admin"].password)
await expect(page).toHaveURL('/login') await expect(page).toHaveURL('/login', {timeout: TIMEOUT})
}) })
test('User already exists.', async ({page}) => { test('User already exists.', async ({page}) => {
@@ -108,7 +82,7 @@ test.describe.serial('User signup and login flows', () => {
await register(page, users["normal"].username, users["normal"].email, users["normal"].password, users["normal"].password) await register(page, users["normal"].username, users["normal"].email, users["normal"].password, users["normal"].password)
await expect(page).toHaveURL('login') await expect(page).toHaveURL('/login', {timeout: TIMEOUT})
}) })
test('Failed login because account not active', async ({page}) => { test('Failed login because account not active', async ({page}) => {
@@ -120,16 +94,11 @@ test.describe.serial('User signup and login flows', () => {
}) })
test('Successful login', async ({page}) => { test('Successful login', async ({page}) => {
await page.goto('login') await page.goto('/login')
await login(page, users["admin"].email, users["admin"].password) await login(page, users["admin"].email, users["admin"].password)
await expect(page).toHaveURL('/dashboard/home') await expect(page).toHaveURL('/dashboard/home', {timeout: TIMEOUT})
await expect(page.getByRole('link', {name: 'Logo Portabase'})).toBeVisible()
await page.context().storageState({path: LOCAL_STORAGE_PATH})
}) })
}) })
// test('Successful logout', async ({page}) => {
// await logout()
// await expect(page).toHaveURL('/login')
// })
+32
View File
@@ -0,0 +1,32 @@
import {expect, test} from "@playwright/test";
import fs from "fs";
import {logout} from "./helpers/auth";
import {LOCAL_STORAGE_PATH} from "./helpers/session";
test.use({storageState: LOCAL_STORAGE_PATH});
test.describe( () => {
test.afterAll(async () => {
if (fs.existsSync(LOCAL_STORAGE_PATH)) {
fs.unlinkSync(LOCAL_STORAGE_PATH);
}
});
test("Remove shared storage state", async ({page}) => {
await test.step("Logout shared authenticated session", async () => {
if (!fs.existsSync(LOCAL_STORAGE_PATH)) {
return;
}
const content = fs.readFileSync(LOCAL_STORAGE_PATH, "utf-8").trim();
if (!content || content === "{}") {
return;
}
await page.goto('/dashboard/home');
await logout(page);
await expect(page).toHaveURL(/\/login(?:\?.*)?$/);
});
});
});
+70
View File
@@ -0,0 +1,70 @@
import {Page} from "@playwright/test";
export function getUserRow(page: Page, email: string) {
return page.locator("tr").filter({hasText: email}).first();
}
export function getOrganizationRow(page: Page, organizationName: string) {
return page.locator("tr").filter({hasText: organizationName}).first();
}
/**
* Create an organization from the selected entrypoint.
*
* Available entrypoints:
* - `button`: the organizations page create button.
* - `sidebar`: the sidebar organization switcher.
*
* Executes from:
* - `/dashboard/admin/organizations` for "button" entrypoint
* - any `/dashboard/**` page for "sidebar" entrypoint
*/
export async function create(page: Page, entrypoint: "button" | "sidebar", name: string) {
if (entrypoint === "sidebar") {
await page.getByRole("button", {name: "Default Organization"}).click();
await page.getByText("Create organization", {exact: true}).click();
} else {
await page.getByRole("button", {name: /Create a new organization/i}).click();
}
await page.getByLabel("Name").fill(name);
await page.getByRole("button", {name: "Create"}).click();
}
/**
* Switch the active organization from the sidebar switcher.
*
* Executes from: any `/dashboard/**` if the sidebar is visible.
*/
export async function switchTo(page: Page, name: string) {
await page.getByTestId('organization-dropdown').click();
await page.getByRole('menuitem', {name: name}).click();
}
/**
* Switch back to the default organization.
*
* Executes from: any `/dashboard/**` if the sidebar is visible.
*/
export async function switchToDefault(page: Page) {
await switchTo(page, "Default Organization");
}
const ROLE_LABELS = {
pending: "Pending",
user: "User",
admin: "Admin",
} as const;
/**
* Change the global role of a user from the admin users role modal.
*
* Executes from: the "Change the user's role" dialog opened from `/dashboard/admin/users`.
*/
export async function changeUserRole(page: Page, role: keyof typeof ROLE_LABELS) {
const roleOption = ROLE_LABELS[role];
await page.getByRole("combobox").click();
await page.getByRole("option", {name: roleOption}).click();
await page.getByRole("button", {name: "Validate"}).click();
}
+107
View File
@@ -0,0 +1,107 @@
import * as pty from "node-pty";
type InteractiveStep = {
match: RegExp;
reply: string;
};
function normalizeOutput(output: string) {
return output.replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g, "");
}
/**
* Run an interactive CLI command and answer prompts in sequence.
* Entry point:
* - `command` is the full CLI command executed in the PTY.
* - `cwd` is the local workspace where the command is launched.
* - `steps` defines which prompt text is matched and which reply is sent.
* - `timeoutMs` controls when the command is aborted if it stalls.
* Executes from: not page-bound; runs from a local test workspace on the Node.js side.
*/
export async function runInteractiveCommand(
command: string,
cwd: string,
steps: InteractiveStep[],
timeoutMs: number = 120_000,
) {
await new Promise<void>((resolve, reject) => {
const child = pty.spawn("sh", ["-lc", command], {
cwd,
env: {
...process.env,
TERM: "xterm-256color",
},
cols: 120,
rows: 30,
});
let currentStep = 0;
let output = "";
const timer = setTimeout(() => {
child.kill();
reject(new Error(`Interactive command timed out.\n\nCommand: ${command}\n\nOutput:\n${normalizeOutput(output)}`));
}, timeoutMs);
const handleChunk = (chunk: string) => {
output += chunk;
const normalizedOutput = normalizeOutput(output);
while (currentStep < steps.length && steps[currentStep].match.test(normalizedOutput)) {
child.write(steps[currentStep].reply);
currentStep += 1;
}
};
child.onData(handleChunk);
child.onExit(({exitCode}) => {
clearTimeout(timer);
if (exitCode === 0) {
resolve();
return;
}
reject(new Error(`Interactive command failed with exit code ${exitCode}.\n\nCommand: ${command}\n\nOutput:\n${normalizeOutput(output)}`));
});
});
}
/**
* Create and configure a Portabase agent with two Docker-backed databases.
* Entry point:
* - `command` is the CLI setup command copied from the agent details page.
* - `cwd` is the local workspace where the agent is installed.
* - this helper answers the wizard for PostgreSQL first, then MariaDB.
* Executes from: not page-bound; runs from a local test workspace on the Node.js side.
*/
export async function createAgentWithDockerDatabases(command: string, cwd: string) {
await runInteractiveCommand(command, cwd, [
{
match: /configure.*database|add.*database/i,
reply: "y\n",
},
{
match: /docker.*new local container|manual.*external|external.*existing/i,
reply: "\r",
},
{
match: /postgresql|mariadb/i,
reply: "\r",
},
{
match: /another.*database|add.*another|configure.*another/i,
reply: "y\n",
},
{
match: /docker.*new local container|manual.*external|external.*existing/i,
reply: "\r",
},
{
match: /postgresql|mariadb/i,
reply: "\u001B[B\r",
},
{
match: /another.*database|add.*another|configure.*another/i,
reply: "n\n",
},
]);
}
+66
View File
@@ -0,0 +1,66 @@
import {Page} from "@playwright/test";
/**
* Locate an agent card in the list.
* Executes from: `/dashboard/agents`.
*/
export function get(page: Page, name: string) {
return page.locator('a[href^="/dashboard/agents"]').filter({hasText: name}).first();
}
/**
* Create an agent from the selected entrypoint.
*
* Available entrypoints:
* - `button`: the classic create button.
* - `emptyState`: the empty-state CTA.
* - `auto`: uses the classic create button and falls back to the empty-state CTA.
*
* Executes from: `/dashboard/agents`.
*/
export async function create(page: Page, entrypoint: "auto" | "emptyState" | "button" = "auto", agentName: string, description: string) {
if (entrypoint === "auto") {
const createButton = page.getByRole("button", {name: /Create Agent/i});
if (await createButton.isVisible()) await page.getByRole("button", {name: /Create Agent/i}).click();
await page.getByText("Create new Agent", {exact: true}).click();
} else if (entrypoint === "button") {
await page.getByRole("button", {name: /Create Agent/i}).click();
} else if (entrypoint === "emptyState") {
await page.getByText("Create new Agent", {exact: true}).click();
}
await page.getByLabel("Name").fill(agentName);
await page.getByLabel("Description").fill(description);
await page.getByRole("button", {name: "Create"}).click();
}
/**
* Edit an existing agent (name and description) from its details page.
*
* Executes from: `/dashboard/agents/[agentId]`.
*/
export async function edit(page: Page, currentName: string, updatedName: string, updatedDescription: string) {
await get(page, currentName).click();
await page
.getByRole("button", {name: /Delete Agent/i})
.locator("xpath=ancestor::div[1]/preceding-sibling::div[1]/*[1]")
.click();
await page.getByLabel("Name").fill(updatedName);
await page.getByLabel("Description").fill(updatedDescription);
await page.getByRole("button", {name: "Update"}).click();
}
/**
* Delete an agent from its details page.
* Executes from: `/dashboard/agents/[agentId]`.
*/
export async function remove(page: Page, name: string) {
await get(page, name).click();
await page.getByRole("button", {name: /Delete Agent/i}).click();
await page.getByRole("button", {name: "Delete", exact: true}).click();
}
+50
View File
@@ -0,0 +1,50 @@
import {Page} from "@playwright/test";
export type UserCredentials = {
username: string
email: string
password: string
}
export const users: Record<string, UserCredentials> = {
admin: {username: "Admin", email: "admin@example.com", password: "testPASS123456!"},
normal: {username: "John Doe", email: "john.doe@example.com", password: "testPASS123456!"},
}
/**
* Fill and submit the registration form.
*
* Executes from: `/register`.
*/
export async function register(page: Page, name: string, email: string, password: string, confirmPassword: string) {
await page.locator('input[name="name"]').fill(name)
await page.locator('input[name="email"]').fill(email)
await page.locator('input[name="password"]').fill(password)
await page.locator('input[name="confirmPassword"]').fill(confirmPassword)
await page.click('button[type="submit"]')
}
/**
* Fill and submit the login form.
*
* Executes from: `/login`.
*/
export async function login(page: Page, email: string, password: string) {
await page.locator('input[name="email"]').fill(email)
await page.locator('input[name="password"]').fill(password)
await page.locator('button:has-text("Login")').click()
}
/**
* Log out the current authenticated user.
*
* Executes from: any authenticated `/dashboard/**` page.
*/
export async function logout(page: Page) {
const profileButton = page.getByTestId('profile-dropdown')
await profileButton.first().click();
await page.getByRole("menuitem").filter({hasText: /Logout/i}).click();
}
+62
View File
@@ -0,0 +1,62 @@
const REQUIRED_E2E_ENV_VARS = [
"E2E_NOTIFICATION_SMTP_HOST",
"E2E_NOTIFICATION_SMTP_PORT",
"E2E_NOTIFICATION_SMTP_USER",
"E2E_NOTIFICATION_SMTP_PASSWORD",
"E2E_NOTIFICATION_SMTP_FROM",
"E2E_NOTIFICATION_SMTP_TO",
"E2E_NOTIFICATION_SLACK_WEBHOOK",
"E2E_NOTIFICATION_DISCORD_WEBHOOK",
"E2E_NOTIFICATION_TELEGRAM_BOT_TOKEN",
"E2E_NOTIFICATION_TELEGRAM_CHAT_ID",
"E2E_NOTIFICATION_TELEGRAM_TOPIC_ID",
"E2E_NOTIFICATION_GOTIFY_SERVER_URL",
"E2E_NOTIFICATION_GOTIFY_APP_TOKEN",
"E2E_NOTIFICATION_NTFY_TOPIC",
"E2E_NOTIFICATION_NTFY_SERVER_URL",
"E2E_NOTIFICATION_NTFY_TOKEN",
"E2E_NOTIFICATION_NTFY_USERNAME",
"E2E_NOTIFICATION_NTFY_PASSWORD",
"E2E_NOTIFICATION_WEBHOOK_URL",
"E2E_NOTIFICATION_WEBHOOK_SECRET_HEADER",
"E2E_NOTIFICATION_WEBHOOK_SECRET",
"E2E_STORAGE_AWS_S3_ENDPOINT_URL",
"E2E_STORAGE_AWS_S3_REGION",
"E2E_STORAGE_AWS_S3_ACCESS_KEY",
"E2E_STORAGE_AWS_S3_SECRET_KEY",
"E2E_STORAGE_AWS_S3_BUCKET_NAME",
"E2E_STORAGE_AWS_S3_PORT",
"E2E_STORAGE_R2_ENDPOINT_URL",
"E2E_STORAGE_R2_REGION",
"E2E_STORAGE_R2_ACCESS_KEY",
"E2E_STORAGE_R2_SECRET_KEY",
"E2E_STORAGE_R2_BUCKET_NAME",
"E2E_STORAGE_R2_PORT",
"E2E_STORAGE_GOOGLE_DRIVE_CLIENT_ID",
"E2E_STORAGE_GOOGLE_DRIVE_CLIENT_SECRET",
"E2E_STORAGE_GOOGLE_DRIVE_FOLDER_ID",
] as const;
function assertRequiredEnvVars() {
const missingVars = REQUIRED_E2E_ENV_VARS.filter((name) => {
const value = process.env[name]?.trim();
return !value;
});
if (missingVars.length > 0) {
throw new Error(
`Missing required environment variables:\n${missingVars.map((name) => `- ${name}`).join("\n")}`,
);
}
}
assertRequiredEnvVars();
export function getEnv(name: string): string {
const value = process.env[name]?.trim();
if (!value) {
throw new Error(`Missing required environment variable: ${name}`);
}
return value;
}
+94
View File
@@ -0,0 +1,94 @@
import {Page} from "@playwright/test";
/**
* Locate a notification channel card in the list.
*
* Executes from: `/dashboard/notifications/channels`.
*/
export function get(page: Page, channelName: string) {
return page.locator('div.block.transition-all.duration-200.rounded-xl', {
has: page.locator('h3', {hasText: channelName}),
}).first();
}
/**
* Open the edit dialog for an existing notification channel.
*
* Executes from: `/dashboard/notifications/channels`.
*/
export async function edit(page: Page, channelName: string) {
const card = get(page, channelName);
await card.locator("button").nth(1).click();
}
/**
* Delete an existing notification channel.
*
* Executes from: `/dashboard/notifications/channels`.
*/
export async function remove(page: Page, channelName: string) {
const card = get(page, channelName);
await card.locator("button").nth(2).click();
await page.getByRole("button", {name: "Delete"}).click();
}
/**
* Fill the notification channel creation form.
*
* Available entrypoints:
* - `button`: the classic add button.
* - `emptyState`: the empty-state CTA.
* - `auto` use the classic add button and falls back to the empty-state CTA.
*
* Executes from: `/dashboard/notifications/channels`.
*/
export async function create(
page: Page,
provider: "Discord" | "Gotify" | "ntfy.sh" | "Slack" | "Email" | "Telegram" | "Webhook",
channelName: string,
fillConfig: (page: Page) => Promise<void>,
entrypoint: "auto" | "emptyState" | "button" = "auto",
) {
if (entrypoint === "auto") {
const addButton = page.getByRole("button", {name: /Add notification channel/i});
if (await addButton.isVisible()) await page.getByRole("button", {name: /Add notification channel/i}).click();
else await page.getByRole("button", {name: /No notification channels configured yet/i}).click();
} else if (entrypoint === "button") {
await page.getByRole("button", {name: /Add notification channel/i}).click();
} else if (entrypoint === "emptyState") {
await page.getByRole("button", {name: /No notification channels configured yet/i}).click();
}
await page.getByText(provider, {exact: true}).click();
await page.getByLabel(/Channel Name/).fill(channelName);
await fillConfig(page);
}
/**
* Submit the notification channel creation form.
*
* Executes from: the add notification channel dialog opened from `/dashboard/notifications/channels`.
*/
export async function submit(page: Page) {
await page.getByRole("button", {name: "Add Channel"}).click();
}
/**
* Open the edit dialog for a notification channel and trigger the test action.
*
* Executes from: `/dashboard/notifications/channels`.
*/
export async function testFromEdit(page: Page, channelName: string) {
await edit(page, channelName);
await page.getByRole("button", {name: /Test Channel/i}).click();
}
/**
* Close the current notification channel dialog without saving.
*
* Executes from: the add or edit notification channel dialog.
*/
export async function cancel(page: Page) {
await page.getByRole("button", {name: "Cancel"}).click();
}
+59
View File
@@ -0,0 +1,59 @@
import {Page} from "@playwright/test";
/**
* Locate a project card in the list.
*
* Executes from: `/dashboard/projects`.
*/
export function get(page: Page, projectName: string) {
return page.locator('a[href^="/dashboard/projects/"]').filter({hasText: projectName}).first();
}
/**
* Create a project from the selected entrypoint.
*
* Available entrypoints:
* - `emptyState`: the empty-state CTA.
* - `button`: the classic create button.
*
* * Executes from: `/dashboard/projects`.
*/
export async function create(page: Page, entrypoint: "emptyState" | "button", projectName: string) {
if (entrypoint === "emptyState") {
await page.getByText("Create new Project", {exact: true}).click();
} else {
await page.getByRole("button", {name: /Create Project/i}).click();
}
await page.getByLabel("Name").fill(projectName);
await page.getByRole("button", {name: "Create"}).click();
}
/**
* Edit an existing project from its details page.
*
* Executes from: `/dashboard/projects/[projectId]`.
*/
export async function edit(page: Page, currentName: string, updatedName: string) {
await get(page, currentName).click();
await page
.getByRole("button", {name: /Delete Project/i})
.locator("xpath=ancestor::div[1]/preceding-sibling::div[1]/*[1]")
.click();
await page.getByLabel("Name").fill(updatedName);
await page.getByRole("button", {name: "Update"}).click();
}
/**
* Delete an existing project from its details page.
*
* Executes from: `/dashboard/projects/[projectId]`.
* */
export async function remove(page: Page, projectName: string) {
await get(page, projectName).click();
await page.getByRole("button", {name: /Delete Project/i}).click();
await page.getByRole("button", {name: "Delete", exact: true}).click();
}
+1
View File
@@ -0,0 +1 @@
export const LOCAL_STORAGE_PATH = "./e2e/local-storage.json";
+103
View File
@@ -0,0 +1,103 @@
import {Page} from "@playwright/test";
/**
* Locate a storage channel card in the channels list.
*
* Executes from: `/dashboard/storages/channels`.
*/
export function get(page: Page, channelName: string) {
return page.locator('div.block.transition-all.duration-200.rounded-xl', {
has: page.locator('h3', {hasText: channelName}),
}).first();
}
/**
* Fill the storage channel creation form.
*
* Available entrypoints:
* - `button`: the classic add button.
* - `emptyState`: the empty-state CTA.
* - `auto`: uses the classic add button and falls back to the empty-state CTA.
*
* Executes from: `/dashboard/storages/channels`.
*/
export async function create(
page: Page,
provider: "S3" | "Google Drive",
channelName: string,
fillConfig: (page: Page) => Promise<void>,
entrypoint: "auto" | "emptyState" | "button" = "auto",
) {
if (entrypoint === "auto") {
const addButton = page.getByRole("button", {name: /Add storage channel/i});
if (await addButton.isVisible()) await page.getByRole("button", {name: /Add storage channel/i}).click();
else await page.getByText("No storage channels configured yet", {exact: true}).click();
} else if (entrypoint === "button") {
await page.getByRole("button", {name: /Add storage channel/i}).click();
} else if (entrypoint === "emptyState") {
await page.getByText("No storage channels configured yet", {exact: true}).click();
}
await page.getByText(provider, {exact: true}).click();
await page.getByLabel(/Channel Name/).fill(channelName);
await fillConfig(page);
}
/**
* Open the edit dialog for an existing storage channel.
*
* Executes from: `/dashboard/storages/channels`.
*/
export async function edit(page: Page, channelName: string) {
const card = get(page, channelName);
await card.locator("button").nth(1).click();
}
/**
* Delete an existing storage channel.
*
* Executes from: `/dashboard/storages/channels`.
*/
export async function remove(page: Page, channelName: string) {
const card = get(page, channelName);
await card.locator("button").nth(2).click();
await page.getByRole("button", {name: "Delete"}).click();
}
/**
* Trigger the storage connection test in the current dialog.
*
* Executes from: the add or edit storage channel dialog opened from `/dashboard/storages/channels`.
*/
export async function testConnection(page: Page) {
await page.getByRole("button", {name: /Test Storage/i}).click();
}
/**
* Submit the storage channel creation form.
*
* Executes from: the add storage channel dialog opened from `/dashboard/storages/channels`.
*/
export async function submit(page: Page) {
await page.getByRole("button", {name: "Add Channel"}).click();
}
/**
* Open the edit dialog for a storage channel and trigger the test action.
*
* Executes from: `/dashboard/storages/channels`.
*/
export async function testFromEdit(page: Page, channelName: string) {
await edit(page, channelName);
await testConnection(page);
}
/**
* Close the current storage channel dialog without saving.
*
* Executes from: the add or edit storage channel dialog.
*/
export async function cancel(page: Page) {
await page.getByRole("button", {name: "Cancel"}).click();
}
+71
View File
@@ -0,0 +1,71 @@
import {expect, test} from "@playwright/test";
import {
cancel, create, get, remove, submit, testFromEdit,
} from "../helpers/notification";
import {getEnv} from "../helpers/env";
import {LOCAL_STORAGE_PATH} from "../helpers/session";
test.use({storageState: LOCAL_STORAGE_PATH});
const validChannelName = "Discord E2E Required";
const invalidChannelName = "Discord E2E Invalid";
// test.describe.serial("Valid channel", () => {
// test("Create and test a valid Discord channel", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await create(page, "Discord", validChannelName, async (page) => {
// await page.getByLabel(/Discord Webhook URL/).fill(getEnv("E2E_NOTIFICATION_DISCORD_WEBHOOK"));
// });
// await expect(page.getByRole("heading", {name: "Add Notification Channel"})).toBeVisible();
// await submit(page);
// await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
// await expect(get(page, validChannelName)).toBeVisible();
//
// await testFromEdit(page, validChannelName);
// await expect(page.getByRole("heading", {name: "Edit Notification Channel"})).toBeVisible();
// await expect(page.getByText("Sent to Discord")).toBeVisible();
// await cancel(page);
// await expect(page.getByRole("heading", {name: "Edit Notification Channel"})).toHaveCount(0);
// });
//
// test("Edit and test a valid Discord channel", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await expect(get(page, validChannelName)).toBeVisible();
// await testFromEdit(page, validChannelName);
// await expect(page.getByRole("heading", {name: "Edit Notification Channel"})).toBeVisible();
// await expect(page.getByText("Sent to Discord")).toBeVisible();
// await cancel(page);
// await expect(page.getByRole("heading", {name: "Edit Notification Channel"})).toHaveCount(0);
// });
// });
test.describe.serial("Invalid channel", () => {
test("Create and test invalid Discord channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await create(page, "Discord", invalidChannelName, async (page) => {
await page.getByLabel(/Discord Webhook URL/).fill("https://discord.com/api/webhooks/123456789012345678/wrong-discord-webhook-token");
});
await expect(page.getByRole("heading", {name: "Add Notification Channel"})).toBeVisible();
await submit(page);
await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await testFromEdit(page, invalidChannelName);
await expect(page.getByRole("heading", {name: "Edit Notification Channel"})).toBeVisible();
await expect(page.getByText("An error occurred while testing the notification channel, check your configuration")).toBeVisible();
await cancel(page);
await expect(page.getByRole("heading", {name: "Edit Notification Channel"})).toHaveCount(0);
});
test("Delete invalid Discord channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await remove(page, invalidChannelName);
await expect(page.getByText("Notification channel has been successfully removed.")).toBeVisible();
await expect(page.getByText(invalidChannelName)).toHaveCount(0);
});
});
+66
View File
@@ -0,0 +1,66 @@
import {expect, test} from "@playwright/test";
import {
cancel, create, get, remove, submit, testFromEdit,
} from "../helpers/notification";
import {getEnv} from "../helpers/env";
import {LOCAL_STORAGE_PATH} from "../helpers/session";
test.use({storageState: LOCAL_STORAGE_PATH});
const validChannelName = "Gotify E2E Required";
const invalidChannelName = "Gotify E2E Invalid";
// test.describe.serial("Valid channel", () => {
// test("Create and test a valid Gotify channel", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await create(page, "Gotify", validChannelName, async (page) => {
// await page.getByLabel(/Gotify Server URL/).fill(getEnv("E2E_NOTIFICATION_GOTIFY_SERVER_URL"));
// await page.getByLabel(/Application Token/).fill(getEnv("E2E_NOTIFICATION_GOTIFY_APP_TOKEN"));
// });
// await expect(page.getByRole("heading", {name: "Add Notification Channel"})).toBeVisible();
// await submit(page);
// await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
// await expect(get(page, validChannelName)).toBeVisible();
//
// await testFromEdit(page, validChannelName);
// await expect(page.getByText("Sent to Gotify")).toBeVisible();
// await cancel(page);
// });
//
// test("Edit and test a valid Gotify channel", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await expect(get(page, validChannelName)).toBeVisible();
// await testFromEdit(page, validChannelName);
// await expect(page.getByText("Sent to Gotify")).toBeVisible();
// await cancel(page);
// });
// });
test.describe.serial("Invalid channel", () => {
test("Create and test invalid Gotify channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await create(page, "Gotify", invalidChannelName, async (page) => {
await page.getByLabel(/Gotify Server URL/).fill(getEnv("E2E_NOTIFICATION_GOTIFY_SERVER_URL"));
await page.getByLabel(/Application Token/).fill("wrong-gotify-app-token");
});
await expect(page.getByRole("heading", {name: "Add Notification Channel"})).toBeVisible();
await submit(page);
await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await testFromEdit(page, invalidChannelName);
await expect(page.getByText("An error occurred while testing the notification channel, check your configuration")).toBeVisible();
await cancel(page);
});
test("Delete invalid Gotify channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await remove(page, invalidChannelName);
await expect(page.getByText("Notification channel has been successfully removed.")).toBeVisible();
await expect(page.getByText(invalidChannelName)).toHaveCount(0);
});
});
+73
View File
@@ -0,0 +1,73 @@
import {expect, test} from "@playwright/test";
import {
cancel, create, get, remove, submit, testFromEdit,
} from "../helpers/notification";
import {getEnv} from "../helpers/env";
import {LOCAL_STORAGE_PATH} from "../helpers/session";
test.use({storageState: LOCAL_STORAGE_PATH});
const requiredChannelName = "Ntfy E2E Required";
const optionalChannelName = "Ntfy E2E Optional";
const invalidChannelName = "Ntfy E2E Invalid";
// test.describe.serial("Valid channels", () => {
// test("Create and test a valid Ntfy channel with only required fields", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await create(page, "ntfy.sh", requiredChannelName, async (page) => {
// await page.getByLabel(/Topic Name/).fill(getEnv("E2E_NOTIFICATION_NTFY_TOPIC"));
// });
// await submit(page);
// await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
// await expect(get(page, requiredChannelName)).toBeVisible();
// await testFromEdit(page, requiredChannelName);
// await expect(page.getByText("Sent to ntfy")).toBeVisible();
// await cancel(page);
// });
//
// test("Create and test a valid Ntfy channel with optional fields", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await create(page, "ntfy.sh", optionalChannelName, async (page) => {
// await page.getByLabel(/Topic Name/).fill(getEnv("E2E_NOTIFICATION_NTFY_TOPIC"));
// await page.getByLabel(/^Server URL$/).fill(getEnv("E2E_NOTIFICATION_NTFY_SERVER_URL"));
// await page.getByLabel(/^Access Token$/).fill(getEnv("E2E_NOTIFICATION_NTFY_TOKEN"));
// await page.getByLabel(/^Basic Auth Username$/).fill(getEnv("E2E_NOTIFICATION_NTFY_USERNAME"));
// await page.getByLabel(/^Basic Auth Password$/).fill(getEnv("E2E_NOTIFICATION_NTFY_PASSWORD"));
// });
// await submit(page);
// await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
// await expect(get(page, optionalChannelName)).toBeVisible();
// await testFromEdit(page, optionalChannelName);
// await expect(page.getByText("Sent to ntfy")).toBeVisible();
// await cancel(page);
// });
// });
test.describe.serial("Invalid channel", () => {
test("Create and test invalid Ntfy channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await create(page, "ntfy.sh", invalidChannelName, async (page) => {
await page.getByLabel(/Topic Name/).fill("wrong-ntfy-topic");
await page.getByLabel(/^Server URL$/).fill(getEnv("E2E_NOTIFICATION_NTFY_SERVER_URL"));
await page.getByLabel(/^Access Token$/).fill("wrong-ntfy-token");
});
await submit(page);
await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await testFromEdit(page, invalidChannelName);
await expect(page.getByText("An error occurred while testing the notification channel, check your configuration")).toBeVisible();
await cancel(page);
});
test("Delete invalid Ntfy channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await remove(page, invalidChannelName);
await expect(page.getByText("Notification channel has been successfully removed.")).toBeVisible();
await expect(page.getByText(invalidChannelName)).toHaveCount(0);
});
});
+61
View File
@@ -0,0 +1,61 @@
import {expect, test} from "@playwright/test";
import {
cancel, create, get, remove, submit, testFromEdit,
} from "../helpers/notification";
import {getEnv} from "../helpers/env";
import {LOCAL_STORAGE_PATH} from "../helpers/session";
test.use({storageState: LOCAL_STORAGE_PATH});
const validChannelName = "Slack E2E Required";
const invalidChannelName = "Slack E2E Invalid";
// test.describe.serial("Valid channel", () => {
// test("Create and test a valid Slack channel", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await create(page, "Slack", validChannelName, async (page) => {
// await page.getByLabel(/Slack Webhook URL/).fill(getEnv("E2E_NOTIFICATION_SLACK_WEBHOOK"));
// });
// await submit(page);
// await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
// await expect(get(page, validChannelName)).toBeVisible();
// await testFromEdit(page, validChannelName);
// await expect(page.getByText("Sent to Slack")).toBeVisible();
// await cancel(page);
// });
//
// test("Edit and test a valid Slack E2E channel", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await expect(get(page, validChannelName)).toBeVisible();
// await testFromEdit(page, validChannelName);
// await expect(page.getByText("Sent to Slack")).toBeVisible();
// await cancel(page);
// });
// });
test.describe.serial("Invalid channel", () => {
test("Create and test invalid Slack channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await create(page, "Slack", invalidChannelName, async (page) => {
await page.getByLabel(/Slack Webhook URL/).fill("https://WRONG_SLACK_WEBHOOK");
});
await submit(page);
await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await testFromEdit(page, invalidChannelName);
await expect(page.getByText("An error occurred while testing the notification channel, check your configuration")).toBeVisible();
await cancel(page);
});
test("Delete invalid Slack channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await remove(page, invalidChannelName);
await expect(page.getByText("Notification channel has been successfully removed.")).toBeVisible();
await expect(page.getByText(invalidChannelName)).toHaveCount(0);
});
});
+72
View File
@@ -0,0 +1,72 @@
import {expect, test} from "@playwright/test";
import {getEnv} from "../helpers/env";
import {
cancel, create, get, remove, submit, testFromEdit,
} from "../helpers/notification";
import {LOCAL_STORAGE_PATH} from "../helpers/session";
test.use({storageState: LOCAL_STORAGE_PATH});
const validChannelName = "SMTP E2E Required";
const invalidChannelName = "SMTP E2E Invalid";
const successMessage = `Email sent: ${getEnv("E2E_NOTIFICATION_SMTP_TO")}`;
// test.describe.serial("Valid channel", () => {
// test("Create and test a valid SMTP channel", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await create(page, "Email", validChannelName, async (page) => {
// await page.getByLabel(/SMTP Host/).fill(getEnv("E2E_NOTIFICATION_SMTP_HOST"));
// await page.getByLabel(/SMTP Port/).fill(getEnv("E2E_NOTIFICATION_SMTP_PORT"));
// await page.getByLabel(/Username/).fill(getEnv("E2E_NOTIFICATION_SMTP_USER"));
// await page.getByLabel(/Password/).fill(getEnv("E2E_NOTIFICATION_SMTP_PASSWORD"));
// await page.getByLabel(/From Email/).fill(getEnv("E2E_NOTIFICATION_SMTP_FROM"));
// await page.getByLabel(/To Email/).fill(getEnv("E2E_NOTIFICATION_SMTP_TO"));
// });
// await submit(page);
// await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
// await expect(get(page, validChannelName)).toBeVisible();
// await testFromEdit(page, validChannelName);
// await expect(page.getByText(successMessage)).toBeVisible();
// await cancel(page);
// });
//
// test("Edit and test a valid SMTP channel", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await expect(get(page, validChannelName)).toBeVisible();
// await testFromEdit(page, validChannelName);
// await expect(page.getByText(successMessage)).toBeVisible();
// await cancel(page);
// });
// });
test.describe.serial("Invalid channel", () => {
test("Create and test invalid SMTP E2E channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await create(page, "Email", invalidChannelName, async (page) => {
await page.getByLabel(/SMTP Host/).fill("smtp.invalid");
await page.getByLabel(/SMTP Port/).fill(getEnv("E2E_NOTIFICATION_SMTP_PORT"));
await page.getByLabel(/Username/).fill(getEnv("E2E_NOTIFICATION_SMTP_USER"));
await page.getByLabel(/Password/).fill("wrong-password");
await page.getByLabel(/From Email/).fill(getEnv("E2E_NOTIFICATION_SMTP_FROM"));
await page.getByLabel(/To Email/).fill(getEnv("E2E_NOTIFICATION_SMTP_TO"));
});
await submit(page);
await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await testFromEdit(page, invalidChannelName);
await expect(page.getByText("An error occurred while testing the notification channel, check your configuration")).toBeVisible();
await cancel(page);
});
test("Delete invalid SMTP channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await remove(page, invalidChannelName);
await expect(page.getByText("Notification channel has been successfully removed.")).toBeVisible();
await expect(page.getByText(invalidChannelName)).toHaveCount(0);
});
});
View File
+72
View File
@@ -0,0 +1,72 @@
import {expect, test} from "@playwright/test";
import {
cancel, create, get, remove, submit, testFromEdit,
} from "../helpers/notification";
import {getEnv} from "../helpers/env";
import {LOCAL_STORAGE_PATH} from "../helpers/session";
test.use({storageState: LOCAL_STORAGE_PATH});
const requiredChannelName = "Telegram E2E Required";
const optionalChannelName = "Telegram E2E Optional";
const invalidChannelName = "Telegram E2E Invalid";
// test.describe.serial("Valid channels", () => {
// test("Create and test a valid Telegram channel", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await create(page, "Telegram", requiredChannelName, async (page) => {
// await page.getByLabel(/Telegram Bot Token/).fill(getEnv("E2E_NOTIFICATION_TELEGRAM_BOT_TOKEN"));
// await page.getByLabel(/Telegram Chat ID/).fill(getEnv("E2E_NOTIFICATION_TELEGRAM_CHAT_ID"));
// });
// await submit(page);
// await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
// await expect(get(page, requiredChannelName)).toBeVisible();
// await testFromEdit(page, requiredChannelName);
// await expect(page.getByText("Sent to Telegram")).toBeVisible();
// await cancel(page);
// });
//
// test("Create and test a valid Telegram channel with Topic ID", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await create(page, "Telegram", optionalChannelName, async (page) => {
// await page.getByLabel(/Telegram Bot Token/).fill(getEnv("E2E_NOTIFICATION_TELEGRAM_BOT_TOKEN"));
// await page.getByLabel(/Telegram Chat ID/).fill(getEnv("E2E_NOTIFICATION_TELEGRAM_CHAT_ID"));
// await page.getByLabel(/Telegram Topic ID/).fill(getEnv("E2E_NOTIFICATION_TELEGRAM_TOPIC_ID"));
// });
// await submit(page);
// await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
// await expect(get(page, optionalChannelName)).toBeVisible();
// await testFromEdit(page, optionalChannelName);
// await expect(page.getByText("Sent to Telegram")).toBeVisible();
// await cancel(page);
// });
// });
test.describe.serial("Invalid channel", () => {
test("Create and test invalid Telegram channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await create(page, "Telegram", invalidChannelName, async (page) => {
await page.getByLabel(/Telegram Bot Token/).fill("wrong-telegram-bot-token");
await page.getByLabel(/Telegram Chat ID/).fill(getEnv("E2E_NOTIFICATION_TELEGRAM_CHAT_ID"));
await page.getByLabel(/Telegram Topic ID/).fill(getEnv("E2E_NOTIFICATION_TELEGRAM_TOPIC_ID"));
});
await submit(page);
await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await testFromEdit(page, invalidChannelName);
await expect(page.getByText("An error occurred while testing the notification channel, check your configuration")).toBeVisible();
await cancel(page);
});
test("Delete invalid Telegram channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await remove(page, invalidChannelName);
await expect(page.getByText("Notification channel has been successfully removed.")).toBeVisible();
await expect(page.getByText(invalidChannelName)).toHaveCount(0);
});
});
+71
View File
@@ -0,0 +1,71 @@
import {expect, test} from "@playwright/test";
import {
cancel, create, get, remove, submit, testFromEdit,
} from "../helpers/notification";
import {getEnv} from "../helpers/env";
import {LOCAL_STORAGE_PATH} from "../helpers/session";
test.use({storageState: LOCAL_STORAGE_PATH});
const requiredChannelName = "Webhook E2E Required";
const optionalChannelName = "Webhook E2E Optional";
const invalidChannelName = "Webhook E2E Invalid";
// test.describe.serial("Valid channels", () => {
// test("Create and test a valid Webhook channel", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await create(page, "Webhook", requiredChannelName, async (page) => {
// await page.getByLabel(/Webhook URL/).fill(getEnv("E2E_NOTIFICATION_WEBHOOK_URL"));
// });
// await submit(page);
// await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
// await expect(get(page, requiredChannelName)).toBeVisible();
// await testFromEdit(page, requiredChannelName);
// await expect(page.getByText("Sent to Webhook")).toBeVisible();
// await cancel(page);
// });
//
// test("Create and test a valid Webhook channel with optional header", async ({page}) => {
// await page.goto("/dashboard/notifications/channels");
// await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
// await create(page, "Webhook", optionalChannelName, async (page) => {
// await page.getByLabel(/Webhook URL/).fill(getEnv("E2E_NOTIFICATION_WEBHOOK_URL"));
// await page.getByLabel(/^Header Name$/).fill(getEnv("E2E_NOTIFICATION_WEBHOOK_SECRET_HEADER"));
// await page.getByLabel(/^Secret Value$/).fill(getEnv("E2E_NOTIFICATION_WEBHOOK_SECRET"));
// });
// await submit(page);
// await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
// await expect(get(page, optionalChannelName)).toBeVisible();
// await testFromEdit(page, optionalChannelName);
// await expect(page.getByText("Sent to Webhook")).toBeVisible();
// await cancel(page);
// });
// });
test.describe.serial("Invalid channel", () => {
test("Create and test invalid Webhook channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await create(page, "Webhook", invalidChannelName, async (page) => {
await page.getByLabel(/Webhook URL/).fill("https://webhook.example.com/api/wrong-webhook");
await page.getByLabel(/^Header Name$/).fill(getEnv("E2E_NOTIFICATION_WEBHOOK_SECRET_HEADER"));
await page.getByLabel(/^Secret Value$/).fill("wrong-webhook-secret");
});
await submit(page);
await expect(page.getByText("Notification channel has been successfully created.")).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await testFromEdit(page, invalidChannelName);
await expect(page.getByText("An error occurred while testing the notification channel, check your configuration")).toBeVisible();
await cancel(page);
});
test("Delete invalid Webhook E2E channel", async ({page}) => {
await page.goto("/dashboard/notifications/channels");
await expect(page.getByRole("heading", {name: "Notification channels"})).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await remove(page, invalidChannelName);
await expect(page.getByText("Notification channel has been successfully removed.")).toBeVisible();
await expect(page.getByText(invalidChannelName)).toHaveCount(0);
});
});
+59
View File
@@ -0,0 +1,59 @@
import {expect, test} from "@playwright/test";
import {create, edit, get, remove} from "./helpers/project";
import {LOCAL_STORAGE_PATH} from "./helpers/session";
test.use({storageState: LOCAL_STORAGE_PATH});
const project = {
emptyStateName: "Project A",
buttonName: "Project B",
updatedButtonName: "Project B Updated",
};
test.describe.serial(() => {
test("Create a project from empty state", async ({page}) => {
await page.goto("/dashboard/projects");
await expect(page.getByRole("heading", {name: "Projects"})).toBeVisible();
await expect(page.getByText("Create new Project", {exact: true})).toBeVisible();
await create(page, "emptyState", project.emptyStateName);
await expect(page.getByText("Project has been successfully created.")).toBeVisible();
await expect(get(page, project.emptyStateName)).toBeVisible();
await expect(page.getByText("Create new Project", {exact: true})).toHaveCount(0);
});
test("Create a project from classic button", async ({page}) => {
await page.goto("/dashboard/projects");
await expect(page.getByRole("heading", {name: "Projects"})).toBeVisible();
await expect(get(page, project.emptyStateName)).toBeVisible();
await create(page, "button", project.buttonName);
await expect(page.getByText("Project has been successfully created.")).toBeVisible();
await expect(get(page, project.buttonName)).toBeVisible();
});
test("Edit the second created project", async ({page}) => {
await page.goto("/dashboard/projects");
await expect(page.getByRole("heading", {name: "Projects"})).toBeVisible();
await expect(get(page, project.buttonName)).toBeVisible();
await edit(page, project.buttonName, project.updatedButtonName);
await expect(page.getByText("Project has been successfully updated.")).toBeVisible();
await expect(page.getByText(project.updatedButtonName, {exact: true})).toBeVisible();
});
test("Delete the second created project", async ({page}) => {
await page.goto("/dashboard/projects");
await expect(page.getByRole("heading", {name: "Projects"})).toBeVisible();
await expect(get(page, project.updatedButtonName)).toBeVisible();
await remove(page, project.updatedButtonName);
await expect(page).toHaveURL("/dashboard/projects");
await expect(page.getByText("Projects has been successfully archived.")).toBeVisible();
await expect(page.getByText(project.updatedButtonName)).toHaveCount(0);
});
});
+13
View File
@@ -0,0 +1,13 @@
import {test} from "@playwright/test";
import fs from "fs";
import {LOCAL_STORAGE_PATH} from "./helpers/session";
test.describe(() => {
test.beforeAll(async () => {
if (fs.existsSync(LOCAL_STORAGE_PATH)) fs.unlinkSync(LOCAL_STORAGE_PATH);
fs.writeFileSync(LOCAL_STORAGE_PATH, JSON.stringify({}));
});
test("Prepare shared storage state", async () => {
});
});
View File
View File
+60
View File
@@ -0,0 +1,60 @@
import {expect, test} from "@playwright/test";
import {getEnv} from "../helpers/env";
import {LOCAL_STORAGE_PATH} from "../helpers/session";
import {
cancel, create, get, remove, submit, testConnection, testFromEdit,
} from "../helpers/storage";
test.use({storageState: LOCAL_STORAGE_PATH});
const requiredChannelName = "Google Drive E2E Required";
const invalidChannelName = "Google Drive E2E Invalid";
// test.describe.serial("Valid channel", () => {
// test("Create and test a valid Google Drive channel", async ({page}) => {
// await page.goto("/dashboard/storages/channels");
// await expect(page.getByRole("heading", {name: "Storage channels"})).toBeVisible();
// await create(page, "Google Drive", requiredChannelName, async (page) => {
// await page.getByLabel(/Client ID/).fill(getEnv("E2E_STORAGE_GOOGLE_DRIVE_CLIENT_ID"));
// await page.getByLabel(/Client Secret/).fill(getEnv("E2E_STORAGE_GOOGLE_DRIVE_CLIENT_SECRET"));
// await page.getByLabel(/Folder ID/).fill(getEnv("E2E_STORAGE_GOOGLE_DRIVE_FOLDER_ID"));
// });
// await expect(page.getByRole("heading", {name: "Add Storage Channel"})).toBeVisible();
// await testConnection(page);
// await expect(page.getByText("Successfully connected to storage channel")).toBeVisible();
// await submit(page);
// await expect(page.getByText("Storage channel has been successfully created.")).toBeVisible();
// await expect(get(page, requiredChannelName)).toBeVisible();
//
// await testFromEdit(page, requiredChannelName);
// await expect(page.getByRole("heading", {name: "Edit Storage Channel"})).toBeVisible();
// await expect(page.getByText("Successfully connected to storage channel")).toBeVisible();
// await cancel(page);
// });
// });
test.describe.serial("Invalid channel", () => {
test("Create and test invalid Google Drive channel", async ({page}) => {
await page.goto("/dashboard/storages/channels");
await expect(page.getByRole("heading", {name: "Storage channels"})).toBeVisible();
await create(page, "Google Drive", invalidChannelName, async (page) => {
await page.getByLabel(/Client ID/).fill(getEnv("E2E_STORAGE_GOOGLE_DRIVE_CLIENT_ID"));
await page.getByLabel(/Client Secret/).fill("wrong-google-drive-client-secret");
await page.getByLabel(/Folder ID/).fill(getEnv("E2E_STORAGE_GOOGLE_DRIVE_FOLDER_ID"));
});
await testConnection(page);
await expect(page.getByText("An error occurred while testing the storage channel")).toBeVisible();
await submit(page);
await expect(page.getByText("Storage channel has been successfully created.")).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
});
test("Delete invalid Google Drive E2E channel", async ({page}) => {
await page.goto("/dashboard/storages/channels");
await expect(page.getByRole("heading", {name: "Storage channels"})).toBeVisible();
await expect(get(page, invalidChannelName)).toBeVisible();
await remove(page, invalidChannelName);
await expect(page.getByText("Storage channel has been successfully removed.")).toBeVisible();
await expect(page.getByText(invalidChannelName)).toHaveCount(0);
});
});
+121
View File
@@ -0,0 +1,121 @@
import {expect, test} from "@playwright/test";
import {getEnv} from "../helpers/env";
import {LOCAL_STORAGE_PATH} from "../helpers/session";
import {
cancel, create, get, remove, submit, testConnection, testFromEdit,
} from "../helpers/storage";
test.use({storageState: LOCAL_STORAGE_PATH});
const providers = [
{
title: "AWS S3",
requiredChannelName: "AWS S3 E2E Required",
optionalChannelName: "AWS S3 E2E Optional",
invalidChannelName: "AWS S3 E2E Invalid",
endpointUrl: getEnv("E2E_STORAGE_AWS_S3_ENDPOINT_URL"),
region: getEnv("E2E_STORAGE_AWS_S3_REGION"),
accessKey: getEnv("E2E_STORAGE_AWS_S3_ACCESS_KEY"),
secretKey: getEnv("E2E_STORAGE_AWS_S3_SECRET_KEY"),
bucketName: getEnv("E2E_STORAGE_AWS_S3_BUCKET_NAME"),
port: getEnv("E2E_STORAGE_AWS_S3_PORT"),
invalidAccessKey: "wrong-aws-access-key",
invalidSecretKey: "wrong-aws-secret-key",
},
{
title: "Cloudflare R2",
requiredChannelName: "Cloudflare R2 E2E Required",
optionalChannelName: "Cloudflare R2 E2E Optional",
invalidChannelName: "Cloudflare R2 E2E Invalid",
endpointUrl: getEnv("E2E_STORAGE_R2_ENDPOINT_URL"),
region: getEnv("E2E_STORAGE_R2_REGION"),
accessKey: getEnv("E2E_STORAGE_R2_ACCESS_KEY"),
secretKey: getEnv("E2E_STORAGE_R2_SECRET_KEY"),
bucketName: getEnv("E2E_STORAGE_R2_BUCKET_NAME"),
port: getEnv("E2E_STORAGE_R2_PORT"),
invalidAccessKey: "wrong-r2-access-key",
invalidSecretKey: "wrong-r2-secret-key",
},
] as const;
for (const provider of providers) {
test.describe(provider.title, () => {
// test.describe.serial("Valid channels", () => {
// test(`Create and test a valid ${provider.title} channel`, async ({page}) => {
// await page.goto("/dashboard/storages/channels");
// await expect(page.getByRole("heading", {name: "Storage channels"})).toBeVisible();
// await create(page, "S3", provider.requiredChannelName, async (page) => {
// await page.getByLabel(/Endpoint URL/).fill(provider.endpointUrl);
// await page.getByLabel(/Access Key/).fill(provider.accessKey);
// await page.getByLabel(/Secret Key/).fill(provider.secretKey);
// await page.getByLabel(/Bucket name/).fill(provider.bucketName);
// });
// await expect(page.getByRole("heading", {name: "Add Storage Channel"})).toBeVisible();
// await testConnection(page);
// await expect(page.getByText("Successfully connected to storage channel")).toBeVisible();
// await submit(page);
// await expect(page.getByText("Storage channel has been successfully created.")).toBeVisible();
// await expect(get(page, provider.requiredChannelName)).toBeVisible();
//
// await testFromEdit(page, provider.requiredChannelName);
// await expect(page.getByRole("heading", {name: "Edit Storage Channel"})).toBeVisible();
// await expect(page.getByText("Successfully connected to storage channel")).toBeVisible();
// await cancel(page);
// });
//
// test(`Create and test a valid ${provider.title} channel with optional region and port`, async ({page}) => {
// await page.goto("/dashboard/storages/channels");
// await expect(page.getByRole("heading", {name: "Storage channels"})).toBeVisible();
// await create(page, "S3", provider.optionalChannelName, async (page) => {
// await page.getByLabel(/Endpoint URL/).fill(provider.endpointUrl);
// await page.getByLabel(/^Region$/).fill(provider.region);
// await page.getByLabel(/Access Key/).fill(provider.accessKey);
// await page.getByLabel(/Secret Key/).fill(provider.secretKey);
// await page.getByLabel(/Bucket name/).fill(provider.bucketName);
// await page.getByLabel(/^Port$/).fill(provider.port);
// });
// await expect(page.getByRole("heading", {name: "Add Storage Channel"})).toBeVisible();
// await testConnection(page);
// await expect(page.getByText("Successfully connected to storage channel")).toBeVisible();
// await submit(page);
// await expect(page.getByText("Storage channel has been successfully created.")).toBeVisible();
// await expect(get(page, provider.optionalChannelName)).toBeVisible();
//
// await testFromEdit(page, provider.optionalChannelName);
// await expect(page.getByRole("heading", {name: "Edit Storage Channel"})).toBeVisible();
// await expect(page.getByText("Successfully connected to storage channel")).toBeVisible();
// await cancel(page);
// });
// });
test.describe.serial("Invalid channel", () => {
test(`Create and test invalid ${provider.title} channel`, async ({page}) => {
await page.goto("/dashboard/storages/channels");
await expect(page.getByRole("heading", {name: "Storage channels"})).toBeVisible();
await create(page, "S3", provider.invalidChannelName, async (page) => {
await page.getByLabel(/Endpoint URL/).fill(provider.endpointUrl);
await page.getByLabel(/^Region$/).fill(provider.region);
await page.getByLabel(/Access Key/).fill(provider.invalidAccessKey);
await page.getByLabel(/Secret Key/).fill(provider.invalidSecretKey);
await page.getByLabel(/Bucket name/).fill(provider.bucketName);
await page.getByLabel(/^Port$/).fill(provider.port);
});
await expect(page.getByRole("heading", {name: "Add Storage Channel"})).toBeVisible();
await testConnection(page);
await expect(page.getByText("An error occurred while testing the storage channel")).toBeVisible();
await submit(page);
await expect(page.getByText("Storage channel has been successfully created.")).toBeVisible();
await expect(get(page, provider.invalidChannelName)).toBeVisible();
});
test(`Delete invalid ${provider.title} channel`, async ({page}) => {
await page.goto("/dashboard/storages/channels");
await expect(page.getByRole("heading", {name: "Storage channels"})).toBeVisible();
await expect(get(page, provider.invalidChannelName)).toBeVisible();
await remove(page, provider.invalidChannelName);
await expect(page.getByText("Storage channel has been successfully removed.")).toBeVisible();
await expect(page.getByText(provider.invalidChannelName)).toHaveCount(0);
});
});
});
}
+4 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "portabase", "name": "portabase",
"version": "1.9.4", "version": "1.11.2",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev --turbopack -p 8887", "dev": "next dev --turbopack -p 8887",
@@ -125,8 +125,9 @@
"eslint": "^9.39.4", "eslint": "^9.39.4",
"eslint-config-next": "^16.2.1", "eslint-config-next": "^16.2.1",
"eslint-plugin-tailwindcss": "^3.18.2", "eslint-plugin-tailwindcss": "^3.18.2",
"framer-motion": "^12.38.0", "framer-motion": "^12.34.3",
"postcss": "^8.5.8", "node-pty": "^1.1.0",
"postcss": "^8.5.6",
"release-it": "^19.2.4", "release-it": "^19.2.4",
"tailwindcss": "^4.2.2", "tailwindcss": "^4.2.2",
"tsx": "^4.21.0", "tsx": "^4.21.0",
+46 -46
View File
@@ -1,12 +1,12 @@
import { defineConfig, devices } from '@playwright/test'; import { defineConfig, devices } from '@playwright/test';
import dotenv from 'dotenv';
import path from 'path';
/** /**
* Read environment variables from file. * Read environment variables from file.
* https://github.com/motdotla/dotenv * https://github.com/motdotla/dotenv
*/ */
// import dotenv from 'dotenv'; dotenv.config({ path: path.resolve(__dirname, '.env') });
// import path from 'path';
// dotenv.config({ path: path.resolve(__dirname, '.env') });
/** /**
* See https://playwright.dev/docs/test-configuration. * See https://playwright.dev/docs/test-configuration.
@@ -25,55 +25,55 @@ export default defineConfig({
reporter: 'html', reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: { use: {
/* Base URL to use in actions like `await page.goto('')`. */ ...devices['Desktop Chrome'],
baseURL: process.env.PROJECT_URL, baseURL: process.env.PROJECT_URL,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry', trace: 'on-first-retry',
}, },
/* Configure projects for major browsers */ /* Configure projects and dependency order */
projects: [ projects: [
{ {
name: 'chromium', name: 'setup',
use: { ...devices['Desktop Chrome'] }, testMatch: '**/setup.spec.ts',
}, },
{
name: 'auth',
testMatch: '**/auth.spec.ts',
dependencies: ['setup'],
},
{
name: 'access-management',
testMatch: '**/access-management.spec.ts',
dependencies: ['auth'],
},
{
name: 'notification',
testMatch: '**/notification/**/*.spec.ts',
dependencies: ['access-management'],
},
{
name: 'storage',
testMatch: '**/storage/**/*.spec.ts',
dependencies: ['access-management'],
},
{
name: 'agent',
testMatch: '**/agent.spec.ts',
dependencies: ['access-management'],
},
{ {
name: 'firefox', name: 'project',
use: { ...devices['Desktop Firefox'] }, testMatch: '**/project.spec.ts',
}, dependencies: ['access-management'],
},
{
name: 'cleanup',
testMatch: '**/cleanup.spec.ts',
dependencies: ['agent', 'storage', 'notification', 'project'],
},
]
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
/* Test against mobile viewports. */
{
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] },
},
/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'docker compose up -d && make up',
// url: 'http://localhost:8887',
// reuseExistingServer: !process.env.CI,
// },
}); });
+703 -520
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -1,3 +1,5 @@
ignoredBuiltDependencies:
- node-pty
onlyBuiltDependencies: onlyBuiltDependencies:
- '@prisma/client' - '@prisma/client'
- '@prisma/engines' - '@prisma/engines'
Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

@@ -37,6 +37,7 @@ export function SocialAuthButtons({ providers }: { providers: AuthProviderConfig
providerType: "oidc", providerType: "oidc",
callbackURL: "/dashboard", callbackURL: "/dashboard",
}); });
console.log(result);
} else { } else {
result = await authClient.signIn.social({ result = await authClient.signIn.social({
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -44,7 +44,7 @@ export function BreadCrumbsWrapper() {
) )
} }
const FORBIDDEN_LINKS = ["organization", "dashboard", "database", "admin", "settings", "notifications"]; const FORBIDDEN_LINKS = ["organization", "dashboard", "database", "admin", "settings", "notifications", "storages"];
export function BreadCrumbs({}: BreadCrumbsProps) { export function BreadCrumbs({}: BreadCrumbsProps) {
@@ -202,9 +202,9 @@ export const ChannelForm = ({onSuccessAction, organization, defaultValues, kind}
name="name" name="name"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>Channel Name</FormLabel> <FormLabel>Channel Name *</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder={`My ${selectedProviderDetails?.label} Channel`} <Input {...field} placeholder={`e.g. ${selectedProviderDetails?.label} Channel`}
value={field.value ?? ""}/> value={field.value ?? ""}/>
</FormControl> </FormControl>
<FormMessage/> <FormMessage/>
@@ -252,4 +252,3 @@ export const ChannelForm = ({onSuccessAction, organization, defaultValues, kind}
</Form> </Form>
); );
}; };
@@ -22,11 +22,11 @@ export const NotifierDiscordForm = ({ form }: NotifierDiscordFormProps) => {
name="config.discordWebhook" name="config.discordWebhook"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Discord Webhook URL</FormLabel> <FormLabel>Discord Webhook URL *</FormLabel>
<FormControl> <FormControl>
<PasswordInput <PasswordInput
{...field} {...field}
placeholder="https://discord.com/api/webhooks/..." placeholder="e.g. https://discord.com/api/webhooks/..."
/> />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
@@ -23,9 +23,9 @@ export const NotifierGotifyForm = ({ form }: NotifierGotifyFormProps) => {
name="config.gotifyServerUrl" name="config.gotifyServerUrl"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Gotify Server URL</FormLabel> <FormLabel>Gotify Server URL *</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="https://gotify.example.com" /> <Input {...field} placeholder="e.g. https://gotify.example.com" />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@@ -36,9 +36,9 @@ export const NotifierGotifyForm = ({ form }: NotifierGotifyFormProps) => {
name="config.gotifyAppToken" name="config.gotifyAppToken"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Application Token</FormLabel> <FormLabel>Application Token *</FormLabel>
<FormControl> <FormControl>
<PasswordInput {...field} placeholder="A1b2C3d4E5f6G7h" /> <PasswordInput {...field} placeholder="e.g. gotify-app-token" />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@@ -18,9 +18,9 @@ export const NotifierNtfyForm = ({form}: NotifierNtfyFormProps) => {
name="config.ntfyTopic" name="config.ntfyTopic"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>Topic Name</FormLabel> <FormLabel>Topic Name *</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="my-secret-topic"/> <Input {...field} placeholder="e.g. team-alerts"/>
</FormControl> </FormControl>
<FormMessage/> <FormMessage/>
</FormItem> </FormItem>
@@ -32,9 +32,9 @@ export const NotifierNtfyForm = ({form}: NotifierNtfyFormProps) => {
name="config.ntfyServerUrl" name="config.ntfyServerUrl"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>Server URL (Optional)</FormLabel> <FormLabel>Server URL</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="https://ntfy.sh (default)"/> <Input {...field} placeholder="e.g. https://ntfy.example.com"/>
</FormControl> </FormControl>
<p className="text-xs text-muted-foreground">Leave empty to use the official ntfy.sh server.</p> <p className="text-xs text-muted-foreground">Leave empty to use the official ntfy.sh server.</p>
<FormMessage/> <FormMessage/>
@@ -47,9 +47,9 @@ export const NotifierNtfyForm = ({form}: NotifierNtfyFormProps) => {
name="config.ntfyToken" name="config.ntfyToken"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>Access Token (Optional)</FormLabel> <FormLabel>Access Token</FormLabel>
<FormControl> <FormControl>
<PasswordInput {...field} placeholder="tk_..."/> <PasswordInput {...field} placeholder="e.g. tk_xxxxx"/>
</FormControl> </FormControl>
<p className="text-xs text-muted-foreground">Only required for protected topics or self-hosted instances with auth.</p> <p className="text-xs text-muted-foreground">Only required for protected topics or self-hosted instances with auth.</p>
<FormMessage/> <FormMessage/>
@@ -64,9 +64,9 @@ export const NotifierNtfyForm = ({form}: NotifierNtfyFormProps) => {
name="config.ntfyUsername" name="config.ntfyUsername"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>Basic Auth Username (Optional)</FormLabel> <FormLabel>Basic Auth Username</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="username"/> <Input {...field} placeholder="e.g. notifier-user"/>
</FormControl> </FormControl>
<FormMessage/> <FormMessage/>
</FormItem> </FormItem>
@@ -78,9 +78,9 @@ export const NotifierNtfyForm = ({form}: NotifierNtfyFormProps) => {
name="config.ntfyPassword" name="config.ntfyPassword"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>Basic Auth Password (Optional)</FormLabel> <FormLabel>Basic Auth Password</FormLabel>
<FormControl> <FormControl>
<PasswordInput placeholder="password" {...field} /> <PasswordInput placeholder="e.g. notifier-password" {...field} />
</FormControl> </FormControl>
<FormMessage/> <FormMessage/>
</FormItem> </FormItem>
@@ -22,11 +22,11 @@ export const NotifierSlackForm = ({ form }: NotifierSmtpFormProps) => {
name="config.slackWebhook" name="config.slackWebhook"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Slack Webhook URL</FormLabel> <FormLabel>Slack Webhook URL *</FormLabel>
<FormControl> <FormControl>
<PasswordInput <PasswordInput
{...field} {...field}
placeholder="https://hooks.slack.com/services/..." placeholder="e.g. https://hooks.slack.com/services/..."
/> />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
@@ -19,9 +19,9 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
name="config.host" name="config.host"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>SMTP Host</FormLabel> <FormLabel>SMTP Host *</FormLabel>
<FormControl> <FormControl>
<Input placeholder="smtp.gmail.com" {...field} value={field.value ?? ""}/> <Input placeholder="e.g. smtp.example.com" {...field} value={field.value ?? ""}/>
</FormControl> </FormControl>
<FormMessage/> <FormMessage/>
</FormItem> </FormItem>
@@ -32,9 +32,9 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
name="config.port" name="config.port"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>SMTP Port</FormLabel> <FormLabel>SMTP Port *</FormLabel>
<FormControl> <FormControl>
<Input placeholder="456" type="number" {...field} value={field.value ?? ""}/> <Input placeholder="e.g. 587" type="number" {...field} value={field.value ?? ""}/>
</FormControl> </FormControl>
<FormMessage/> <FormMessage/>
</FormItem> </FormItem>
@@ -45,9 +45,9 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
name="config.user" name="config.user"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>Username</FormLabel> <FormLabel>Username *</FormLabel>
<FormControl> <FormControl>
<Input placeholder="contact@example.com" {...field} value={field.value ?? ""}/> <Input placeholder="e.g. noreply@example.com" {...field} value={field.value ?? ""}/>
</FormControl> </FormControl>
<FormMessage/> <FormMessage/>
</FormItem> </FormItem>
@@ -58,7 +58,7 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
name="config.password" name="config.password"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>Password</FormLabel> <FormLabel>Password *</FormLabel>
<FormControl> <FormControl>
<PasswordInput <PasswordInput
{...field} {...field}
@@ -75,9 +75,9 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
name="config.from" name="config.from"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>From Email</FormLabel> <FormLabel>From Email *</FormLabel>
<FormControl> <FormControl>
<Input placeholder={`"Portabase" <example@portabase.io>`} {...field} <Input placeholder={`e.g. "Portabase" <noreply@example.com>`} {...field}
value={field.value ?? ""}/> value={field.value ?? ""}/>
</FormControl> </FormControl>
<FormMessage/> <FormMessage/>
@@ -90,9 +90,9 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
name="config.to" name="config.to"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>To Email</FormLabel> <FormLabel>To Email *</FormLabel>
<FormControl> <FormControl>
<Input placeholder={"contact@portabase.io, contact2@portabase.io"} {...field} <Input placeholder={"e.g. alerts@example.com, team@example.com"} {...field}
value={field.value ?? ""}/> value={field.value ?? ""}/>
</FormControl> </FormControl>
<FormMessage/> <FormMessage/>
@@ -102,4 +102,4 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
</> </>
) )
} }
@@ -23,11 +23,11 @@ export const NotifierTelegramForm = ({ form }: NotifierTelegramFormProps) => {
name="config.telegramBotToken" name="config.telegramBotToken"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Telegram Bot Token</FormLabel> <FormLabel>Telegram Bot Token *</FormLabel>
<FormControl> <FormControl>
<PasswordInput <PasswordInput
{...field} {...field}
placeholder="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11" placeholder="e.g. 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
/> />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
@@ -39,9 +39,9 @@ export const NotifierTelegramForm = ({ form }: NotifierTelegramFormProps) => {
name="config.telegramChatId" name="config.telegramChatId"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Telegram Chat ID</FormLabel> <FormLabel>Telegram Chat ID *</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="-100123456789 or 123456789" /> <Input {...field} placeholder="e.g. -100123456789 or 123456789" />
</FormControl> </FormControl>
<p className="text-xs text-muted-foreground"> <p className="text-xs text-muted-foreground">
You must start the conversation with the bot first ( You must start the conversation with the bot first (
@@ -69,7 +69,7 @@ export const NotifierTelegramForm = ({ form }: NotifierTelegramFormProps) => {
<FormItem> <FormItem>
<FormLabel>Telegram Topic ID</FormLabel> <FormLabel>Telegram Topic ID</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="123456" /> <Input {...field} placeholder="e.g. 123456" />
</FormControl> </FormControl>
<p className="text-xs text-muted-foreground"> <p className="text-xs text-muted-foreground">
Unique identifier for the target message thread (topic) of the Unique identifier for the target message thread (topic) of the
@@ -23,9 +23,9 @@ export const NotifierWebhookForm = ({ form }: NotifierWebhookFormProps) => {
name="config.webhookUrl" name="config.webhookUrl"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Webhook URL</FormLabel> <FormLabel>Webhook URL *</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="https://example.com/api/webhook" /> <Input {...field} placeholder="e.g. https://example.com/api/webhook" />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@@ -38,9 +38,9 @@ export const NotifierWebhookForm = ({ form }: NotifierWebhookFormProps) => {
name="config.webhookSecretHeader" name="config.webhookSecretHeader"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Header Name (Optional)</FormLabel> <FormLabel>Header Name</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="X-Webhook-Secret" /> <Input {...field} placeholder="e.g. X-Webhook-Secret" />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@@ -53,9 +53,9 @@ export const NotifierWebhookForm = ({ form }: NotifierWebhookFormProps) => {
name="config.webhookSecret" name="config.webhookSecret"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Secret Value (Optional)</FormLabel> <FormLabel>Secret Value</FormLabel>
<FormControl> <FormControl>
<PasswordInput {...field} placeholder="Secret value..." /> <PasswordInput {...field} placeholder="e.g. webhook-secret" />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@@ -96,9 +96,9 @@ export const StorageGoogleDriveForm = ({form}: StorageGoogleDriveFormProps) => {
name="config.clientId" name="config.clientId"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>Client ID</FormLabel> <FormLabel>Client ID *</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="xxxx.apps.googleusercontent.com"/> <Input {...field} placeholder="e.g. xxxx.apps.googleusercontent.com"/>
</FormControl> </FormControl>
<FormMessage/> <FormMessage/>
</FormItem> </FormItem>
@@ -110,7 +110,7 @@ export const StorageGoogleDriveForm = ({form}: StorageGoogleDriveFormProps) => {
name="config.clientSecret" name="config.clientSecret"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>Client Secret</FormLabel> <FormLabel>Client Secret *</FormLabel>
<FormControl> <FormControl>
<PasswordInput {...field} /> <PasswordInput {...field} />
</FormControl> </FormControl>
@@ -124,9 +124,9 @@ export const StorageGoogleDriveForm = ({form}: StorageGoogleDriveFormProps) => {
name="config.folderId" name="config.folderId"
render={({field}) => ( render={({field}) => (
<FormItem> <FormItem>
<FormLabel>Folder ID</FormLabel> <FormLabel>Folder ID *</FormLabel>
<FormControl> <FormControl>
<Input {...field} /> <Input {...field} placeholder="e.g. 1AbCdEfGhIjKlMnOpQrStUvWxYz"/>
</FormControl> </FormControl>
<FormMessage/> <FormMessage/>
</FormItem> </FormItem>
@@ -24,9 +24,9 @@ export const StorageS3Form = ({ form }: StorageS3FormProps) => {
name="config.endPointUrl" name="config.endPointUrl"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Endpoint URL</FormLabel> <FormLabel>Endpoint URL *</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="s3.amazonaws.com" /> <Input {...field} placeholder="e.g. s3.amazonaws.com" />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@@ -39,7 +39,7 @@ export const StorageS3Form = ({ form }: StorageS3FormProps) => {
<FormItem> <FormItem>
<FormLabel>Region</FormLabel> <FormLabel>Region</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="us-east-1" /> <Input {...field} placeholder="e.g. us-east-1" />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@@ -50,9 +50,9 @@ export const StorageS3Form = ({ form }: StorageS3FormProps) => {
name="config.accessKey" name="config.accessKey"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Access Key</FormLabel> <FormLabel>Access Key *</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="A1b2C3d4E5f6G7h" /> <Input {...field} placeholder="e.g. AKIA..." />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@@ -63,9 +63,9 @@ export const StorageS3Form = ({ form }: StorageS3FormProps) => {
name="config.secretKey" name="config.secretKey"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Secret Key</FormLabel> <FormLabel>Secret Key *</FormLabel>
<FormControl> <FormControl>
<PasswordInput {...field} placeholder="A1b2C3d4E5f6G7h" /> <PasswordInput {...field} placeholder="e.g. s3-secret-key" />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@@ -76,9 +76,9 @@ export const StorageS3Form = ({ form }: StorageS3FormProps) => {
name="config.bucketName" name="config.bucketName"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Bucket name</FormLabel> <FormLabel>Bucket name *</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="portabase-dev" /> <Input {...field} placeholder="e.g. backups-prod" />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@@ -91,7 +91,7 @@ export const StorageS3Form = ({ form }: StorageS3FormProps) => {
<FormItem> <FormItem>
<FormLabel>Port</FormLabel> <FormLabel>Port</FormLabel>
<FormControl> <FormControl>
<Input {...field} type="number" placeholder="443" /> <Input {...field} type="number" placeholder="e.g. 443" />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@@ -6,6 +6,7 @@ export const EmailFormSchema = z.object({
smtpHost: z.string(), smtpHost: z.string(),
smtpPort: z.string(), smtpPort: z.string(),
smtpUser: z.string(), smtpUser: z.string(),
smtpSecure: z.boolean()
}); });
export type EmailFormType = z.infer<typeof EmailFormSchema>; export type EmailFormType = z.infer<typeof EmailFormSchema>;
@@ -30,6 +30,7 @@ import {render} from "@react-email/components";
import EmailSettingsTest from "@/components/emails/email-settings-test"; import EmailSettingsTest from "@/components/emails/email-settings-test";
import {ButtonWithLoading} from "@/components/wrappers/common/button/button-with-loading"; import {ButtonWithLoading} from "@/components/wrappers/common/button/button-with-loading";
import {Send} from "lucide-react"; import {Send} from "lucide-react";
import {Switch} from "@/components/ui/switch";
export type EmailFormProps = { export type EmailFormProps = {
defaultValues?: EmailFormType; defaultValues?: EmailFormType;
@@ -178,6 +179,23 @@ export const EmailForm = (props: EmailFormProps) => {
</FormItem> </FormItem>
)} )}
/> />
<FormField
control={form.control}
name="smtpSecure"
render={({field}) => (
<FormItem>
<FormLabel>Secure</FormLabel>
<FormControl>
<Switch
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
<FormMessage/>
</FormItem>
)}
/>
<div className="flex justify-between gap-4"> <div className="flex justify-between gap-4">
{props.defaultValues?.smtpFrom && ( {props.defaultValues?.smtpFrom && (
<Tooltip> <Tooltip>
@@ -28,7 +28,7 @@ export const LoggedInButtonClient = ({ user, sessions, currentSession, accounts,
accounts={accounts} accounts={accounts}
providers={providers} providers={providers}
> >
<SidebarMenuButton type="button" className="h-auto justify-between py-2"> <SidebarMenuButton type="button" className="h-auto justify-between py-2" data-testid="profile-dropdown">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Avatar className="size-6"> <Avatar className="size-6">
<AvatarFallback>{user.name[0].toUpperCase()}</AvatarFallback> <AvatarFallback>{user.name[0].toUpperCase()}</AvatarFallback>
@@ -16,7 +16,7 @@ import {UpdateNotification} from "@/features/updates/components/update-notificat
export function AppSidebar() { export function AppSidebar() {
const projectName = env.PROJECT_NAME; const projectName = env.PROJECT_NAME;
return ( return (
<Sidebar collapsible="icon" > <Sidebar collapsible="icon">
<SidebarHeader> <SidebarHeader>
<SidebarMenu> <SidebarMenu>
<SidebarMenuItem> <SidebarMenuItem>
@@ -32,8 +32,8 @@ export function AppSidebar() {
<SidebarMenuCustomMain/> <SidebarMenuCustomMain/>
</SidebarContent> </SidebarContent>
<UpdateNotification /> <UpdateNotification/>
<SidebarMenu className="mb-2"> <SidebarMenu className="mb-2">
<SidebarMenuItem className="p-2"> <SidebarMenuItem className="p-2">
<LoggedInButton/> <LoggedInButton/>
@@ -38,7 +38,7 @@ export const ImportModal = ({database}: ImportModalProps) => {
<Separator className="mt-3 "/> <Separator className="mt-3 "/>
<UploadBackupZone <UploadBackupZone
onSuccessAction={() => setOpen(false)} onSuccessAction={() => setOpen(false)}
databaseId={database.id}/> database={database}/>
</DialogHeader> </DialogHeader>
</DialogContent> </DialogContent>
</Dialog> </Dialog>
@@ -9,13 +9,15 @@ import {ButtonWithLoading} from "@/components/wrappers/common/button/button-with
import {toast} from "sonner"; import {toast} from "sonner";
import {uploadBackupAction} from "@/components/wrappers/dashboard/database/import/upload-backup.action"; import {uploadBackupAction} from "@/components/wrappers/dashboard/database/import/upload-backup.action";
import {Card, CardContent} from "@/components/ui/card"; import {Card, CardContent} from "@/components/ui/card";
import {DatabaseWith} from "@/db/schema/07_database";
import {getFileHeadersBasedOnDbms} from "@/utils/common";
type UploadRetentionZoneProps = { type UploadRetentionZoneProps = {
onSuccessAction?: () => void; onSuccessAction?: () => void;
databaseId: string; database: DatabaseWith;
}; };
export const UploadBackupZone = ({onSuccessAction, databaseId}: UploadRetentionZoneProps) => { export const UploadBackupZone = ({onSuccessAction, database}: UploadRetentionZoneProps) => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const router = useRouter(); const router = useRouter();
@@ -30,7 +32,7 @@ export const UploadBackupZone = ({onSuccessAction, databaseId}: UploadRetentionZ
const formData = new FormData(); const formData = new FormData();
formData.append("file", file); formData.append("file", file);
formData.append("databaseId", databaseId); formData.append("databaseId", database.id);
const result = await uploadBackupAction(formData) const result = await uploadBackupAction(formData)
@@ -38,7 +40,7 @@ export const UploadBackupZone = ({onSuccessAction, databaseId}: UploadRetentionZ
if (inner?.success) { if (inner?.success) {
toast.success(inner.actionSuccess?.message); toast.success(inner.actionSuccess?.message);
onSuccessAction?.() onSuccessAction?.()
queryClient.invalidateQueries({queryKey: ["database-data", databaseId]}); queryClient.invalidateQueries({queryKey: ["database-data", database.id]});
router.refresh(); router.refresh();
} else { } else {
toast.error(inner?.actionError?.message); toast.error(inner?.actionError?.message);
@@ -47,19 +49,20 @@ export const UploadBackupZone = ({onSuccessAction, databaseId}: UploadRetentionZ
console.error(err); console.error(err);
toast.error("An error occurred while upload in the backup"); toast.error("An error occurred while upload in the backup");
} finally { } finally {
queryClient.invalidateQueries({queryKey: ["database-data", databaseId]}); queryClient.invalidateQueries({queryKey: ["database-data", database.id]});
setIsProcessing(false); setIsProcessing(false);
} }
}, },
}); });
const acceptDbImportFiles: Record<string, string[]> = { const acceptDbImportFiles = getFileHeadersBasedOnDbms(database.dbms)
"application/sql": [".sql"], console.log(acceptDbImportFiles)
"application/x-sql": [".sql"],
"text/plain": [".sql"], const fileKindDescription = Object.values(acceptDbImportFiles)
"application/octet-stream": [".dump"], .flat()
}; .join(", ");
return ( return (
<> <>
@@ -67,11 +70,11 @@ export const UploadBackupZone = ({onSuccessAction, databaseId}: UploadRetentionZ
<UploadLoader label="Uploading database backup…"/> <UploadLoader label="Uploading database backup…"/>
) : ( ) : (
<DropZoneFile <DropZoneFile
accept={acceptDbImportFiles} accept={getFileHeadersBasedOnDbms(database.dbms)}
maxSize={2 * 1024 * 1024 * 1024} maxSize={2 * 1024 * 1024 * 1024}
maxFiles={1} maxFiles={1}
description="Import database backup" description="Import database backup"
fileKind="Database file (.sql, .dump)" fileKind={`Database file (${fileKindDescription})`}
dragMessage="Click or drag a database dump here" dragMessage="Click or drag a database dump here"
onFileDropAction={(file: File) => setFile(file)} onFileDropAction={(file: File) => setFile(file)}
/> />
@@ -86,8 +89,6 @@ export const UploadBackupZone = ({onSuccessAction, databaseId}: UploadRetentionZ
</ButtonWithLoading> </ButtonWithLoading>
</div> </div>
)} )}
</> </>
); );
}; };
@@ -45,7 +45,7 @@ export function CreateOrganizationModal({
onOpenChange(false); onOpenChange(false);
await authClient.organization.setActive({organizationSlug: result.data.value.slug}); await authClient.organization.setActive({organizationSlug: result.data.value.slug});
onSuccess?.(); onSuccess?.();
toast.success(result.data.actionSuccess?.message || "Organization Created."); toast.success(result.data.actionSuccess?.message);
form.reset() form.reset()
router.replace(redirect); router.replace(redirect);
} else { } else {
@@ -64,8 +64,8 @@ export function OrganizationCombobox() {
onSuccess={handleReload} onSuccess={handleReload}
onOpenChange={setOpenModal} onOpenChange={setOpenModal}
/> />
<DropdownMenu open={isOpen} onOpenChange={setIsOpen}> <DropdownMenu open={isOpen} onOpenChange={setIsOpen} >
<DropdownMenuTrigger asChild> <DropdownMenuTrigger data-testid="organization-dropdown" asChild>
<SidebarMenuButton <SidebarMenuButton
size="lg" size="lg"
className={cn( className={cn(
@@ -0,0 +1 @@
ALTER TYPE "public"."dbms_status" ADD VALUE 'firebird';
File diff suppressed because it is too large Load Diff
+7
View File
@@ -337,6 +337,13 @@
"when": 1774768062658, "when": 1774768062658,
"tag": "0047_wet_carnage", "tag": "0047_wet_carnage",
"breakpoints": true "breakpoints": true
},
{
"idx": 48,
"version": "7",
"when": 1774886139855,
"tag": "0048_yellow_eddie_brock",
"breakpoints": true
} }
] ]
} }
+1 -1
View File
@@ -2,7 +2,7 @@ import {pgEnum} from "drizzle-orm/pg-core";
import {createSelectSchema} from "drizzle-zod"; import {createSelectSchema} from "drizzle-zod";
import {z} from "zod"; import {z} from "zod";
export const dbmsEnum = pgEnum("dbms_status", ["postgresql", "mysql", "mariadb", "mongodb", "sqlite", "redis", "valkey"]); export const dbmsEnum = pgEnum("dbms_status", ["postgresql", "mysql", "mariadb", "mongodb", "sqlite", "redis", "valkey", "firebird"]);
export const statusEnum = pgEnum("status", ["waiting", "ongoing", "failed", "success"]); export const statusEnum = pgEnum("status", ["waiting", "ongoing", "failed", "success"]);
export const typeStorageEnum = pgEnum("type_storage", ["local", "s3"]); export const typeStorageEnum = pgEnum("type_storage", ["local", "s3"]);
+10 -1
View File
@@ -20,12 +20,19 @@ export const env = createEnv({
.regex(/^https?:\/\//, "URL must start with http:// or https://"), .regex(/^https?:\/\//, "URL must start with http:// or https://"),
PROJECT_SECRET: z.string(), PROJECT_SECRET: z.string(),
TRUSTED_DOMAINS: z.string().optional(),
SMTP_PASSWORD: z.string().optional(), SMTP_PASSWORD: z.string().optional(),
SMTP_FROM: z.string().optional(), SMTP_FROM: z.string().optional(),
SMTP_HOST: z.string().optional(), SMTP_HOST: z.string().optional(),
SMTP_PORT: z.string().optional(), SMTP_PORT: z.string().optional(),
SMTP_USER: z.string().optional(), SMTP_USER: z.string().optional(),
SMTP_SECURE: z.coerce.boolean().default(true),
SMTP_SECURE: z
.enum(["true", "false"])
.transform((val) => val === "true")
.default("true"),
AUTH_GOOGLE_ID: z.string().optional(), AUTH_GOOGLE_ID: z.string().optional(),
AUTH_GOOGLE_SECRET: z.string().optional(), AUTH_GOOGLE_SECRET: z.string().optional(),
@@ -101,6 +108,8 @@ export const env = createEnv({
DATABASE_URL: process.env.DATABASE_URL, DATABASE_URL: process.env.DATABASE_URL,
TRUSTED_DOMAINS: process.env.TRUSTED_DOMAINS,
SMTP_PASSWORD: process.env.SMTP_PASSWORD, SMTP_PASSWORD: process.env.SMTP_PASSWORD,
SMTP_FROM: process.env.SMTP_FROM, SMTP_FROM: process.env.SMTP_FROM,
SMTP_HOST: process.env.SMTP_HOST, SMTP_HOST: process.env.SMTP_HOST,
+42 -14
View File
@@ -455,19 +455,29 @@ export const auth = betterAuth({
const deviceInfo = getDeviceDetails(session.userAgent); const deviceInfo = getDeviceDetails(session.userAgent);
await sendEmail({
to: user.email, try {
subject: "New login to your account", await sendEmail({
html: await render( to: user.email,
EmailNewLogin({ subject: "New login to your account",
firstname: user.name!, html: await render(
os: deviceInfo.os, EmailNewLogin({
browser: deviceInfo.browser, firstname: user.name!,
ipAddress: session.ipAddress!, os: deviceInfo.os,
}), browser: deviceInfo.browser,
{}, ipAddress: session.ipAddress!,
), }),
}); {},
),
});
} catch (error) {
console.log("sendEmail failed", {
userId: user.id,
details: "Please Check your env variables or system config",
email: user.email,
error,
});
}
(await auth.$context).internalAdapter.updateUser(user.id, { (await auth.$context).internalAdapter.updateUser(user.id, {
lastConnectedAt: new Date(), lastConnectedAt: new Date(),
@@ -516,9 +526,27 @@ export const auth = betterAuth({
}, },
}, },
},*/ },*/
trustedOrigins: [env.PROJECT_URL!, "http://app"], // trustedOrigins: [env.PROJECT_URL!, "http://app"],
trustedOrigins: async (request) => {
const trustedOrigins = await queryTrustedDomains();
return trustedOrigins;
}
}); });
const queryTrustedDomains = async (): Promise<string[]> => {
const envDomains = env.TRUSTED_DOMAINS || "";
const domains = envDomains
.split(",")
.map((d) => d.trim())
.filter(Boolean);
if (env.PROJECT_URL) domains.push(env.PROJECT_URL);
domains.push("http://app")
return domains;
};
/*export const signUpUser = async (email: string, password: string, name: string) => { /*export const signUpUser = async (email: string, password: string, name: string) => {
const user = await auth.api.signUpEmail({ const user = await auth.api.signUpEmail({
body: { body: {
+37 -3
View File
@@ -17,7 +17,7 @@ export function buildOrganizationWithMembers(
const org = rows[0].organization; const org = rows[0].organization;
const invitations : OrganizationInvitation[] = rows const invitations: OrganizationInvitation[] = rows
.filter(r => r.invitation) .filter(r => r.invitation)
.map(r => ({ .map(r => ({
...r.invitation!, ...r.invitation!,
@@ -38,7 +38,6 @@ export function buildOrganizationWithMembers(
} }
export function getFileExtension(dbType: string) { export function getFileExtension(dbType: string) {
switch (dbType) { switch (dbType) {
case "postgresql": case "postgresql":
@@ -48,4 +47,39 @@ export function getFileExtension(dbType: string) {
default: default:
return ".dump"; return ".dump";
} }
} }
export function getFileHeadersBasedOnDbms(dbType: string): Record<string, string[]> {
switch (dbType) {
case "postgresql":
return {
"application/octet-stream": [".dump"],
};
case "mysql":
case "mariadb":
return {
"application/sql": [".sql"],
"application/x-sql": [".sql"],
};
case "mongodb":
return {
"application/gzip": [".archive.gz"],
};
case "firebird":
return {
"application/octet-stream": [".fbk"],
};
case "valkey":
case "redis":
return {
"application/octet-stream": [".rdb"],
};
case "sqlite":
return {
"application/octet-stream": [".backup"],
};
default:
throw new Error(`Unsupported database type: ${dbType}`);
}
}
+1
View File
@@ -48,6 +48,7 @@ async function setupCronJobs() {
async function createSettingsIfNotExist() { async function createSettingsIfNotExist() {
await db.transaction(async (tx) => { await db.transaction(async (tx) => {
const systemSettingsValues = { const systemSettingsValues = {
name: "system", name: "system",
smtpPassword: env.SMTP_PASSWORD ?? null, smtpPassword: env.SMTP_PASSWORD ?? null,