-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve test handling, prepares for e2e runs (#514)
- Loading branch information
Showing
9 changed files
with
95 additions
and
74 deletions.
There are no files selected for viewing
This file contains 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,2 +1,7 @@ | ||
.svelte-kit | ||
build | ||
# ignore SvelteKit output | ||
/.svelte-kit | ||
/build | ||
# ignore test state files | ||
/playwright/* | ||
# ignore test report files | ||
/playwright-report |
This file contains 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 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,19 +1,39 @@ | ||
import { defineConfig, devices } from '@playwright/test' | ||
import { loadEnvVars } from './vite.config' | ||
import type { PlaywrightTestConfig } from '@playwright/test' | ||
import { z } from 'zod' | ||
|
||
loadEnvVars() | ||
process.env.IS_TEST = 'true' | ||
|
||
const config: PlaywrightTestConfig = { | ||
// define the base set of env vars needed to run tests | ||
// tests that are opt-in (like webhook tests) should not have their env vars set here | ||
const env_schema = z.object({ | ||
TEST_HOST: z.string().default('http://localhost:3000/'), | ||
DISCORD_GUILD_ID: z.string(), | ||
// add more required env vars here as necessary | ||
}) | ||
// ensure necessary env vars are available | ||
export const env = env_schema.parse(process.env) | ||
|
||
export default defineConfig({ | ||
forbidOnly: !!process.env.CI, | ||
reporter: process.env.CI | ||
? [['html', { open: 'never' }]] | ||
: [['html', { open: 'on-failure' }]], | ||
workers: process.env.CI ? 1 : undefined, | ||
webServer: { | ||
command: 'pnpm run build-app && pnpm run preview', | ||
reuseExistingServer: !process.env.CI, | ||
command: 'pnpm run preview', | ||
port: 3000, | ||
}, | ||
projects: [ | ||
{ | ||
use: devices['Desktop Chrome'], | ||
retries: 0, | ||
}, | ||
], | ||
testDir: 'tests', | ||
testMatch: /(.+\.)?(test|spec)\.[jt]s/, | ||
testMatch: '**/*.test.ts', | ||
use: { | ||
baseURL: 'http://localhost:3000/', | ||
baseURL: env.TEST_HOST, | ||
}, | ||
} | ||
|
||
export default config | ||
}) |
This file contains 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 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 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
22 changes: 0 additions & 22 deletions
22
apps/discord-bot-frontend/tests/setup/github-secrets-enabled.ts
This file was deleted.
Oops, something went wrong.
This file contains 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 was deleted.
Oops, something went wrong.