Skip to content

Commit

Permalink
configuring e2e CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
redstar504 committed Jun 4, 2024
1 parent 0f21b80 commit 60c7550
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ on:
pull_request:
branches: [ main, master ]
jobs:
test:
e2e-test:
env:
CI: true
E2E_PORT: 4000
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
Expand All @@ -17,8 +20,6 @@ jobs:
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run demo server
run: npm run dev
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"build:demo": "tsc && vite build",
"build:lib": "tsc && vite build --config vite.config.lib.ts",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"start-test-server": "npm run preview -- --port 4000",
"preview": "vite preview"
},
"peerDependencies": {
Expand Down
12 changes: 7 additions & 5 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { defineConfig, devices } from '@playwright/test';
/**
* See https://playwright.dev/docs/test-configuration.
*/

export default defineConfig({
testDir: './tests/e2e',
/* Run tests in files in parallel */
Expand Down Expand Up @@ -69,9 +70,10 @@ 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: 'npm run start-test-server',
url: 'http://localhost:4000/lexical-anchorpoint/',
reuseExistingServer: true,
timeout: 120 * 1000,
}
});
4 changes: 2 additions & 2 deletions tests/e2e/example.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test';
import { prettifyHTML } from '../utils'

test('typing plain text in the editor', async ({page}) => {
await page.goto('http://localhost:5172')
await page.goto('http://localhost:4000/lexical-anchorpoint/')
const editor = page.locator('div[contenteditable=true]').first()
await editor.focus()
await page.keyboard.type('hello world')
Expand All @@ -19,7 +19,7 @@ test('typing plain text in the editor', async ({page}) => {
})

test('typing links into the editor', async ({page}) => {
await page.goto('http://localhost:5172')
await page.goto('http://localhost:4000/lexical-anchorpoint/')
const editor = page.locator('div[contenteditable=true]').first()
await editor.focus()
await page.keyboard.type(
Expand Down

0 comments on commit 60c7550

Please sign in to comment.