-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
test(vue-start): basic-cloudflare, basic-auth #6137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
105a282
basic-cloudflare vue
birkskyum 95b2d17
port to vue
birkskyum 7283bed
port cloudflare
birkskyum c9f7729
port cloudflare tests
birkskyum 5d6a952
basic-auth
birkskyum 8fe4535
fix vue basic-auth
birkskyum 9203ac1
vue-start
birkskyum a8b9abb
show error display in solid
birkskyum 597d305
fix test in solid-start
birkskyum d8eea71
fix solid-start test suite
birkskyum 3eaefeb
vue-start User model
birkskyum 6fe8ae5
ci: apply automated fixes
autofix-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,3 +18,4 @@ yarn.lock | |
| /playwright-report/ | ||
| /blob-report/ | ||
| /playwright/.cache/ | ||
| .tmp/ | ||
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,16 @@ | ||
| import { test as setup } from '@playwright/test' | ||
|
|
||
| import { PrismaClient } from '@prisma/client' | ||
|
|
||
| const prismaClient = new PrismaClient() | ||
| import { hashPassword, prismaClient } from '../src/utils/prisma' | ||
|
|
||
| setup('create new database', async () => { | ||
| if ( | ||
| await prismaClient.user.findUnique({ | ||
| where: { | ||
| email: 'test2@gmail.com', | ||
| }, | ||
| }) | ||
| ) { | ||
| await prismaClient.user.delete({ | ||
| where: { | ||
| email: 'test2@gmail.com', | ||
| }, | ||
| }) | ||
| } | ||
| await prismaClient.user.deleteMany() | ||
|
|
||
| const email = 'test@gmail.com' | ||
| const password = await hashPassword('test') | ||
| await prismaClient.user.create({ | ||
| data: { | ||
| email, | ||
| password, | ||
| }, | ||
| }) | ||
| }) |
27 changes: 11 additions & 16 deletions
27
e2e/solid-start/basic-auth/tests/mock-db-teardown.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,16 @@ | ||
| import { test as teardown } from '@playwright/test' | ||
|
|
||
| import { PrismaClient } from '@prisma/client' | ||
|
|
||
| const prismaClient = new PrismaClient() | ||
| import { hashPassword, prismaClient } from '../src/utils/prisma' | ||
|
|
||
| teardown('create new database', async () => { | ||
| if ( | ||
| await prismaClient.user.findUnique({ | ||
| where: { | ||
| email: 'test2@gmail.com', | ||
| }, | ||
| }) | ||
| ) { | ||
| await prismaClient.user.delete({ | ||
| where: { | ||
| email: 'test2@gmail.com', | ||
| }, | ||
| }) | ||
| } | ||
| await prismaClient.user.deleteMany() | ||
|
|
||
| const email = 'test@gmail.com' | ||
| const password = await hashPassword('test') | ||
| await prismaClient.user.create({ | ||
| data: { | ||
| email, | ||
| password, | ||
| }, | ||
| }) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Environment variables declared in this file are automatically made available to Prisma. | ||
| # See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema | ||
|
|
||
| # Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB. | ||
| # See the documentation for all the connection string options: https://pris.ly/d/connection-strings | ||
|
|
||
| DATABASE_URL="file:./dev.db" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| node_modules | ||
| package-lock.json | ||
| yarn.lock | ||
|
|
||
| !.env | ||
| .DS_Store | ||
| .cache | ||
| .vercel | ||
| .output | ||
|
|
||
| /build/ | ||
| /api/ | ||
| /server/build | ||
| /public/build | ||
| # Sentry Config File | ||
| .env.sentry-build-plugin | ||
| /test-results/ | ||
| /playwright-report/ | ||
| /blob-report/ | ||
| /playwright/.cache/ | ||
| .tmp/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| **/build | ||
| **/public | ||
| pnpm-lock.yaml | ||
| routeTree.gen.ts |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { | ||
| "name": "tanstack-vue-start-e2e-basic-auth", | ||
| "private": true, | ||
| "sideEffects": false, | ||
| "type": "module", | ||
| "scripts": { | ||
| "dev": "vite dev --port 3000", | ||
| "dev:e2e": "vite dev", | ||
| "build": "vite build && tsc --noEmit", | ||
| "preview": "vite preview", | ||
| "start": "pnpx srvx --prod -s ../client dist/server/server.js", | ||
| "prisma-generate": "prisma generate", | ||
| "test:e2e": "rm -rf port*.txt; mkdir -p .tmp; rm -f .tmp/dev.db .tmp/dev.db-journal .tmp/dev.db-wal .tmp/dev.db-shm; export DATABASE_URL=file:./.tmp/dev.db; pnpm run prisma-generate && pnpm exec prisma migrate deploy && playwright test --project=chromium" | ||
| }, | ||
| "dependencies": { | ||
| "@libsql/client": "^0.15.15", | ||
| "@prisma/adapter-libsql": "^7.0.0", | ||
| "@prisma/client": "^7.0.0", | ||
| "@tanstack/vue-router": "workspace:^", | ||
| "@tanstack/vue-router-devtools": "workspace:^", | ||
| "@tanstack/vue-start": "workspace:^", | ||
| "redaxios": "^0.5.1", | ||
| "tailwind-merge": "^2.6.0", | ||
| "vite": "^7.1.7", | ||
| "vue": "^3.5.25" | ||
| }, | ||
| "devDependencies": { | ||
| "@playwright/test": "^1.50.1", | ||
| "@tailwindcss/postcss": "^4.1.15", | ||
| "@tanstack/router-e2e-utils": "workspace:^", | ||
| "@types/node": "^22.10.2", | ||
| "dotenv": "^17.2.3", | ||
| "postcss": "^8.5.1", | ||
| "prisma": "^7.0.0", | ||
| "srvx": "^0.9.8", | ||
| "tailwindcss": "^4.1.17", | ||
| "typescript": "^5.7.2", | ||
| "@vitejs/plugin-vue": "^6.0.3", | ||
| "@vitejs/plugin-vue-jsx": "^5.1.2", | ||
| "vite-tsconfig-paths": "^5.1.4" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { defineConfig, devices } from '@playwright/test' | ||
| import { getTestServerPort } from '@tanstack/router-e2e-utils' | ||
| import packageJson from './package.json' with { type: 'json' } | ||
|
|
||
| const PORT = await getTestServerPort(packageJson.name) | ||
| const baseURL = `http://localhost:${PORT}` | ||
| /** | ||
| * See https://playwright.dev/docs/test-configuration. | ||
| */ | ||
| export default defineConfig({ | ||
| testDir: './tests', | ||
| workers: 1, | ||
|
|
||
| reporter: [['line']], | ||
|
|
||
| use: { | ||
| /* Base URL to use in actions like `await page.goto('/')`. */ | ||
| baseURL, | ||
| }, | ||
|
|
||
| webServer: { | ||
| command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`, | ||
| url: baseURL, | ||
| reuseExistingServer: !process.env.CI, | ||
| stdout: 'pipe', | ||
| }, | ||
|
|
||
| projects: [ | ||
| { | ||
| name: 'chromium', | ||
| use: { ...devices['Desktop Chrome'] }, | ||
| }, | ||
| ], | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export default { | ||
| plugins: { | ||
| '@tailwindcss/postcss': {}, | ||
| }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import 'dotenv/config' | ||
| import { defineConfig, env } from 'prisma/config' | ||
|
|
||
| export default defineConfig({ | ||
| schema: './prisma/schema.prisma', | ||
| migrations: { | ||
| path: './prisma/migrations', | ||
| }, | ||
| datasource: { | ||
| url: env('DATABASE_URL'), | ||
| }, | ||
| }) |
8 changes: 8 additions & 0 deletions
8
e2e/vue-start/basic-auth/prisma/migrations/20240811183753_init/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| -- CreateTable | ||
| CREATE TABLE "User" ( | ||
| "email" TEXT NOT NULL PRIMARY KEY, | ||
| "password" TEXT NOT NULL | ||
| ); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); |
3 changes: 3 additions & 0 deletions
3
e2e/vue-start/basic-auth/prisma/migrations/migration_lock.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Please do not edit this file manually | ||
| # It should be added in your version-control system (i.e. Git) | ||
| provider = "sqlite" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test description is misleading.
The teardown test is named "create new database" but it's performing cleanup operations. While the logic (deleting all users and recreating the test user) may be intentional to reset to a known state, the test name should reflect its teardown purpose more accurately.
🔎 Consider renaming the test:
📝 Committable suggestion
🤖 Prompt for AI Agents