Skip to content

Commit

Permalink
initial playwright integration test setup
Browse files Browse the repository at this point in the history
jackiequach committed Apr 18, 2024
1 parent f346346 commit c0202df
Showing 4 changed files with 113 additions and 1 deletion.
62 changes: 61 additions & 1 deletion package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"cypress:run:chrome": "cypress run --browser chrome",
"playwright": "playwright test",
"prettier": "prettier --write --ignore-path .eslintignore .",
"prettier:check": "prettier --check --ignore-path .eslintignore .",
"lint": "eslint --fix .",
@@ -70,6 +71,7 @@
"@babel/core": "7.24.3",
"@emotion/jest": "11.11.0",
"@parcel/transformer-typescript-tsc": "2.12.0",
"@playwright/test": "1.43.1",
"@testing-library/cypress": "8.0.2",
"@testing-library/jest-dom": "6.1.3",
"@testing-library/react": "14.0.0",
42 changes: 42 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
// Look for test files in the "tests" directory, relative to this configuration file.
testDir: 'playwright/integration',

// Run all tests in parallel.
fullyParallel: true,

// Fail the build on CI if you accidentally left test.only in the source code.
forbidOnly: !!process.env.CI,

// Retry on CI only.
retries: process.env.CI ? 2 : 0,

// Opt out of parallel tests on CI.
// workers: process.env.CI ? 1 : undefined,

// Reporter to use
reporter: 'html',

use: {
// Base URL to use in actions like `await page.goto('/')`.
baseURL: 'http://127.0.0.1:1234',
},
// Configure projects for major browsers.
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
},
},
],
// You can either build the app and let playwright start the prod server,
// or run a dev server and playwright will use that instead.
webServer: {
command: 'npm run example',
url: 'http://127.0.0.1:1234',
reuseExistingServer: !process.env.CI,
},
});
8 changes: 8 additions & 0 deletions playwright/integration/basic-test.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// basic test for iniial setup
import { test, expect } from '@playwright/test';

test('basic test', async ({ page }) => {
await page.goto('https://playwright.dev/');
await page.locator('text=Get started').click();
await expect(page).toHaveTitle(/Installation | Playwright/);
});

0 comments on commit c0202df

Please sign in to comment.