Skip to content

Commit

Permalink
feat: add e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marsidev committed Oct 18, 2022
1 parent 0248cf8 commit 7d2b173
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 152 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ logs
node_modules
temp
.vercel
test/output
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"lint:fix": "eslint . --fix",
"prepublishOnly": "nr build",
"release": "bumpp && npm publish",
"test": "vitest",
"test": "pnpm test:e2e",
"test:e2e": "npx playwright test",
"typecheck": "tsc --noEmit",
"example:dev": "pnpm build && pnpm run --filter=example dev",
"example:build": "pnpm run --filter=example build",
Expand All @@ -48,15 +49,15 @@
"devDependencies": {
"@antfu/ni": "0.17.2",
"@antfu/utils": "0.5.2",
"@playwright/test": "1.27.1",
"@types/react": "18.0.21",
"@types/react-dom": "18.0.6",
"bumpp": "8.2.1",
"eslint-config-marsi": "workspace:*",
"pnpm": "7.12.1",
"rimraf": "3.0.2",
"typescript": "4.8.4",
"unbuild": "0.8.8",
"vitest": "0.22.1"
"unbuild": "0.8.8"
},
"keywords": [
"turnstile",
Expand Down
49 changes: 49 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import type { PlaywrightTestConfig } from '@playwright/test'
import { devices } from '@playwright/test'

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

// Reference: https://playwright.dev/docs/test-configuration
const config: PlaywrightTestConfig = {
timeout: 30 * 1000,
testDir: 'test',
testMatch: 'test/e2e.test.ts',
forbidOnly: Boolean(process.env.CI),
retries: process.env.CI ? 2 : 0,

// Run your local dev server before starting the tests:
// https://playwright.dev/docs/test-advanced#launching-a-development-web-server-during-the-tests
webServer: {
command: 'pnpm run --filter=example dev',
url: baseURL,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI
},

use: {
trace: 'retry-with-trace',
headless: true,
baseURL
},

projects: [
{
name: 'Desktop Chrome',
use: {
...devices['Desktop Chrome']
}
}
// {
// name: 'Mobile Chrome',
// use: {
// ...devices['Pixel 5']
// }
// },
// {
// name: 'Mobile Safari',
// use: devices['iPhone 13']
// }
]
}
export default config
152 changes: 17 additions & 135 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

1 comment on commit 7d2b173

@vercel
Copy link

@vercel vercel bot commented on 7d2b173 Oct 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

react-turnstile – ./

react-turnstile.vercel.app
react-turnstile-marsi.vercel.app
react-turnstile-git-main-marsi.vercel.app

Please sign in to comment.