Skip to content

Commit

Permalink
Add playwright tests with Github action
Browse files Browse the repository at this point in the history
  • Loading branch information
bluprince13 committed May 27, 2024
1 parent fa6b196 commit b7b5f93
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 471 deletions.
35 changes: 19 additions & 16 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { defineConfig, devices } from '@playwright/test'

const PORT = process.env.PORT || 3000
const BASE_URL = process.env.BASE_URL || `http://localhost:${PORT}`

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
Expand All @@ -24,7 +27,7 @@ export default defineConfig({
/* 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',
baseURL: BASE_URL,

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry'
Expand All @@ -35,17 +38,17 @@ export default defineConfig({
{
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. */
// {
Expand All @@ -66,12 +69,12 @@ export default defineConfig({
// 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: 'yarn dev',
url: BASE_URL,
reuseExistingServer: !process.env.CI
}
})
Loading

0 comments on commit b7b5f93

Please sign in to comment.