Skip to content

Commit

Permalink
actually test app
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexErrant committed Nov 8, 2024
1 parent 8c41779 commit f644645
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
19 changes: 12 additions & 7 deletions app-playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { defineConfig, devices } from '@playwright/test'
// dotenv.config({ path: path.resolve(__dirname, '.env') });

const isCI = Boolean(process.env.CI)
const baseURL = isCI
? 'https://localhost:3013'
: 'https://app.pentive.localhost:3013'

/**
* See https://playwright.dev/docs/test-configuration.
Expand All @@ -28,7 +31,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,

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
Expand All @@ -43,7 +46,7 @@ export default defineConfig({

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

{
Expand Down Expand Up @@ -73,9 +76,11 @@ export default defineConfig({
],

/* 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 run preview',
cwd: '../app',
url: baseURL,
ignoreHTTPSErrors: true,
reuseExistingServer: false, // always use a new server because tests require a prod build due to plugins.
},
})
4 changes: 2 additions & 2 deletions app-playwright/tests/example.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { test, expect } from '@playwright/test'

test('has title', async ({ page }) => {
await page.goto('https://playwright.dev/')
await page.goto('/')

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Playwright/)
await expect(page).toHaveTitle(/Pentive App/)
})

test('get started link', async ({ page }) => {
Expand Down
5 changes: 5 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
"shared-dom#tsc-build"
]
},
"app-playwright#test:run": {
"dependsOn": [
"app#build"
]
},
"deploy": {
"dependsOn": [
"build"
Expand Down

0 comments on commit f644645

Please sign in to comment.