-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50732d0
commit e2ce848
Showing
11 changed files
with
72 additions
and
12 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,3 @@ | ||
VITE_API_BASE_URL=https://api.dev.zoo.dev | ||
VITE_SITE_BASE_URL=https://dev.zoo.dev | ||
PLAYWRIGHT_SESSION_COOKIE='0f93cf23-6604-43dd-911a-c98e2c641848' |
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
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,12 +1,42 @@ | ||
import type { PlaywrightTestConfig } from '@playwright/test' | ||
import { AUTH_COOKIE_NAME } from './src/lib/cookies' | ||
import dotenv from 'dotenv' | ||
import path from 'path' | ||
|
||
dotenv.config({ path: path.resolve(path.dirname('.'), '.env.development') }) | ||
const expiration = new Date() | ||
expiration.setFullYear(expiration.getFullYear() + 1) | ||
|
||
const config: PlaywrightTestConfig = { | ||
use: { | ||
baseURL: 'https://localhost:3000', | ||
storageState: { | ||
cookies: [ | ||
{ | ||
name: AUTH_COOKIE_NAME, | ||
value: process.env.PLAYWRIGHT_SESSION_COOKIE ?? '', | ||
domain: 'localhost', | ||
path: '/', | ||
expires: expiration.getTime() / 1000, | ||
httpOnly: true, | ||
secure: true, | ||
sameSite: 'None' | ||
} | ||
], | ||
origins: [ | ||
{ | ||
origin: 'https://localhost:3000', | ||
localStorage: [] | ||
} | ||
] | ||
} | ||
}, | ||
webServer: { | ||
command: 'npm run build && npm run preview', | ||
port: 4173 | ||
command: 'yarn dev', | ||
port: 3000 | ||
}, | ||
testDir: 'tests', | ||
testMatch: /(.+\.)?(test|spec)\.[jt]s/ | ||
testMatch: /(.+\.)?(playwright)\.[jt]s/ | ||
} | ||
|
||
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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test('Redirects to the dashboard from home when logged-in', async ({ page }) => { | ||
// Go to the home page | ||
await page.goto('https://localhost:3000') | ||
|
||
// Assert that we are now on the dashboard | ||
await page.waitForURL('**/dashboard', { waitUntil: 'domcontentloaded' }) | ||
await expect(page.locator('h1')).toHaveText('Text-to-CAD') | ||
await expect(page.locator('textarea')).toBeFocused() | ||
}) |
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