Skip to content

Commit

Permalink
chore: testing workflow fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kujo205 committed May 17, 2024
1 parent 0463360 commit 55520dc
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 64 deletions.
40 changes: 16 additions & 24 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
# Since the ".env" file is gitignored, you can use the ".env.example" file to
# build a new ".env" file when you clone the repo. Keep this file up-to-date
# when you add new variables to `.env`.

# This file will be committed to version control, so make sure not to have any
# secrets in it. If you are cloning this repo, create a copy of this file named
# ".env" and populate it with your secrets.

# When adding additional environment variables, the schema in "/src/env.js"
# should be updated accordingly.

# Drizzle
# Get the Database URL from the "prisma" dropdown selector in PlanetScale.
# Change the query params at the end of the URL to "?ssl={"rejectUnauthorized":true}"
DATABASE_URL='mysql://YOUR_MYSQL_URL_HERE?ssl={"rejectUnauthorized":true}'
# DATABASE_URL='mysql://someurlYOUR_MYSQL_URL_HERE?ssl={"rejectUnauthorized":true}'
# DB-related environment variables
DATABASE_URL=

# Next Auth
# You can generate a new secret on the command line with:
# openssl rand -base64 32
# https://next-auth.js.org/configuration/options#secret
NEXTAUTH_SECRET==
NEXTAUTH_SECRET=9df44P4igvwXwXksdJIe3jhB3dnXwJe/PZzjh2WD/6M=
NEXTAUTH_URL="http://localhost:3000"

# Next Auth Discord Provider
GOOGLE_CLIENT_SECRET=
GOOGLE_CLIENT_ID=
# Google creds fot oauth2
GOOGLE_CLIENT_SECRET=foo
GOOGLE_CLIENT_ID=foo

# Telegram stuff
TELEGRAM_BOT_TOKEN=
MY_TELEGRAM_CHAT_ID=
TELEGRAM_BOT_TOKEN=foo
MY_TELEGRAM_CHAT_ID=foo

#AWS S3
S3_ACCESS_KEY=foo
S3_SECRET_ACCESS_KEY=foo
AWS_REGION=foo
BUCKET_NAME=foo

# S3 api stuff
S3_ACCESS_KEY=
S3_SECRET_ACCESS_KEY=
AWS_REGION=
BUCKET_NAME=
#OPENAI API KEY
OPENAI_API_KEY=foo
8 changes: 5 additions & 3 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Playwright Tests
on:
push:
branches: [ main, master ]
branches: [ main, dev ]
pull_request:
branches: [ main, master ]
branches: [ main, dev ]
jobs:
test:
timeout-minutes: 60
Expand All @@ -14,11 +14,13 @@ jobs:
with:
node-version: lts/*
- name: Install dependencies
run: npm install -g pnpm && pnpm install
run: npm install -g pnpm@8.14.0 && pnpm install
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
run: pnpm exec playwright test
env:
PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.target_url }}
- uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
60 changes: 23 additions & 37 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import { defineConfig, devices } from '@playwright/test';

import { defineConfig, devices } from "@playwright/test";
import * as process from "node:process";
import { readFileSync } from "node:fs";
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
// require("dotenv").config();

/**
* See https://playwright.dev/docs/test-configuration.
*/

// @ts-expect-error: types suck
const env = readFileSync(".env.example", "utf8") as Record<string, string>;

export default defineConfig({
testDir: './tests',
testDir: "./tests",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
Expand All @@ -20,58 +25,39 @@ export default defineConfig({
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
trace: "on-first-retry",
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
name: "webkit",
use: { ...devices["Desktop Safari"] },
},

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],

/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
webServer: {
command: "pnpm dev",
url: "http://127.0.0.1:3000",
reuseExistingServer: !process.env.CI,
env: env,
},
});

0 comments on commit 55520dc

Please sign in to comment.