From b09e856d4124c81485b1215b5e2b7bbbdc95fc8e Mon Sep 17 00:00:00 2001 From: Bruce Anderson Date: Sun, 16 Apr 2023 22:13:23 -0400 Subject: [PATCH] 0.0.3 --- .github/workflows/CI.yml | 18 +++++++++++ playwright.config.ts | 28 +++++++++++++++++ tests/hemingway.html | 65 ++++++++++++++++++++++++++++++++++++++++ tests/test1.spec.mjs | 9 ++++++ 4 files changed, 120 insertions(+) create mode 100644 .github/workflows/CI.yml create mode 100644 playwright.config.ts create mode 100644 tests/hemingway.html create mode 100644 tests/test1.spec.mjs diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..540b896 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,18 @@ +name: Playwright Tests +on: [push] +jobs: + test: + timeout-minutes: 10 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '16.x' + - name: Install dependencies + run: npm ci + - name: Install Playwright + run: npx playwright install --with-deps + - name: Run Playwright tests + run: npm run test + \ No newline at end of file diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 0000000..37ab3b3 --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,28 @@ +// playwright.config.ts +import { PlaywrightTestConfig, devices } from '@playwright/test'; +const config: PlaywrightTestConfig = { + webServer: { + command: 'npm run serve', + url: 'http://localhost:3030/', + timeout: 120 * 1000, + reuseExistingServer: !process.env.CI, + }, + use: { + baseURL: 'http://localhost:3030/', + }, + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + { + name: 'firefox', + use: { ...devices['Desktop Firefox'] }, + }, + { + name: 'webkit', + use: { ...devices['Desktop Safari'] }, + }, + ], +}; +export default config; \ No newline at end of file diff --git a/tests/hemingway.html b/tests/hemingway.html new file mode 100644 index 0000000..b091bb2 --- /dev/null +++ b/tests/hemingway.html @@ -0,0 +1,65 @@ + + + + + + + Document + + +
+ + + Hello + +
+ +
+ + + + + \ No newline at end of file diff --git a/tests/test1.spec.mjs b/tests/test1.spec.mjs new file mode 100644 index 0000000..1334be6 --- /dev/null +++ b/tests/test1.spec.mjs @@ -0,0 +1,9 @@ +import { test, expect } from '@playwright/test'; +test('test1', async ({ page }) => { + await page.goto('./tests/hemingway.html'); + // wait for 12 seconds + await page.waitForTimeout(12000); + const editor = page.locator('#target'); + await expect(editor).toHaveAttribute('mark', 'good'); +}); +