diff --git a/.github/labeler.yml b/.github/labeler.yml index 15bc210bd2..899ae6bf2a 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -49,6 +49,9 @@ Github Config & Actions: '@kadena/rwa-demo': - changed-files: - any-glob-to-any-file: packages/apps/rwa-demo/* +'@kadena/e2e-overview': + - changed-files: + - any-glob-to-any-file: packages/apps/e2e-overview/* '@kadena/graph': - changed-files: - any-glob-to-any-file: packages/apps/graph/* diff --git a/.gitignore b/.gitignore index 7ec5454917..7d6de56d73 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,5 @@ temp # parcel .parcel-cache + +/.playwright-mcp diff --git a/packages.json b/packages.json index 3314375170..133f7ebc0d 100644 --- a/packages.json +++ b/packages.json @@ -161,6 +161,12 @@ "private": true, "path": "packages/apps/rwa-demo" }, + { + "name": "@kadena/e2e-overview", + "version": "0.0.1", + "private": true, + "path": "packages/apps/e2e-overview" + }, { "name": "@kadena/snap", "version": "1.0.2", diff --git a/packages/apps/e2e-overview/.eslintignore b/packages/apps/e2e-overview/.eslintignore new file mode 100644 index 0000000000..6dd0af785e --- /dev/null +++ b/packages/apps/e2e-overview/.eslintignore @@ -0,0 +1,2 @@ +# generated code +**/__generated__/** diff --git a/packages/apps/e2e-overview/.eslintrc.js b/packages/apps/e2e-overview/.eslintrc.js new file mode 100644 index 0000000000..c929871335 --- /dev/null +++ b/packages/apps/e2e-overview/.eslintrc.js @@ -0,0 +1,19 @@ +// This is a workaround for https://github.com/eslint/eslint/issues/3458 +require('@rushstack/eslint-config/patch/modern-module-resolution'); + +module.exports = { + extends: ['@kadena-dev/eslint-config/profile/next'], + ignorePatterns: ['**/__generated__/**', '/playwright-report'], + parserOptions: { tsconfigRootDir: __dirname }, + rules: { + 'jsx-a11y/aria-props': 'warn', + 'jsx-a11y/role-has-required-aria-props': 'warn', + 'jsx-a11y/heading-has-content': 'warn', + 'jsx-a11y/mouse-events-have-key-events': 'warn', + 'jsx-a11y/role-supports-aria-props': 'warn', + '@rushstack/no-new-null': 'off', + 'react/react-in-jsx-scope': 'off', + 'react/jsx-uses-react': 'off', + '@typescript-eslint/strict-boolean-expressions': 'off', + }, +}; diff --git a/packages/apps/e2e-overview/.gitignore b/packages/apps/e2e-overview/.gitignore new file mode 100644 index 0000000000..7778f70f56 --- /dev/null +++ b/packages/apps/e2e-overview/.gitignore @@ -0,0 +1,44 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/versions + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# env files (can opt-in for commiting if needed) +.env* + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts + +/artifacts +/screenshots +/test-results diff --git a/packages/apps/e2e-overview/.prettierignore b/packages/apps/e2e-overview/.prettierignore new file mode 100644 index 0000000000..6edcfd6787 --- /dev/null +++ b/packages/apps/e2e-overview/.prettierignore @@ -0,0 +1,2 @@ +src/__generated__ +**/*.md diff --git a/packages/apps/e2e-overview/instrumentation-client.js b/packages/apps/e2e-overview/instrumentation-client.js new file mode 100644 index 0000000000..39c7daceb3 --- /dev/null +++ b/packages/apps/e2e-overview/instrumentation-client.js @@ -0,0 +1,22 @@ +import * as Sentry from '@sentry/nextjs'; + +Sentry.init({ + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, + // Adds request headers and IP for users, for more info visit: + // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii + sendDefaultPii: true, + enabled: true, //process.env.NODE_ENV !== 'development', // Set to true for dev testing + // Capture Replay for 10% of all sessions, + // plus for 100% of sessions with an error + // Learn more at + // https://docs.sentry.io/platforms/javascript/session-replay/configuration/#general-integration-configuration + replaysSessionSampleRate: 0.1, + replaysOnErrorSampleRate: 1.0, + tracesSampleRate: 1.0, + // Note: if you want to override the automatic release value, do not set a + // `release` value here - use the environment variable `SENTRY_RELEASE`, so + // that it will also get attached to your source maps +}); +// This export will instrument router navigations, and is only relevant if you enable tracing. +// `captureRouterTransitionStart` is available from SDK version 9.12.0 onwards +export const onRouterTransitionStart = Sentry.captureRouterTransitionStart; diff --git a/packages/apps/e2e-overview/instrumentation.js b/packages/apps/e2e-overview/instrumentation.js new file mode 100644 index 0000000000..40fc7cdbe2 --- /dev/null +++ b/packages/apps/e2e-overview/instrumentation.js @@ -0,0 +1,11 @@ +import * as Sentry from '@sentry/nextjs'; +export const onRequestError = Sentry.captureRequestError; + +export async function register() { + if (process.env.NEXT_RUNTIME === 'nodejs') { + await import('./sentry.server.config'); + } + if (process.env.NEXT_RUNTIME === 'edge') { + await import('./sentry.edge.config'); + } +} diff --git a/packages/apps/e2e-overview/next.config.js b/packages/apps/e2e-overview/next.config.js new file mode 100644 index 0000000000..699e395eb2 --- /dev/null +++ b/packages/apps/e2e-overview/next.config.js @@ -0,0 +1,39 @@ +const { createVanillaExtractPlugin } = require('@vanilla-extract/next-plugin'); +const withVanillaExtract = createVanillaExtractPlugin(); +const { withSentryConfig } = require('@sentry/nextjs'); + +/** @type {import('next').NextConfig} */ +const nextConfig = { + reactStrictMode: false, + transpilePackages: ['@kadena/kode-ui'], + env: { + NEXT_PUBLIC_COMMIT_SHA: process.env.VERCEL_GIT_COMMIT_SHA, + NEXT_PUBLIC_BUILD_TIME: new Date().toUTCString(), + }, + async rewrites() { + return [ + { + source: '/graph', + destination: + process.env.NEXT_PUBLIC_GRAPHURL ?? 'http://localhost:8080/graphql', + }, + ]; + }, +}; + +const configWithSentry = withSentryConfig(nextConfig, { + org: process.env.SENTRY_ORG, + project: process.env.SENTRY_PROJECT, + silent: !process.env.CI, + disableLogger: true, + reactComponentAnnotation: { + enabled: true, + }, + automaticVercelMonitors: true, + tunnelRoute: '/monitoring', + authToken: process.env.SENTRY_AUTH_TOKEN, + // Upload a larger set of source maps for prettier stack traces (increases build time) + widenClientFileUpload: true, +}); + +module.exports = withVanillaExtract(configWithSentry); diff --git a/packages/apps/e2e-overview/package.json b/packages/apps/e2e-overview/package.json new file mode 100644 index 0000000000..26a48fa40b --- /dev/null +++ b/packages/apps/e2e-overview/package.json @@ -0,0 +1,91 @@ +{ + "name": "@kadena/e2e-overview", + "version": "0.0.1", + "private": true, + "scripts": { + "build": "next build", + "dev": "next dev", + "generatetypes": "npx supabase gen types typescript --project-id ykahoipuhxpwitpuyvvn > ./src/database.types.ts", + "lint": "pnpm run /^lint:.*/", + "lint:fmt": "prettier . --cache --check", + "lint:src": "eslint src", + "start": "next start", + "test": "vitest run", + "test:coverage": "vitest run --coverage", + "test:watch": "vitest" + }, + "browserslist": [ + "defaults and supports es6-module", + "not dead", + "not IE 11" + ], + "dependencies": { + "@ai-sdk/gateway": "^1.0.21", + "@ai-sdk/openai": "^2.0.29", + "@ai-sdk/react": "^2.0.42", + "@anthropic-ai/sdk": "^0.62.0", + "@google-analytics/data": "~3.2.2", + "@graphql-yoga/apollo-link": "~3.3.0", + "@kadena/kode-icons": "workspace:*", + "@kadena/kode-ui": "workspace:*", + "@modelcontextprotocol/sdk": "^1.18.0", + "@playwright/mcp": "^0.0.38", + "@playwright/test": "^1.45.3", + "@prisma/client": "5.16.1", + "@sentry/nextjs": "^10.5.0", + "@sentry/tracing": "^7.120.3", + "@supabase/ssr": "^0.7.0", + "@supabase/supabase-js": "^2.57.4", + "@tanstack/react-query": "^5.32.0", + "@vanilla-extract/css": "1.14.2", + "@vanilla-extract/css-utils": "^0.1.3", + "@vanilla-extract/next-plugin": "^2.4.14", + "@vanilla-extract/recipes": "0.5.1", + "ai": "^5.0.42", + "cache-sh": "^1.2.1", + "classnames": "^2.3.1", + "cors": "^2.8.5", + "cronstrue": "^3.3.0", + "dockerode": "^4.0.9", + "dotenv": "~16.4.5", + "execa": "^9.6.0", + "mailgun.js": "^12.0.2", + "next": "~15.4.6", + "next-themes": "^0.4.6", + "playwright": "^1.55.0", + "react": "^19.1.1", + "react-dom": "^19.1.1", + "react-hook-form": "^7.45.4", + "react-markdown": "^10.1.0", + "types": "link:@modelcontextprotocol/sdk/types", + "uuid": "^9.0.1", + "zod": "~3.23.0" + }, + "devDependencies": { + "@kadena-dev/eslint-config": "workspace:*", + "@kadena-dev/lint-package": "workspace:*", + "@kadena-dev/shared-config": "workspace:*", + "@sentry/types": "^9.29.0", + "@types/cors": "^2.8.19", + "@types/express": "^5.0.3", + "@types/gtag.js": "~0.0.12", + "@types/node": "^20.12.7", + "@types/react": "^19.1.1", + "@types/react-dom": "^19.1.1", + "@types/uuid": "^9.0.8", + "@vanilla-extract/vite-plugin": "4.0.17", + "@vanilla-extract/webpack-plugin": "2.3.7", + "@vitejs/plugin-react": "^4.3.1", + "@vitest/coverage-v8": "^1.6.0", + "eslint": "^8.45.0", + "eslint-config-next": "13.4.5", + "express": "^5.1.0", + "prettier": "~3.2.5", + "prisma": "^5.16.1", + "supabase": "^2.45.5", + "ts-node": "~10.9.2", + "typescript": "5.4.5", + "vitest": "^1.6.0", + "vitest-dom": "^0.1.1" + } +} diff --git a/packages/apps/e2e-overview/playwright.config.ts b/packages/apps/e2e-overview/playwright.config.ts new file mode 100644 index 0000000000..885253213f --- /dev/null +++ b/packages/apps/e2e-overview/playwright.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from '@playwright/test'; +export default defineConfig({ + use: { + headless: false, + viewport: { width: 1366, height: 900 }, + locale: 'en-US', + timezoneId: 'UTC', + trace: 'on-first-retry', + video: 'retain-on-failure', + screenshot: 'only-on-failure', + }, + reporter: [['html', { open: 'never' }]], +}); diff --git a/packages/apps/e2e-overview/playwright.mcp.config.json b/packages/apps/e2e-overview/playwright.mcp.config.json new file mode 100644 index 0000000000..8d96d3451c --- /dev/null +++ b/packages/apps/e2e-overview/playwright.mcp.config.json @@ -0,0 +1,20 @@ +{ + "browser": { + "browserName": "chromium", + "launchOptions": { + "headless": false + } + }, + "outputDir": "./results", + "saveSession": true, + "saveTrace": true, + "timeOuts": { + "action": 10000, + "navigation": 30000 + }, + "server": { + "port": 8931, + "host": "localhost", + "verbose": true + } +} diff --git a/packages/apps/e2e-overview/public/assets/favicons/icon@128.png b/packages/apps/e2e-overview/public/assets/favicons/icon@128.png new file mode 100644 index 0000000000..be831108f2 Binary files /dev/null and b/packages/apps/e2e-overview/public/assets/favicons/icon@128.png differ diff --git a/packages/apps/e2e-overview/public/assets/favicons/icon@144.png b/packages/apps/e2e-overview/public/assets/favicons/icon@144.png new file mode 100644 index 0000000000..7c94806550 Binary files /dev/null and b/packages/apps/e2e-overview/public/assets/favicons/icon@144.png differ diff --git a/packages/apps/e2e-overview/public/assets/favicons/icon@16.png b/packages/apps/e2e-overview/public/assets/favicons/icon@16.png new file mode 100644 index 0000000000..bbbfe4a294 Binary files /dev/null and b/packages/apps/e2e-overview/public/assets/favicons/icon@16.png differ diff --git a/packages/apps/e2e-overview/public/assets/favicons/icon@168.png b/packages/apps/e2e-overview/public/assets/favicons/icon@168.png new file mode 100644 index 0000000000..7206c2aa85 Binary files /dev/null and b/packages/apps/e2e-overview/public/assets/favicons/icon@168.png differ diff --git a/packages/apps/e2e-overview/public/assets/favicons/icon@192.png b/packages/apps/e2e-overview/public/assets/favicons/icon@192.png new file mode 100644 index 0000000000..f28987598b Binary files /dev/null and b/packages/apps/e2e-overview/public/assets/favicons/icon@192.png differ diff --git a/packages/apps/e2e-overview/public/assets/favicons/icon@24.png b/packages/apps/e2e-overview/public/assets/favicons/icon@24.png new file mode 100644 index 0000000000..e40eee3553 Binary files /dev/null and b/packages/apps/e2e-overview/public/assets/favicons/icon@24.png differ diff --git a/packages/apps/e2e-overview/public/assets/favicons/icon@32.png b/packages/apps/e2e-overview/public/assets/favicons/icon@32.png new file mode 100644 index 0000000000..27b6c7945a Binary files /dev/null and b/packages/apps/e2e-overview/public/assets/favicons/icon@32.png differ diff --git a/packages/apps/e2e-overview/public/assets/favicons/icon@40.png b/packages/apps/e2e-overview/public/assets/favicons/icon@40.png new file mode 100644 index 0000000000..44f774c916 Binary files /dev/null and b/packages/apps/e2e-overview/public/assets/favicons/icon@40.png differ diff --git a/packages/apps/e2e-overview/public/assets/favicons/icon@48.png b/packages/apps/e2e-overview/public/assets/favicons/icon@48.png new file mode 100644 index 0000000000..9dea6f34d5 Binary files /dev/null and b/packages/apps/e2e-overview/public/assets/favicons/icon@48.png differ diff --git a/packages/apps/e2e-overview/public/assets/favicons/icon@512.png b/packages/apps/e2e-overview/public/assets/favicons/icon@512.png new file mode 100644 index 0000000000..3fe59d52f7 Binary files /dev/null and b/packages/apps/e2e-overview/public/assets/favicons/icon@512.png differ diff --git a/packages/apps/e2e-overview/public/assets/favicons/icon@64.png b/packages/apps/e2e-overview/public/assets/favicons/icon@64.png new file mode 100644 index 0000000000..6e5495a61e Binary files /dev/null and b/packages/apps/e2e-overview/public/assets/favicons/icon@64.png differ diff --git a/packages/apps/e2e-overview/public/assets/favicons/icon@72.png b/packages/apps/e2e-overview/public/assets/favicons/icon@72.png new file mode 100644 index 0000000000..ac4a2bcd1b Binary files /dev/null and b/packages/apps/e2e-overview/public/assets/favicons/icon@72.png differ diff --git a/packages/apps/e2e-overview/public/assets/favicons/icon@96.png b/packages/apps/e2e-overview/public/assets/favicons/icon@96.png new file mode 100644 index 0000000000..b1b490fec8 Binary files /dev/null and b/packages/apps/e2e-overview/public/assets/favicons/icon@96.png differ diff --git a/packages/apps/e2e-overview/sentry.edge.config.js b/packages/apps/e2e-overview/sentry.edge.config.js new file mode 100644 index 0000000000..0ec79d291c --- /dev/null +++ b/packages/apps/e2e-overview/sentry.edge.config.js @@ -0,0 +1,7 @@ +import * as Sentry from '@sentry/nextjs'; +Sentry.init({ + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, + sendDefaultPii: true, + tracesSampleRate: 1.0, + environment: process.env.NODE_ENV, +}); diff --git a/packages/apps/e2e-overview/sentry.server.config.js b/packages/apps/e2e-overview/sentry.server.config.js new file mode 100644 index 0000000000..0ec79d291c --- /dev/null +++ b/packages/apps/e2e-overview/sentry.server.config.js @@ -0,0 +1,7 @@ +import * as Sentry from '@sentry/nextjs'; +Sentry.init({ + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, + sendDefaultPii: true, + tracesSampleRate: 1.0, + environment: process.env.NODE_ENV, +}); diff --git a/packages/apps/e2e-overview/src/app/(app)/KLogo.tsx b/packages/apps/e2e-overview/src/app/(app)/KLogo.tsx new file mode 100644 index 0000000000..206aa87b0b --- /dev/null +++ b/packages/apps/e2e-overview/src/app/(app)/KLogo.tsx @@ -0,0 +1,57 @@ +import type { FC } from 'react'; +import { logoClass } from './../styles.css'; + +export const KLogo: FC<{ className?: string }> = (props) => ( + + + + + + + + + + + + + + + + + + +); diff --git a/packages/apps/e2e-overview/src/app/(app)/SideBar.tsx b/packages/apps/e2e-overview/src/app/(app)/SideBar.tsx new file mode 100644 index 0000000000..cb26ead7d6 --- /dev/null +++ b/packages/apps/e2e-overview/src/app/(app)/SideBar.tsx @@ -0,0 +1,39 @@ +'use client'; +import { SidebarSideContext } from '@/components/SidebarSideContext/SidebarSideContext'; +import { MonoApps } from '@kadena/kode-icons'; +import { + SideBarItem, + SideBar as SideBarLayout, +} from '@kadena/kode-ui/patterns'; +import Link from 'next/link'; +import type { FC } from 'react'; +import { KLogo } from './KLogo'; + +export const SideBar: FC<{ topbannerHeight?: number }> = ({ + topbannerHeight = 0, +}) => { + return ( + + + + + + } + navigation={ + <> + } + label="Dashboard" + component={Link} + href="/dashboard" + /> + + } + appContext={<>} + context={} + > + ); +}; diff --git a/packages/apps/e2e-overview/src/app/(app)/apps/[appId]/layout.tsx b/packages/apps/e2e-overview/src/app/(app)/apps/[appId]/layout.tsx new file mode 100644 index 0000000000..2ab459a080 --- /dev/null +++ b/packages/apps/e2e-overview/src/app/(app)/apps/[appId]/layout.tsx @@ -0,0 +1,29 @@ +'use client'; + +import { useApp } from '@/hooks/getApp'; +import { Heading } from '@kadena/kode-ui'; +import { use } from 'react'; +const AppLayout = ({ + children, + params, +}: Readonly<{ + children: React.ReactNode; + params: Promise<{ appId: string }>; +}>) => { + const { appId } = use(params); + const innerAppId = appId === 'new' ? undefined : appId; + const { data, isLoading } = useApp(innerAppId); + + if (isLoading) { + return 'loading...'; + } + + return ( + <> + {data?.name} + {children} + + ); +}; + +export default AppLayout; diff --git a/packages/apps/e2e-overview/src/app/(app)/apps/[appId]/page.tsx b/packages/apps/e2e-overview/src/app/(app)/apps/[appId]/page.tsx new file mode 100644 index 0000000000..91a73ecdfe --- /dev/null +++ b/packages/apps/e2e-overview/src/app/(app)/apps/[appId]/page.tsx @@ -0,0 +1,114 @@ +'use client'; + +import { AllAppTestVersions } from '@/components/AllAppTestVersions/AllAppTestVersions'; +import { AppCronSettings } from '@/components/AppCronSettings/AppCronSettings'; +import { useEditApp } from '@/hooks/editApp'; +import type { UpdateApp } from '@/hooks/getAllApps'; +import { useApp } from '@/hooks/getApp'; +import { Button, Checkbox, Heading, TextField } from '@kadena/kode-ui'; +import { useRouter } from 'next/navigation'; +import { use } from 'react'; +import { Controller, useForm } from 'react-hook-form'; + +const Home = ({ params }: { params: Promise<{ appId: string }> }) => { + const { appId } = use(params); + const innerAppId = appId === 'new' ? undefined : appId; + const { data } = useApp(innerAppId); + const { mutate, isPending } = useEditApp(); + const router = useRouter(); + + const { + control, + handleSubmit, + setValue, + getValues, + formState: { isValid, errors }, + } = useForm({ + values: { + id: innerAppId, + is_active: data?.is_active || false, + is_on_dashboard: data?.is_on_dashboard || false, + name: data?.name || '', + cron: data?.cron || '* * * * *', + }, + }); + + const onSubmit = async (updateData: UpdateApp) => { + await mutate(updateData, { + onSuccess: (data) => { + if (innerAppId) return; + router.push(`/apps/${data.id}`); + }, + }); + }; + + return ( + <> +
+ ( + + Is active + + )} + /> + ( + + Show on dashboard + + )} + /> + ( + + )} + /> + + + + + + {innerAppId && ( + <> + Tests + + + )} + + ); +}; + +export default Home; diff --git a/packages/apps/e2e-overview/src/app/(app)/apps/[appId]/tests/[testId]/page.tsx b/packages/apps/e2e-overview/src/app/(app)/apps/[appId]/tests/[testId]/page.tsx new file mode 100644 index 0000000000..16142e8990 --- /dev/null +++ b/packages/apps/e2e-overview/src/app/(app)/apps/[appId]/tests/[testId]/page.tsx @@ -0,0 +1,50 @@ +'use client'; + +import { TestVersionForm } from '@/components/TestForm/TestVersionForm'; +import { TestRuns } from '@/components/TestRuns/TestRuns'; +import type { AppTestVersion } from '@/hooks/getAllAppTestVersions'; +import { Button } from '@kadena/kode-ui'; +import { useRouter } from 'next/navigation'; +import { use } from 'react'; +import { v4 as uuidv4 } from 'uuid'; + +const Home = ({ + params, +}: { + params: Promise<{ appId: string; testId: string }>; +}) => { + const { appId, testId } = use(params); + const router = useRouter(); + const isNew = testId === 'new'; + + const handleSuccess = (data: AppTestVersion) => { + if (data.id) { + router.push(`/apps/${appId}/tests/${data.id}`); + } + }; + + const handleTest = async () => { + // Call your API to run the tests + const runId = uuidv4(); + router.push(`/apps/${appId}/tests/${testId}/runs/${runId}`); + }; + + return ( + <> + + + {!isNew && ( + <> + + + + )} + + ); +}; + +export default Home; diff --git a/packages/apps/e2e-overview/src/app/(app)/apps/[appId]/tests/[testId]/runs/[runId]/page.tsx b/packages/apps/e2e-overview/src/app/(app)/apps/[appId]/tests/[testId]/runs/[runId]/page.tsx new file mode 100644 index 0000000000..c4c1b39b72 --- /dev/null +++ b/packages/apps/e2e-overview/src/app/(app)/apps/[appId]/tests/[testId]/runs/[runId]/page.tsx @@ -0,0 +1,61 @@ +'use client'; + +import { SideBarBreadcrumbs } from '@/components/SideBarBreadcrumbs/SideBarBreadcrumbs'; +import { useTestRunVersion } from '@/hooks/getTestRunVersion'; +import { useRunTestVersion } from '@/hooks/runTestVersion'; +import { SideBarBreadcrumbsItem } from '@kadena/kode-ui/patterns'; +import { use, useEffect } from 'react'; + +const Home = ({ + params, +}: { + params: Promise<{ appId: string; testId: string; runId: string }>; +}) => { + const { appId, testId, runId } = use(params); + const { mutate, isSuccess, error, isPending } = useRunTestVersion(); + const { data, refetch, isLoading } = useTestRunVersion({ + versionId: testId, + runId, + }); + + useEffect(() => { + if (data?.id || isLoading) return; + mutate({ appId, testId, runId }); + }, [data, isLoading]); + + useEffect(() => { + if (isSuccess) { + console.log('refetching'); + // eslint-disable-next-line @typescript-eslint/no-floating-promises + refetch(); + } + }, [isSuccess]); + + console.log({ error }); + + if (isPending) return
Running test...
; + + return ( + <> + + + app + + + test + + + {data?.start_time + ? new Date(data.start_time).toLocaleString() + : '...'} + + + +
{JSON.stringify(data, null, 2)}
+ + ); +}; + +export default Home; diff --git a/packages/apps/e2e-overview/src/app/(app)/dashboard/page.tsx b/packages/apps/e2e-overview/src/app/(app)/dashboard/page.tsx new file mode 100644 index 0000000000..2934eacb63 --- /dev/null +++ b/packages/apps/e2e-overview/src/app/(app)/dashboard/page.tsx @@ -0,0 +1,12 @@ +'use client'; +import { AllApps } from '@/components/AllApps/AllApps'; + +const Home = () => { + return ( +
+ +
+ ); +}; + +export default Home; diff --git a/packages/apps/e2e-overview/src/app/(app)/layout.tsx b/packages/apps/e2e-overview/src/app/(app)/layout.tsx new file mode 100644 index 0000000000..0fa492f703 --- /dev/null +++ b/packages/apps/e2e-overview/src/app/(app)/layout.tsx @@ -0,0 +1,51 @@ +'use client'; + +import { CookieConsent } from '@/components/CookieConsent/CookieConsent'; + +import { useUser } from '@/hooks/user'; +import { Link, Stack } from '@kadena/kode-ui'; +import { SideBarLayout, SideBarTopBanner } from '@kadena/kode-ui/patterns'; +import { useEffect } from 'react'; +import { KLogo } from './KLogo'; +import { SideBar } from './SideBar'; + +const RootLayout = ({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) => { + const { user, isMounted } = useUser(); + + useEffect(() => { + if (isMounted && !user) { + window.location.href = '/login'; + } + }, [user, isMounted]); + + if (!isMounted || !user) { + return 'loading...'; + } + + return ( + <> + + + + + + + + } + sidebar={} + > + + {children} + + + + ); +}; + +export default RootLayout; diff --git a/packages/apps/e2e-overview/src/app/(loggedout)/layout.tsx b/packages/apps/e2e-overview/src/app/(loggedout)/layout.tsx new file mode 100644 index 0000000000..c39d9ae86d --- /dev/null +++ b/packages/apps/e2e-overview/src/app/(loggedout)/layout.tsx @@ -0,0 +1,73 @@ +'use client'; + +import { CookieConsent } from '@/components/CookieConsent/CookieConsent'; +import { useUser } from '@/hooks/user'; +import { shortenString } from '@/utils/shortenString'; +import { MonoAccountCircle } from '@kadena/kode-icons'; +import { + Button, + ThemeAnimateIcon, + Link as UILink, + useTheme, +} from '@kadena/kode-ui'; +import { + FocussedLayout, + FocussedLayoutFooter, + FocussedLayoutHeaderAside, + FocussedLayoutProvider, + FocussedLayoutTopBanner, +} from '@kadena/kode-ui/patterns'; +import Link from 'next/link'; +import React from 'react'; + +const RootLayout = ({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) => { + const { theme, rotateTheme } = useTheme(); + const { user, signInByGoogle } = useUser(); + + return ( + <> + + + + + + + {user?.id ? ( + + {shortenString(user?.user_metadata.full_name)} + + ) : ( + + )} + + + + + + + + + + + ); +}; + +export default Sentry.withErrorBoundary(GlobalError, { + fallback: (props) => , + showDialog: true, +}); diff --git a/packages/apps/e2e-overview/src/app/layout.tsx b/packages/apps/e2e-overview/src/app/layout.tsx new file mode 100644 index 0000000000..01c0dcc278 --- /dev/null +++ b/packages/apps/e2e-overview/src/app/layout.tsx @@ -0,0 +1,59 @@ +'use client'; +import { Analytics } from '@/components/Analytics/Analytics'; +import { mediaProviderStyles, Version } from '@kadena/kode-ui'; +import React from 'react'; +import { Providers } from './Providers'; + +const RootLayout = ({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) => { + return ( + + + Kadena.js Test Dashboard + + + + + + + + {/* Android Shortcut icon */} + + {/* Apple touch icon */} + +