-
Notifications
You must be signed in to change notification settings - Fork 7
Run Playwright E2E tests in CI #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
kumaradityaraj
wants to merge
22
commits into
serverlessworkflow:main
from
kumaradityaraj:playwrightCi
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ab9ca79
PlaywrightSetup
kumaradityaraj aaff34b
Syncing upstream
kumaradityaraj 73947d8
Copilots suggestions
kumaradityaraj 27060af
playwright ci setup
kumaradityaraj 4a71dbb
updating node version
kumaradityaraj ae60d0b
updating version
kumaradityaraj 884fa3e
updating version
kumaradityaraj e454700
lockfile
kumaradityaraj e53e3b2
pnpm
kumaradityaraj 18522e6
report setup
kumaradityaraj fa13655
setting up just for ubuntu
kumaradityaraj 776a955
setting up just for ubuntu
kumaradityaraj a840279
updating test for CI
kumaradityaraj edc40a5
commenting for testing
kumaradityaraj f5c14e6
ss for testing
kumaradityaraj 1240797
ss for testing
kumaradityaraj 85a7584
ss for testing
kumaradityaraj a2b0286
ss for testing
kumaradityaraj 2af1c4d
basic setup passing
kumaradityaraj 8773eea
extending for macos and windows
kumaradityaraj db8e565
report in different files
kumaradityaraj bacbeba
copilot suggestion
kumaradityaraj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,71 @@ | ||
| # | ||
| # Copyright 2021-Present The Serverless Workflow Specification Authors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
| name: Playwright E2E Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: ["**"] | ||
| types: [opened, reopened, ready_for_review, synchronize] | ||
|
|
||
| jobs: | ||
| e2e: | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
|
|
||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 24 | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v5 | ||
| with: | ||
| version: 10.31.0 | ||
| run_install: false | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
kumaradityaraj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Build and test | ||
| run: pnpm build:prod | ||
|
|
||
| - name: Install Playwright browsers (Linux) | ||
| if: matrix.os == 'ubuntu-latest' | ||
| run: pnpm --filter @serverlessworkflow/playwright exec playwright install --with-deps | ||
|
|
||
| - name: Install Playwright browsers (macOS/Windows) | ||
| if: matrix.os != 'ubuntu-latest' | ||
| run: pnpm --filter @serverlessworkflow/playwright exec playwright install | ||
|
|
||
| - name: Run Playwright tests | ||
| run: pnpm --filter @serverlessworkflow/playwright test | ||
|
|
||
| - name: Upload Playwright Report | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: playwright-report-${{ matrix.os }} | ||
| path: packages/playwright/playwright-report | ||
This file contains hidden or 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 hidden or 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,37 @@ | ||
| <!-- | ||
| Copyright 2021-Present The Serverless Workflow Specification Authors | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| --> | ||
|
|
||
| # Playwright E2E Setup (Monorepo - pnpm) | ||
|
|
||
| This document explains how to set up and run Playwright end-to-end (E2E) tests for packages inside this monorepo. | ||
|
|
||
| --- | ||
|
|
||
| ## Configure Playwright | ||
|
|
||
| - Configure Playwright in playwright.config.ts for the package which you want to write tests for. | ||
| - Add an endpoint for that package and make sure it is the same port where the package/app starts. | ||
| - Navigate to tests folder and create a file with the package name which you want to write tests for and write all the tests in it. | ||
|
|
||
| ## Steps for testing | ||
|
|
||
| - Run the command for testing :- | ||
| - pnpm --filter @packageName test | ||
| - Eg- pnpm --filter @serverlessworkflow/playwright test | ||
|
|
||
| - For testing it in UI :- | ||
| - pnpm --filter @packageName test:ui | ||
| - Eg- pnpm --filter @serverlessworkflow/playwright test:ui |
This file contains hidden or 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,17 @@ | ||
| { | ||
| "name": "@serverlessworkflow/playwright", | ||
| "version": "1.0.0", | ||
kumaradityaraj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "description": "", | ||
| "keywords": [], | ||
| "license": "Apache-2.0", | ||
| "author": "", | ||
kumaradityaraj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "scripts": { | ||
| "test": "playwright test", | ||
| "test:ui": "playwright test --ui" | ||
| }, | ||
| "devDependencies": { | ||
| "@playwright/test": "^1.59.1", | ||
kumaradityaraj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "@types/node": "catalog:" | ||
| }, | ||
| "packageManager": "pnpm@10.31.0" | ||
kumaradityaraj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
This file contains hidden or 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,35 @@ | ||
| /* | ||
| * Copyright 2021-Present The Serverless Workflow Specification Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import { defineConfig } from "@playwright/test"; | ||
|
|
||
| export default defineConfig({ | ||
| testDir: "./tests", | ||
|
|
||
| reporter: [["html", { open: "never" }]], | ||
|
|
||
| use: { | ||
| baseURL: "http://localhost:6006", | ||
| headless: true, | ||
| }, | ||
kumaradityaraj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| webServer: { | ||
| command: "pnpm --filter @serverlessworkflow/diagram-editor start", | ||
| url: "http://localhost:6006", | ||
| reuseExistingServer: !process.env.CI, | ||
| timeout: 120 * 1000, | ||
| }, | ||
| }); | ||
This file contains hidden or 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,42 @@ | ||
| /* | ||
| * Copyright 2021-Present The Serverless Workflow Specification Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import { test, expect } from "@playwright/test"; | ||
|
|
||
| test("diagram editor renders correctly", async ({ page }) => { | ||
| await page.goto("/iframe.html?id=example-diagrameditor--component"); | ||
|
|
||
| // Wait for main container | ||
| await expect(page.getByTestId("diagram-container")).toBeVisible(); | ||
|
|
||
| // Check at least one specific node | ||
| await expect(page.getByTestId("rf__node-n1")).toBeVisible(); | ||
|
|
||
| // Check total nodes | ||
| const nodes = page.locator('[data-testid^="rf__node-"]'); | ||
| await expect(nodes).toHaveCount(5); | ||
|
|
||
| // Check total edges | ||
| const edges = page.locator('[data-testid^="rf__edge-"]'); | ||
kumaradityaraj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| await expect(edges).toHaveCount(5); | ||
|
|
||
| // Verify the diagram rendered at least one node and one edge | ||
| const nodesCount = page.locator('[data-testid^="rf__node-"]'); | ||
| await expect(await nodesCount.count()).toBeGreaterThan(0); | ||
|
|
||
| const edgesCount = page.locator('[data-testid^="rf__edge-"]'); | ||
| await expect(await edgesCount.count()).toBeGreaterThan(0); | ||
kumaradityaraj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }); | ||
This file contains hidden or 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,10 @@ | ||
| { | ||
| "extends": "../../tsconfig.base.json", | ||
| "compilerOptions": { | ||
| "types": ["node"], | ||
| "baseUrl": ".", | ||
| "declaration": true, | ||
| "declarationMap": true, | ||
| "sourceMap": true | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.