first project commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "@repo/e2e",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "playwright test",
|
||||
"test:headed": "playwright test --headed",
|
||||
"test:ui": "playwright test --ui",
|
||||
"report": "playwright show-report",
|
||||
"install-browsers": "playwright install chromium",
|
||||
"clean": "rimraf node_modules playwright-report test-results .playwright"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.49.1",
|
||||
"@repo/config": "workspace:*",
|
||||
"@types/node": "^22.10.2",
|
||||
"rimraf": "^6.0.1",
|
||||
"typescript": "^5.7.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
const PORT = 3000;
|
||||
const BASE_URL = `http://localhost:${PORT}`;
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './tests',
|
||||
fullyParallel: true,
|
||||
forbidOnly: !!process.env.CI,
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
reporter: [['list'], ['html', { open: 'never' }]],
|
||||
use: {
|
||||
baseURL: BASE_URL,
|
||||
trace: 'retain-on-failure',
|
||||
screenshot: 'only-on-failure',
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
],
|
||||
webServer: {
|
||||
// Run from the repo root so workspace resolution works.
|
||||
command: 'pnpm --filter @repo/operator-pwa dev',
|
||||
cwd: '..',
|
||||
url: BASE_URL,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 120_000,
|
||||
stdout: 'pipe',
|
||||
stderr: 'pipe',
|
||||
// Force the dev autologin on for E2E regardless of the developer's local
|
||||
// .env. This env applies only to the child dev server, not the test
|
||||
// process itself.
|
||||
env: {
|
||||
AUTH_DEV_AUTOLOGIN: 'true',
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('ping smoke', () => {
|
||||
test('home page shows the seeded Demo Factory tenant', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
// RSC card with the server-side ping result.
|
||||
const success = page.getByTestId('ping-success');
|
||||
await expect(success).toBeVisible({ timeout: 15_000 });
|
||||
|
||||
const tenant = page.getByTestId('tenant-name');
|
||||
await expect(tenant).toHaveText('Demo Factory');
|
||||
|
||||
// Client-side hook hitting the same procedure via /api/trpc.
|
||||
const clientTenant = page.getByTestId('ping-client-tenant');
|
||||
await expect(clientTenant).toContainText('Demo Factory');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "@repo/config/tsconfig/base.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"lib": ["ES2022", "DOM"],
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler"
|
||||
},
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user