Compare commits

..

No commits in common. "2c3480f9807c887e800ee7dd8ca7c009adb24d94" and "85f918b397268adff48ff40b44d4da4a05c88872" have entirely different histories.

6 changed files with 12 additions and 20 deletions

View File

@ -25,8 +25,8 @@ jobs:
- name: Install Playwright Browsers - name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps run: pnpm exec playwright install --with-deps
- name: Run the service that will be tested - name: Run the service that will be tested
run: HOSTNAME=127.0.0.1 node .next/standalone/server.js & run: HOSTNAME=localhost node .next/standalone/server.js &
- name: Wait for the service to be ready - name: Wait for the service to be ready
run: npx wait-on http://127.0.0.1:3000/default/ --timeout 30000 run: npx wait-on http://localhost:3000/default/dashboard/guests --timeout 30000
- name: Run Playwright tests - name: Run Playwright tests
run: DEBUG=pw:api pnpm exec playwright test run: DEBUG=pw:api pnpm exec playwright test

View File

@ -15,15 +15,12 @@ import SkeletonTable from '@/app/ui/guests/skeleton-row';
import GuestsTable from '@/app/ui/guests/table'; import GuestsTable from '@/app/ui/guests/table';
import { TabPanel, TabView } from 'primereact/tabview'; import { TabPanel, TabView } from 'primereact/tabview';
import { Toast } from 'primereact/toast'; import { Toast } from 'primereact/toast';
import { Suspense, useEffect, useRef, useState } from 'react'; import { Suspense, useRef, useState } from 'react';
import InvitationsBoard from '@/app/ui/invitations/board'; import InvitationsBoard from '@/app/ui/invitations/board';
import { Invitation, InvitationSerializer } from '@/app/lib/invitation'; import { Invitation, InvitationSerializer } from '@/app/lib/invitation';
export default function Page() { export default function Page() {
const [slug, setSlug] = useState<string | null>(null);
useEffect(() => { setSlug(getSlug()) }, []);
const toast = useRef<Toast>(null); const toast = useRef<Toast>(null);
function refreshGuests() { function refreshGuests() {
@ -48,7 +45,7 @@ export default function Page() {
} }
function resetAffinities() { function resetAffinities() {
fetch(`/api/${slug}/groups/affinities/reset`, { fetch(`/api/${getSlug()}/groups/affinities/reset`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',

View File

@ -16,12 +16,12 @@ export default async function Page() {
if (getCsrfToken() == 'unknown') { if (getCsrfToken() == 'unknown') {
retrieveCSRFToken(); retrieveCSRFToken();
} }
if (typeof window !== 'undefined') {
localStorage.setItem('slug', params.slug);
}
}, []); }, []);
if (typeof window !== 'undefined') {
localStorage.setItem('slug', await params.slug);
}
return ( return (
<main className="flex min-h-screen flex-col p-6"> <main className="flex min-h-screen flex-col p-6">
<div className="flex flex-row"> <div className="flex flex-row">

View File

@ -15,9 +15,6 @@ export default function LoginForm() {
const [email, setEmail] = useState(""); const [email, setEmail] = useState("");
const [password, setPassword] = useState(""); const [password, setPassword] = useState("");
const [slug, setSlug] = useState<string | null>(null);
useEffect(() => {setSlug(getSlug())}, []);
const router = useRouter(); const router = useRouter();
const [currentUser, setCurrentUser] = useState<User | null>(null); const [currentUser, setCurrentUser] = useState<User | null>(null);
@ -44,7 +41,7 @@ export default function LoginForm() {
password: password, password: password,
onLogin: (user) => { onLogin: (user) => {
setCurrentUser(user); setCurrentUser(user);
router.push(`${slug}/dashboard`) router.push(`${getSlug()}/dashboard`)
} }
})}> })}>
Sign in Sign in

View File

@ -17,9 +17,7 @@ export default function RegistrationForm() {
const [email, setEmail] = useState<string>(""); const [email, setEmail] = useState<string>("");
const [password, setPassword] = useState<string>(""); const [password, setPassword] = useState<string>("");
const [passwordConfirmation, setPasswordConfirmation] = useState<string>(""); const [passwordConfirmation, setPasswordConfirmation] = useState<string>("");
const [slug, setSlug] = useState<string>(getSlug());
const [slug, setSlug] = useState<string | null>(null);
useEffect(() => { setSlug(getSlug()) }, []);
const [captchaId, setCaptchaId] = useState<string>(""); const [captchaId, setCaptchaId] = useState<string>("");
const [captchaUrl, setCaptchaUrl] = useState<string>(""); const [captchaUrl, setCaptchaUrl] = useState<string>("");

View File

@ -25,7 +25,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: { use: {
/* Base URL to use in actions like `await page.goto('/')`. */ /* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://127.0.0.1:3000', baseURL: 'http://localhost:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry', trace: 'on-first-retry',
@ -67,7 +67,7 @@ export default defineConfig({
/* Run your local dev server before starting the tests */ /* Run your local dev server before starting the tests */
// webServer: { // webServer: {
// command: 'npm run start', // command: 'npm run start',
// url: 'http://127.0.0.1:3000', // url: 'http://localhost:3000',
// reuseExistingServer: !process.env.CI, // reuseExistingServer: !process.env.CI,
// }, // },
}); });