Skip to content

Commit a9d2e4c

Browse files
committed
fix
1 parent f315b9c commit a9d2e4c

8 files changed

Lines changed: 57 additions & 169 deletions

File tree

.env.test.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ NEXT_PUBLIC_SUPABASE_ANON_KEY=
33
SUPABASE_ACCESS_TOKEN=
44
E2E_USERNAME_ID=
55
E2E_USERNAME=
6-
E2E_PASSWORD=
6+
E2E_PASSWORD=

.github/workflows/main.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,33 @@ jobs:
1717
- run: npm install
1818
- run: npm run test:run
1919
- run: npm run build
20+
21+
e2e-tests:
22+
runs-on: ubuntu-latest
23+
if: false
24+
env:
25+
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
26+
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}
27+
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
28+
E2E_USERNAME_ID: ${{ secrets.E2E_USERNAME_ID }}
29+
E2E_USERNAME: ${{ secrets.E2E_USERNAME }}
30+
E2E_PASSWORD: ${{ secrets.E2E_PASSWORD }}
31+
CI: true
32+
steps:
33+
- uses: actions/checkout@v6
34+
- uses: actions/setup-node@v6
35+
with:
36+
node-version: 22.15.0
37+
cache: "npm"
38+
- run: npm install
39+
- name: Install Playwright Browsers
40+
run: npx playwright install chromium --with-deps
41+
- name: Run E2E tests
42+
run: npm run test:e2e
43+
- name: Upload test results
44+
if: always()
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: playwright-report
48+
path: playwright-report/
49+
retention-days: 7

.github/workflows/pull-request.yml

Lines changed: 0 additions & 135 deletions
This file was deleted.

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default defineConfig({
6464
webServer: {
6565
command: "npm run dev",
6666
url: "http://localhost:3000",
67-
reuseExistingServer: false,
67+
reuseExistingServer: !process.env.CI, // Użyj istniejącego serwera lokalnie, uruchom nowy w CI
6868
timeout: 120 * 1000,
6969
},
7070
});

src/app/[locale]/(private)/dashboard/_components/DashboardContent.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,16 @@ export default function DashboardContent({
9292
void mutateUserCatalogs();
9393
}, [mutateUserCatalogs]);
9494

95-
const catalogFormSchema = useMemo(() => {
96-
return z.object({
97-
name: z
98-
.string()
99-
.min(3, translation("form.validation.name.minLength"))
100-
.max(255, translation("form.validation.name.maxLength")),
101-
});
102-
}, [translation]);
95+
const catalogFormSchema = useMemo(
96+
() =>
97+
z.object({
98+
name: z
99+
.string()
100+
.min(3, translation("form.validation.name.minLength"))
101+
.max(255, translation("form.validation.name.maxLength")),
102+
}),
103+
[translation]
104+
);
103105

104106
const handleModalOpenChange = useCallback((nextIsOpen: boolean) => {
105107
setIsFormOpen(nextIsOpen);

src/app/layout.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
import { ThemeProvider } from "@/components/theme-provider";
2-
import { FALLBACK_LOCALE } from "@/lib/i18n/locales";
2+
import { FALLBACK_LOCALE, isSupportedLocale } from "@/lib/i18n/locales";
33
import "@/styles/globals.css";
44
import type { ReactNode } from "react";
55

66
interface RootLayoutProps {
77
children: ReactNode;
8+
params: {
9+
locale?: string;
10+
};
811
}
912

10-
export default function RootLayout({ children }: RootLayoutProps) {
13+
export default function RootLayout({ children, params }: RootLayoutProps) {
14+
const locale = isSupportedLocale(params.locale) ? params.locale : FALLBACK_LOCALE;
15+
1116
return (
12-
<html lang={FALLBACK_LOCALE} suppressHydrationWarning>
17+
<html lang={locale} suppressHydrationWarning>
1318
<body className="min-h-screen bg-background font-sans antialiased">
1419
<ThemeProvider>{children}</ThemeProvider>
1520
</body>

src/features/auth/actions.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,11 @@ export async function loginAction(locale: string, values: LoginFormValues): Prom
123123
};
124124
}
125125

126-
const dashboardUrl = `/${locale}/dashboard`;
127-
// Ensure user ends up in their locale-specific dashboard after login
128-
redirect(dashboardUrl);
126+
// Return success with redirect URL - let client handle navigation
127+
// This ensures cookies are properly set before redirect
129128
return {
130129
success: true,
131-
redirectUrl: dashboardUrl,
130+
redirectUrl: `/${locale}/dashboard`,
132131
};
133132
} catch (error) {
134133
console.error("Login error:", error);
@@ -240,11 +239,11 @@ export async function registerAction(locale: string, values: RegisterFormValues)
240239
// Note: Profile creation and default catalogs are handled by database trigger
241240
// (after insert on auth.users) as per spec
242241

243-
const dashboardUrl = `/${locale}/dashboard`;
244-
redirect(dashboardUrl);
242+
// Return success with redirect URL - let client handle navigation
243+
// This ensures cookies are properly set before redirect
245244
return {
246245
success: true,
247-
redirectUrl: dashboardUrl,
246+
redirectUrl: `/${locale}/dashboard`,
248247
};
249248
} catch (error) {
250249
return {

src/test/features/auth/actions.test.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,8 @@ interface AuthStubOptions {
2525
}
2626

2727
function createAuthStub(options: AuthStubOptions = {}) {
28-
const defaultSession = {
29-
access_token: "token",
30-
refresh_token: "refresh",
31-
expires_in: 3600,
32-
token_type: "bearer",
33-
provider_token: null,
34-
provider_refresh_token: null,
35-
user: { id: "user-1", email: "user@example.com" },
36-
};
37-
3828
const defaultSuccess = {
39-
data: {
40-
user: { id: "user-1", email: "user@example.com" },
41-
session: defaultSession,
42-
},
29+
data: { user: { id: "user-1", email: "user@example.com" } },
4330
error: null,
4431
} as const;
4532

0 commit comments

Comments
 (0)