mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db9d23b5ec | ||
|
|
47c74931d4 | ||
|
|
be01031501 | ||
|
|
2e656d9c41 | ||
|
|
9071193c4d | ||
|
|
27e1da6363 | ||
|
|
e02c5496ae | ||
|
|
3fee236fd0 | ||
|
|
78ba42239d | ||
|
|
8ffb672e26 | ||
|
|
83ddc934ba | ||
|
|
31cbd52703 | ||
|
|
dd85f7a25d |
@@ -58,3 +58,6 @@ AUTH_PASSKEY_ENABLED=true
|
||||
|
||||
# Retention
|
||||
RETENTION_CRON="* * * * *"
|
||||
|
||||
TRUSTED_DOMAINS="http://localhost:8887, http://localhost:3055, http://localhost:3056"
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ on:
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -57,12 +58,51 @@ jobs:
|
||||
exit 1
|
||||
|
||||
- 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
|
||||
run: pnpm exec playwright test --project chromium
|
||||
run: pnpm exec playwright test
|
||||
env:
|
||||
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
|
||||
if: failure()
|
||||
|
||||
@@ -9,7 +9,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: aquasecurity/trivy-action@0.35.0
|
||||
- uses: aquasecurity/trivy-action@v0.35.0
|
||||
with:
|
||||
scan-type: 'fs'
|
||||
format: 'table'
|
||||
|
||||
@@ -54,3 +54,4 @@ certificates
|
||||
/blob-report/
|
||||
/playwright/.cache/
|
||||
/playwright/.auth/
|
||||
/e2e/local-storage.json
|
||||
|
||||
+1
-1
@@ -31,5 +31,5 @@ keywords:
|
||||
- web-ui
|
||||
- agent
|
||||
license: Apache-2.0
|
||||
version: 1.9.4
|
||||
version: 1.11.2
|
||||
date-released: '2026-03-02'
|
||||
|
||||
@@ -46,3 +46,17 @@ export-keycloak:
|
||||
@docker rm -f kc-exporter >/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"
|
||||
|
||||
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."
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
[](LICENSE)
|
||||
[](https://hub.docker.com/r/portabase/portabase)
|
||||
[](https://github.com/Portabase/portabase/pkgs/container/charts%2Fportabase)
|
||||
[](https://github.com/Portabase/portabase)
|
||||
[](https://www.buymeacoffee.com/portabase)
|
||||
|
||||
@@ -21,8 +22,10 @@
|
||||
[](https://mariadb.org/)
|
||||
[](https://sqlite.org/)
|
||||
[](https://redis.io/)
|
||||
[](https://valkey.io/)
|
||||
[](https://www.mongodb.com/)
|
||||
[](https://valkey.io/)
|
||||
[](https://firebirdsql.org/)
|
||||
|
||||
[](https://github.com/Portabase/portabase)
|
||||
[](https://github.com/Portabase/portabase)
|
||||
|
||||
@@ -62,16 +65,17 @@ You have 4 ways to install Portabase:
|
||||
|
||||
## Supported databases
|
||||
|
||||
| Engine | Support | Supported Versions | Restore |
|
||||
|:-------------------|:----------|:----------------------------------|:--------|
|
||||
| **PostgreSQL** | ✅ Stable | 12, 13, 14, 15, 16, 17 et 18 | Yes |
|
||||
| **MySQL** | ✅ Stable | 5.7, 8 et 9 | Yes |
|
||||
| **MariaDB** | ✅ Stable | 10 et 11 | Yes |
|
||||
| **MongoDB** | ✅ Stable | 4, 5, 6, 7 et 8 | Yes |
|
||||
| **SQLite** | ✅ Stable | 3.x | Yes |
|
||||
| **Redis** | ✅ Stable | 2.8+ | No |
|
||||
| **Valkey** | ✅ Stable | 7.2+ | No |
|
||||
| **MSSQL Server** | ❌ Ongoing | - | Yes |
|
||||
| Engine | Support | Supported Versions | Restore |
|
||||
|:-------------------|:-----------|:------------------------------|:--------|
|
||||
| **PostgreSQL** | ✅ Stable | 12, 13, 14, 15, 16, 17 and 18 | Yes |
|
||||
| **MySQL** | ✅ Stable | 5.7, 8 and 9 | Yes |
|
||||
| **MariaDB** | ✅ Stable | 10 and 11 | Yes |
|
||||
| **MongoDB** | ✅ Stable | 4, 5, 6, 7 and 8 | Yes |
|
||||
| **SQLite** | ✅ Stable | 3.x | Yes |
|
||||
| **Redis** | ✅ Stable | 2.8+ | No |
|
||||
| **Valkey** | ✅ Stable | 7.2+ | No |
|
||||
| **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.
|
||||
|
||||
|
||||
@@ -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:
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
@@ -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
@@ -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 = {
|
||||
username: string
|
||||
email: string
|
||||
password: string
|
||||
}
|
||||
test.use({storageState: LOCAL_STORAGE_PATH})
|
||||
|
||||
|
||||
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.describe.serial( () => {
|
||||
|
||||
test('Redirect to login if not connected', async ({page}) => {
|
||||
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}) => {
|
||||
@@ -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 expect(page).toHaveURL('/login')
|
||||
await expect(page).toHaveURL('/login', {timeout: TIMEOUT})
|
||||
})
|
||||
|
||||
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 expect(page).toHaveURL('login')
|
||||
await expect(page).toHaveURL('/login', {timeout: TIMEOUT})
|
||||
})
|
||||
|
||||
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}) => {
|
||||
await page.goto('login')
|
||||
await page.goto('/login')
|
||||
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')
|
||||
// })
|
||||
@@ -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(?:\?.*)?$/);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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",
|
||||
},
|
||||
]);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export const LOCAL_STORAGE_PATH = "./e2e/local-storage.json";
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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 () => {
|
||||
});
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "portabase",
|
||||
"version": "1.9.4",
|
||||
"version": "1.11.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev --turbopack -p 8887",
|
||||
@@ -125,8 +125,9 @@
|
||||
"eslint": "^9.39.4",
|
||||
"eslint-config-next": "^16.2.1",
|
||||
"eslint-plugin-tailwindcss": "^3.18.2",
|
||||
"framer-motion": "^12.38.0",
|
||||
"postcss": "^8.5.8",
|
||||
"framer-motion": "^12.34.3",
|
||||
"node-pty": "^1.1.0",
|
||||
"postcss": "^8.5.6",
|
||||
"release-it": "^19.2.4",
|
||||
"tailwindcss": "^4.2.2",
|
||||
"tsx": "^4.21.0",
|
||||
|
||||
+46
-46
@@ -1,12 +1,12 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
import dotenv from 'dotenv';
|
||||
import path from 'path';
|
||||
|
||||
/**
|
||||
* Read environment variables from file.
|
||||
* https://github.com/motdotla/dotenv
|
||||
*/
|
||||
// import dotenv from 'dotenv';
|
||||
// import path from 'path';
|
||||
// dotenv.config({ path: path.resolve(__dirname, '.env') });
|
||||
dotenv.config({ path: path.resolve(__dirname, '.env') });
|
||||
|
||||
/**
|
||||
* See https://playwright.dev/docs/test-configuration.
|
||||
@@ -25,55 +25,55 @@ export default defineConfig({
|
||||
reporter: 'html',
|
||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||
use: {
|
||||
/* Base URL to use in actions like `await page.goto('')`. */
|
||||
...devices['Desktop Chrome'],
|
||||
baseURL: process.env.PROJECT_URL,
|
||||
|
||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||
trace: 'on-first-retry',
|
||||
},
|
||||
|
||||
/* Configure projects for major browsers */
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
/* Configure projects and dependency order */
|
||||
projects: [
|
||||
{
|
||||
name: 'setup',
|
||||
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',
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
},
|
||||
{
|
||||
name: 'project',
|
||||
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,
|
||||
// },
|
||||
});
|
||||
|
||||
Generated
+703
-520
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
||||
ignoredBuiltDependencies:
|
||||
- node-pty
|
||||
onlyBuiltDependencies:
|
||||
- '@prisma/client'
|
||||
- '@prisma/engines'
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 125 KiB |
@@ -37,6 +37,7 @@ export function SocialAuthButtons({ providers }: { providers: AuthProviderConfig
|
||||
providerType: "oidc",
|
||||
callbackURL: "/dashboard",
|
||||
});
|
||||
console.log(result);
|
||||
} else {
|
||||
result = await authClient.signIn.social({
|
||||
// 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) {
|
||||
|
||||
+2
-3
@@ -202,9 +202,9 @@ export const ChannelForm = ({onSuccessAction, organization, defaultValues, kind}
|
||||
name="name"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Channel Name</FormLabel>
|
||||
<FormLabel>Channel Name *</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder={`My ${selectedProviderDetails?.label} Channel`}
|
||||
<Input {...field} placeholder={`e.g. ${selectedProviderDetails?.label} Channel`}
|
||||
value={field.value ?? ""}/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
@@ -252,4 +252,3 @@ export const ChannelForm = ({onSuccessAction, organization, defaultValues, kind}
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -22,11 +22,11 @@ export const NotifierDiscordForm = ({ form }: NotifierDiscordFormProps) => {
|
||||
name="config.discordWebhook"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Discord Webhook URL</FormLabel>
|
||||
<FormLabel>Discord Webhook URL *</FormLabel>
|
||||
<FormControl>
|
||||
<PasswordInput
|
||||
{...field}
|
||||
placeholder="https://discord.com/api/webhooks/..."
|
||||
placeholder="e.g. https://discord.com/api/webhooks/..."
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
|
||||
+4
-4
@@ -23,9 +23,9 @@ export const NotifierGotifyForm = ({ form }: NotifierGotifyFormProps) => {
|
||||
name="config.gotifyServerUrl"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Gotify Server URL</FormLabel>
|
||||
<FormLabel>Gotify Server URL *</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="https://gotify.example.com" />
|
||||
<Input {...field} placeholder="e.g. https://gotify.example.com" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -36,9 +36,9 @@ export const NotifierGotifyForm = ({ form }: NotifierGotifyFormProps) => {
|
||||
name="config.gotifyAppToken"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Application Token</FormLabel>
|
||||
<FormLabel>Application Token *</FormLabel>
|
||||
<FormControl>
|
||||
<PasswordInput {...field} placeholder="A1b2C3d4E5f6G7h" />
|
||||
<PasswordInput {...field} placeholder="e.g. gotify-app-token" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
||||
+10
-10
@@ -18,9 +18,9 @@ export const NotifierNtfyForm = ({form}: NotifierNtfyFormProps) => {
|
||||
name="config.ntfyTopic"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Topic Name</FormLabel>
|
||||
<FormLabel>Topic Name *</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="my-secret-topic"/>
|
||||
<Input {...field} placeholder="e.g. team-alerts"/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
@@ -32,9 +32,9 @@ export const NotifierNtfyForm = ({form}: NotifierNtfyFormProps) => {
|
||||
name="config.ntfyServerUrl"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Server URL (Optional)</FormLabel>
|
||||
<FormLabel>Server URL</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="https://ntfy.sh (default)"/>
|
||||
<Input {...field} placeholder="e.g. https://ntfy.example.com"/>
|
||||
</FormControl>
|
||||
<p className="text-xs text-muted-foreground">Leave empty to use the official ntfy.sh server.</p>
|
||||
<FormMessage/>
|
||||
@@ -47,9 +47,9 @@ export const NotifierNtfyForm = ({form}: NotifierNtfyFormProps) => {
|
||||
name="config.ntfyToken"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Access Token (Optional)</FormLabel>
|
||||
<FormLabel>Access Token</FormLabel>
|
||||
<FormControl>
|
||||
<PasswordInput {...field} placeholder="tk_..."/>
|
||||
<PasswordInput {...field} placeholder="e.g. tk_xxxxx"/>
|
||||
</FormControl>
|
||||
<p className="text-xs text-muted-foreground">Only required for protected topics or self-hosted instances with auth.</p>
|
||||
<FormMessage/>
|
||||
@@ -64,9 +64,9 @@ export const NotifierNtfyForm = ({form}: NotifierNtfyFormProps) => {
|
||||
name="config.ntfyUsername"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Basic Auth Username (Optional)</FormLabel>
|
||||
<FormLabel>Basic Auth Username</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="username"/>
|
||||
<Input {...field} placeholder="e.g. notifier-user"/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
@@ -78,9 +78,9 @@ export const NotifierNtfyForm = ({form}: NotifierNtfyFormProps) => {
|
||||
name="config.ntfyPassword"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Basic Auth Password (Optional)</FormLabel>
|
||||
<FormLabel>Basic Auth Password</FormLabel>
|
||||
<FormControl>
|
||||
<PasswordInput placeholder="password" {...field} />
|
||||
<PasswordInput placeholder="e.g. notifier-password" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
|
||||
+2
-2
@@ -22,11 +22,11 @@ export const NotifierSlackForm = ({ form }: NotifierSmtpFormProps) => {
|
||||
name="config.slackWebhook"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Slack Webhook URL</FormLabel>
|
||||
<FormLabel>Slack Webhook URL *</FormLabel>
|
||||
<FormControl>
|
||||
<PasswordInput
|
||||
{...field}
|
||||
placeholder="https://hooks.slack.com/services/..."
|
||||
placeholder="e.g. https://hooks.slack.com/services/..."
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
|
||||
+12
-12
@@ -19,9 +19,9 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
|
||||
name="config.host"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>SMTP Host</FormLabel>
|
||||
<FormLabel>SMTP Host *</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="smtp.gmail.com" {...field} value={field.value ?? ""}/>
|
||||
<Input placeholder="e.g. smtp.example.com" {...field} value={field.value ?? ""}/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
@@ -32,9 +32,9 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
|
||||
name="config.port"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>SMTP Port</FormLabel>
|
||||
<FormLabel>SMTP Port *</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="456" type="number" {...field} value={field.value ?? ""}/>
|
||||
<Input placeholder="e.g. 587" type="number" {...field} value={field.value ?? ""}/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
@@ -45,9 +45,9 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
|
||||
name="config.user"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Username</FormLabel>
|
||||
<FormLabel>Username *</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="contact@example.com" {...field} value={field.value ?? ""}/>
|
||||
<Input placeholder="e.g. noreply@example.com" {...field} value={field.value ?? ""}/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
@@ -58,7 +58,7 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
|
||||
name="config.password"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Password</FormLabel>
|
||||
<FormLabel>Password *</FormLabel>
|
||||
<FormControl>
|
||||
<PasswordInput
|
||||
{...field}
|
||||
@@ -75,9 +75,9 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
|
||||
name="config.from"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>From Email</FormLabel>
|
||||
<FormLabel>From Email *</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={`"Portabase" <example@portabase.io>`} {...field}
|
||||
<Input placeholder={`e.g. "Portabase" <noreply@example.com>`} {...field}
|
||||
value={field.value ?? ""}/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
@@ -90,9 +90,9 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
|
||||
name="config.to"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>To Email</FormLabel>
|
||||
<FormLabel>To Email *</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={"contact@portabase.io, contact2@portabase.io"} {...field}
|
||||
<Input placeholder={"e.g. alerts@example.com, team@example.com"} {...field}
|
||||
value={field.value ?? ""}/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
@@ -102,4 +102,4 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
|
||||
|
||||
</>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -23,11 +23,11 @@ export const NotifierTelegramForm = ({ form }: NotifierTelegramFormProps) => {
|
||||
name="config.telegramBotToken"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Telegram Bot Token</FormLabel>
|
||||
<FormLabel>Telegram Bot Token *</FormLabel>
|
||||
<FormControl>
|
||||
<PasswordInput
|
||||
{...field}
|
||||
placeholder="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
|
||||
placeholder="e.g. 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
@@ -39,9 +39,9 @@ export const NotifierTelegramForm = ({ form }: NotifierTelegramFormProps) => {
|
||||
name="config.telegramChatId"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Telegram Chat ID</FormLabel>
|
||||
<FormLabel>Telegram Chat ID *</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="-100123456789 or 123456789" />
|
||||
<Input {...field} placeholder="e.g. -100123456789 or 123456789" />
|
||||
</FormControl>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
You must start the conversation with the bot first (
|
||||
@@ -69,7 +69,7 @@ export const NotifierTelegramForm = ({ form }: NotifierTelegramFormProps) => {
|
||||
<FormItem>
|
||||
<FormLabel>Telegram Topic ID</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="123456" />
|
||||
<Input {...field} placeholder="e.g. 123456" />
|
||||
</FormControl>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Unique identifier for the target message thread (topic) of the
|
||||
|
||||
+6
-6
@@ -23,9 +23,9 @@ export const NotifierWebhookForm = ({ form }: NotifierWebhookFormProps) => {
|
||||
name="config.webhookUrl"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Webhook URL</FormLabel>
|
||||
<FormLabel>Webhook URL *</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="https://example.com/api/webhook" />
|
||||
<Input {...field} placeholder="e.g. https://example.com/api/webhook" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -38,9 +38,9 @@ export const NotifierWebhookForm = ({ form }: NotifierWebhookFormProps) => {
|
||||
name="config.webhookSecretHeader"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Header Name (Optional)</FormLabel>
|
||||
<FormLabel>Header Name</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="X-Webhook-Secret" />
|
||||
<Input {...field} placeholder="e.g. X-Webhook-Secret" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -53,9 +53,9 @@ export const NotifierWebhookForm = ({ form }: NotifierWebhookFormProps) => {
|
||||
name="config.webhookSecret"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Secret Value (Optional)</FormLabel>
|
||||
<FormLabel>Secret Value</FormLabel>
|
||||
<FormControl>
|
||||
<PasswordInput {...field} placeholder="Secret value..." />
|
||||
<PasswordInput {...field} placeholder="e.g. webhook-secret" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
||||
+5
-5
@@ -96,9 +96,9 @@ export const StorageGoogleDriveForm = ({form}: StorageGoogleDriveFormProps) => {
|
||||
name="config.clientId"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Client ID</FormLabel>
|
||||
<FormLabel>Client ID *</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="xxxx.apps.googleusercontent.com"/>
|
||||
<Input {...field} placeholder="e.g. xxxx.apps.googleusercontent.com"/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
@@ -110,7 +110,7 @@ export const StorageGoogleDriveForm = ({form}: StorageGoogleDriveFormProps) => {
|
||||
name="config.clientSecret"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Client Secret</FormLabel>
|
||||
<FormLabel>Client Secret *</FormLabel>
|
||||
<FormControl>
|
||||
<PasswordInput {...field} />
|
||||
</FormControl>
|
||||
@@ -124,9 +124,9 @@ export const StorageGoogleDriveForm = ({form}: StorageGoogleDriveFormProps) => {
|
||||
name="config.folderId"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Folder ID</FormLabel>
|
||||
<FormLabel>Folder ID *</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
<Input {...field} placeholder="e.g. 1AbCdEfGhIjKlMnOpQrStUvWxYz"/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
|
||||
+10
-10
@@ -24,9 +24,9 @@ export const StorageS3Form = ({ form }: StorageS3FormProps) => {
|
||||
name="config.endPointUrl"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Endpoint URL</FormLabel>
|
||||
<FormLabel>Endpoint URL *</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="s3.amazonaws.com" />
|
||||
<Input {...field} placeholder="e.g. s3.amazonaws.com" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -39,7 +39,7 @@ export const StorageS3Form = ({ form }: StorageS3FormProps) => {
|
||||
<FormItem>
|
||||
<FormLabel>Region</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="us-east-1" />
|
||||
<Input {...field} placeholder="e.g. us-east-1" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -50,9 +50,9 @@ export const StorageS3Form = ({ form }: StorageS3FormProps) => {
|
||||
name="config.accessKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Access Key</FormLabel>
|
||||
<FormLabel>Access Key *</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="A1b2C3d4E5f6G7h" />
|
||||
<Input {...field} placeholder="e.g. AKIA..." />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -63,9 +63,9 @@ export const StorageS3Form = ({ form }: StorageS3FormProps) => {
|
||||
name="config.secretKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Secret Key</FormLabel>
|
||||
<FormLabel>Secret Key *</FormLabel>
|
||||
<FormControl>
|
||||
<PasswordInput {...field} placeholder="A1b2C3d4E5f6G7h" />
|
||||
<PasswordInput {...field} placeholder="e.g. s3-secret-key" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -76,9 +76,9 @@ export const StorageS3Form = ({ form }: StorageS3FormProps) => {
|
||||
name="config.bucketName"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Bucket name</FormLabel>
|
||||
<FormLabel>Bucket name *</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="portabase-dev" />
|
||||
<Input {...field} placeholder="e.g. backups-prod" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -91,7 +91,7 @@ export const StorageS3Form = ({ form }: StorageS3FormProps) => {
|
||||
<FormItem>
|
||||
<FormLabel>Port</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} type="number" placeholder="443" />
|
||||
<Input {...field} type="number" placeholder="e.g. 443" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
||||
@@ -6,6 +6,7 @@ export const EmailFormSchema = z.object({
|
||||
smtpHost: z.string(),
|
||||
smtpPort: z.string(),
|
||||
smtpUser: z.string(),
|
||||
smtpSecure: z.boolean()
|
||||
});
|
||||
|
||||
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 {ButtonWithLoading} from "@/components/wrappers/common/button/button-with-loading";
|
||||
import {Send} from "lucide-react";
|
||||
import {Switch} from "@/components/ui/switch";
|
||||
|
||||
export type EmailFormProps = {
|
||||
defaultValues?: EmailFormType;
|
||||
@@ -178,6 +179,23 @@ export const EmailForm = (props: EmailFormProps) => {
|
||||
</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">
|
||||
{props.defaultValues?.smtpFrom && (
|
||||
<Tooltip>
|
||||
|
||||
@@ -28,7 +28,7 @@ export const LoggedInButtonClient = ({ user, sessions, currentSession, accounts,
|
||||
accounts={accounts}
|
||||
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">
|
||||
<Avatar className="size-6">
|
||||
<AvatarFallback>{user.name[0].toUpperCase()}</AvatarFallback>
|
||||
|
||||
@@ -16,7 +16,7 @@ import {UpdateNotification} from "@/features/updates/components/update-notificat
|
||||
export function AppSidebar() {
|
||||
const projectName = env.PROJECT_NAME;
|
||||
return (
|
||||
<Sidebar collapsible="icon" >
|
||||
<Sidebar collapsible="icon">
|
||||
<SidebarHeader>
|
||||
<SidebarMenu>
|
||||
<SidebarMenuItem>
|
||||
@@ -32,8 +32,8 @@ export function AppSidebar() {
|
||||
<SidebarMenuCustomMain/>
|
||||
</SidebarContent>
|
||||
|
||||
<UpdateNotification />
|
||||
|
||||
<UpdateNotification/>
|
||||
|
||||
<SidebarMenu className="mb-2">
|
||||
<SidebarMenuItem className="p-2">
|
||||
<LoggedInButton/>
|
||||
|
||||
@@ -38,7 +38,7 @@ export const ImportModal = ({database}: ImportModalProps) => {
|
||||
<Separator className="mt-3 "/>
|
||||
<UploadBackupZone
|
||||
onSuccessAction={() => setOpen(false)}
|
||||
databaseId={database.id}/>
|
||||
database={database}/>
|
||||
</DialogHeader>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
@@ -9,13 +9,15 @@ import {ButtonWithLoading} from "@/components/wrappers/common/button/button-with
|
||||
import {toast} from "sonner";
|
||||
import {uploadBackupAction} from "@/components/wrappers/dashboard/database/import/upload-backup.action";
|
||||
import {Card, CardContent} from "@/components/ui/card";
|
||||
import {DatabaseWith} from "@/db/schema/07_database";
|
||||
import {getFileHeadersBasedOnDbms} from "@/utils/common";
|
||||
|
||||
type UploadRetentionZoneProps = {
|
||||
onSuccessAction?: () => void;
|
||||
databaseId: string;
|
||||
database: DatabaseWith;
|
||||
};
|
||||
|
||||
export const UploadBackupZone = ({onSuccessAction, databaseId}: UploadRetentionZoneProps) => {
|
||||
export const UploadBackupZone = ({onSuccessAction, database}: UploadRetentionZoneProps) => {
|
||||
const queryClient = useQueryClient();
|
||||
const router = useRouter();
|
||||
|
||||
@@ -30,7 +32,7 @@ export const UploadBackupZone = ({onSuccessAction, databaseId}: UploadRetentionZ
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
formData.append("databaseId", databaseId);
|
||||
formData.append("databaseId", database.id);
|
||||
|
||||
const result = await uploadBackupAction(formData)
|
||||
|
||||
@@ -38,7 +40,7 @@ export const UploadBackupZone = ({onSuccessAction, databaseId}: UploadRetentionZ
|
||||
if (inner?.success) {
|
||||
toast.success(inner.actionSuccess?.message);
|
||||
onSuccessAction?.()
|
||||
queryClient.invalidateQueries({queryKey: ["database-data", databaseId]});
|
||||
queryClient.invalidateQueries({queryKey: ["database-data", database.id]});
|
||||
router.refresh();
|
||||
} else {
|
||||
toast.error(inner?.actionError?.message);
|
||||
@@ -47,19 +49,20 @@ export const UploadBackupZone = ({onSuccessAction, databaseId}: UploadRetentionZ
|
||||
console.error(err);
|
||||
toast.error("An error occurred while upload in the backup");
|
||||
} finally {
|
||||
queryClient.invalidateQueries({queryKey: ["database-data", databaseId]});
|
||||
queryClient.invalidateQueries({queryKey: ["database-data", database.id]});
|
||||
setIsProcessing(false);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const acceptDbImportFiles: Record<string, string[]> = {
|
||||
"application/sql": [".sql"],
|
||||
"application/x-sql": [".sql"],
|
||||
"text/plain": [".sql"],
|
||||
"application/octet-stream": [".dump"],
|
||||
};
|
||||
const acceptDbImportFiles = getFileHeadersBasedOnDbms(database.dbms)
|
||||
console.log(acceptDbImportFiles)
|
||||
|
||||
const fileKindDescription = Object.values(acceptDbImportFiles)
|
||||
.flat()
|
||||
.join(", ");
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -67,11 +70,11 @@ export const UploadBackupZone = ({onSuccessAction, databaseId}: UploadRetentionZ
|
||||
<UploadLoader label="Uploading database backup…"/>
|
||||
) : (
|
||||
<DropZoneFile
|
||||
accept={acceptDbImportFiles}
|
||||
accept={getFileHeadersBasedOnDbms(database.dbms)}
|
||||
maxSize={2 * 1024 * 1024 * 1024}
|
||||
maxFiles={1}
|
||||
description="Import database backup"
|
||||
fileKind="Database file (.sql, .dump)"
|
||||
fileKind={`Database file (${fileKindDescription})`}
|
||||
dragMessage="Click or drag a database dump here"
|
||||
onFileDropAction={(file: File) => setFile(file)}
|
||||
/>
|
||||
@@ -86,8 +89,6 @@ export const UploadBackupZone = ({onSuccessAction, databaseId}: UploadRetentionZ
|
||||
</ButtonWithLoading>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ export function CreateOrganizationModal({
|
||||
onOpenChange(false);
|
||||
await authClient.organization.setActive({organizationSlug: result.data.value.slug});
|
||||
onSuccess?.();
|
||||
toast.success(result.data.actionSuccess?.message || "Organization Created.");
|
||||
toast.success(result.data.actionSuccess?.message);
|
||||
form.reset()
|
||||
router.replace(redirect);
|
||||
} else {
|
||||
|
||||
@@ -64,8 +64,8 @@ export function OrganizationCombobox() {
|
||||
onSuccess={handleReload}
|
||||
onOpenChange={setOpenModal}
|
||||
/>
|
||||
<DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<DropdownMenu open={isOpen} onOpenChange={setIsOpen} >
|
||||
<DropdownMenuTrigger data-testid="organization-dropdown" asChild>
|
||||
<SidebarMenuButton
|
||||
size="lg"
|
||||
className={cn(
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TYPE "public"."dbms_status" ADD VALUE 'firebird';
|
||||
File diff suppressed because it is too large
Load Diff
@@ -337,6 +337,13 @@
|
||||
"when": 1774768062658,
|
||||
"tag": "0047_wet_carnage",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 48,
|
||||
"version": "7",
|
||||
"when": 1774886139855,
|
||||
"tag": "0048_yellow_eddie_brock",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import {pgEnum} from "drizzle-orm/pg-core";
|
||||
import {createSelectSchema} from "drizzle-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 typeStorageEnum = pgEnum("type_storage", ["local", "s3"]);
|
||||
|
||||
|
||||
+10
-1
@@ -20,12 +20,19 @@ export const env = createEnv({
|
||||
.regex(/^https?:\/\//, "URL must start with http:// or https://"),
|
||||
PROJECT_SECRET: z.string(),
|
||||
|
||||
TRUSTED_DOMAINS: z.string().optional(),
|
||||
|
||||
SMTP_PASSWORD: z.string().optional(),
|
||||
SMTP_FROM: z.string().optional(),
|
||||
SMTP_HOST: z.string().optional(),
|
||||
SMTP_PORT: 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_SECRET: z.string().optional(),
|
||||
@@ -101,6 +108,8 @@ export const env = createEnv({
|
||||
|
||||
DATABASE_URL: process.env.DATABASE_URL,
|
||||
|
||||
TRUSTED_DOMAINS: process.env.TRUSTED_DOMAINS,
|
||||
|
||||
SMTP_PASSWORD: process.env.SMTP_PASSWORD,
|
||||
SMTP_FROM: process.env.SMTP_FROM,
|
||||
SMTP_HOST: process.env.SMTP_HOST,
|
||||
|
||||
+42
-14
@@ -455,19 +455,29 @@ export const auth = betterAuth({
|
||||
|
||||
const deviceInfo = getDeviceDetails(session.userAgent);
|
||||
|
||||
await sendEmail({
|
||||
to: user.email,
|
||||
subject: "New login to your account",
|
||||
html: await render(
|
||||
EmailNewLogin({
|
||||
firstname: user.name!,
|
||||
os: deviceInfo.os,
|
||||
browser: deviceInfo.browser,
|
||||
ipAddress: session.ipAddress!,
|
||||
}),
|
||||
{},
|
||||
),
|
||||
});
|
||||
|
||||
try {
|
||||
await sendEmail({
|
||||
to: user.email,
|
||||
subject: "New login to your account",
|
||||
html: await render(
|
||||
EmailNewLogin({
|
||||
firstname: user.name!,
|
||||
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, {
|
||||
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) => {
|
||||
const user = await auth.api.signUpEmail({
|
||||
body: {
|
||||
|
||||
+37
-3
@@ -17,7 +17,7 @@ export function buildOrganizationWithMembers(
|
||||
const org = rows[0].organization;
|
||||
|
||||
|
||||
const invitations : OrganizationInvitation[] = rows
|
||||
const invitations: OrganizationInvitation[] = rows
|
||||
.filter(r => r.invitation)
|
||||
.map(r => ({
|
||||
...r.invitation!,
|
||||
@@ -38,7 +38,6 @@ export function buildOrganizationWithMembers(
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function getFileExtension(dbType: string) {
|
||||
switch (dbType) {
|
||||
case "postgresql":
|
||||
@@ -48,4 +47,39 @@ export function getFileExtension(dbType: string) {
|
||||
default:
|
||||
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}`);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ async function setupCronJobs() {
|
||||
|
||||
async function createSettingsIfNotExist() {
|
||||
await db.transaction(async (tx) => {
|
||||
|
||||
const systemSettingsValues = {
|
||||
name: "system",
|
||||
smtpPassword: env.SMTP_PASSWORD ?? null,
|
||||
|
||||
Reference in New Issue
Block a user