-
-
Notifications
You must be signed in to change notification settings - Fork 12
test: setup E2E testing via Playwright and implement some tests #88
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
Open
pkerschbaum
wants to merge
5
commits into
eslint:main
Choose a base branch
from
pkerschbaum:test/setup-e2e-test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
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
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
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,59 @@ | ||
/** | ||
* Tests for code editing functionality and AST tool interaction. | ||
*/ | ||
import test, { expect } from "@playwright/test"; | ||
|
||
/** | ||
* This test verifies that: | ||
* - Users can edit code in the editor | ||
* - The AST updates in response to code changes | ||
* - ESQuery selectors correctly highlight matching code and AST nodes | ||
* - AST node expansion functionality works properly | ||
*/ | ||
test(`should change code, then highlight code and AST nodes matching ESQuery selector`, async ({ | ||
page, | ||
}) => { | ||
await page.goto("/"); | ||
|
||
// focus code editor textbox | ||
await page | ||
.getByRole("region", { name: "Code Editor Panel" }) | ||
.getByRole("textbox") | ||
.nth(1) | ||
.click(); | ||
|
||
// delete the default code | ||
await page.keyboard.press("Control+KeyA"); | ||
await page.keyboard.press("Backspace"); | ||
|
||
// add new code | ||
await page.keyboard.type("console.log('Hello, World!');"); | ||
|
||
// add an ESQuery selector | ||
await page.getByRole("textbox", { name: "ESQuery Selector" }).click(); | ||
await page.keyboard.type("CallExpression"); | ||
|
||
// wait for the debounced update of the AST to happen | ||
await expect( | ||
page | ||
.getByRole("listitem") | ||
.filter({ hasText: "end" }) | ||
.filter({ hasText: "29" }), | ||
).toBeVisible(); | ||
|
||
// expand AST nodes for ExpressionStatement and CallExpression | ||
await page | ||
.getByRole("region", { name: "Program" }) | ||
.getByRole("listitem") | ||
.filter({ hasText: "Array" }) | ||
.getByRole("button", { name: "Toggle Property" }) | ||
.click(); | ||
await page.getByRole("button", { name: "ExpressionStatement" }).click(); | ||
await page | ||
.getByRole("region", { name: "ExpressionStatement" }) | ||
.getByLabel("Toggle Property") | ||
.click(); | ||
|
||
// screenshot | ||
await expect(page).toHaveScreenshot(); | ||
}); |
Binary file added
BIN
+64.9 KB
...en-highlight-code-and-AST-nodes-matching-ESQuery-selector-1-chromium-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+97.1 KB
...hen-highlight-code-and-AST-nodes-matching-ESQuery-selector-1-firefox-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+77.4 KB
...then-highlight-code-and-AST-nodes-matching-ESQuery-selector-1-webkit-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,24 @@ | ||
/** | ||
* Tests for theme switching functionality. | ||
*/ | ||
|
||
import { test, expect } from "@playwright/test"; | ||
|
||
/** | ||
* This test verifies that: | ||
* - The application shows light theme by default | ||
* - Users can toggle between light and dark themes | ||
* - Theme changes are visually reflected in the UI | ||
*/ | ||
test("should show light theme by default and switch to dark theme", async ({ | ||
page, | ||
}) => { | ||
await page.goto("/"); | ||
|
||
await expect(page).toHaveScreenshot("light-theme.png"); | ||
|
||
await page.getByRole("button", { name: "Toggle theme" }).click(); | ||
await page.getByRole("menuitem", { name: "Dark" }).click(); | ||
|
||
await expect(page).toHaveScreenshot("dark-theme.png"); | ||
}); |
Binary file added
BIN
+82.4 KB
e2e-tests/light-dark-theme.spec.ts-snapshots/dark-theme-chromium-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+120 KB
e2e-tests/light-dark-theme.spec.ts-snapshots/dark-theme-firefox-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+100 KB
e2e-tests/light-dark-theme.spec.ts-snapshots/dark-theme-webkit-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+85.2 KB
e2e-tests/light-dark-theme.spec.ts-snapshots/light-theme-chromium-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+121 KB
e2e-tests/light-dark-theme.spec.ts-snapshots/light-theme-firefox-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+104 KB
e2e-tests/light-dark-theme.spec.ts-snapshots/light-theme-webkit-docker.png
Unable to render rich display
Invalid image source.
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,33 @@ | ||
/** | ||
* Tests for language selection and options panel functionality. | ||
*/ | ||
import { test, expect } from "@playwright/test"; | ||
|
||
/** | ||
* This test verifies that: | ||
* - Users can open the language options popover | ||
* - Users can switch between supported languages (JavaScript, JSON, Markdown, CSS) | ||
* - For each language the entire page is correctly rendered | ||
*/ | ||
test("should switch language and show options for each", async ({ page }) => { | ||
await page.goto("/"); | ||
|
||
await page.getByRole("button", { name: "Language Options" }).click(); | ||
|
||
await expect(page).toHaveScreenshot("page-javascript.png"); | ||
|
||
await page.getByRole("combobox", { name: "Language" }).click(); | ||
await page.getByRole("option", { name: "JSON JSON" }).click(); | ||
|
||
await expect(page).toHaveScreenshot("page-json.png"); | ||
|
||
await page.getByRole("combobox", { name: "Language" }).click(); | ||
await page.getByRole("option", { name: "Markdown Markdown" }).click(); | ||
|
||
await expect(page).toHaveScreenshot("page-markdown.png"); | ||
|
||
await page.getByRole("combobox", { name: "Language" }).click(); | ||
await page.getByRole("option", { name: "CSS CSS" }).click(); | ||
|
||
await expect(page).toHaveScreenshot("page-css.png"); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+99.4 KB
e2e-tests/options.spec.ts-snapshots/page-javascript-chromium-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+138 KB
e2e-tests/options.spec.ts-snapshots/page-javascript-firefox-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+90.4 KB
e2e-tests/options.spec.ts-snapshots/page-markdown-chromium-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,33 @@ | ||
/** | ||
* Tests for the Code Analysis Tools Panel. | ||
*/ | ||
import { test, expect } from "@playwright/test"; | ||
|
||
/** | ||
* This test verifies that: | ||
* - Users can switch between different code analysis tools (AST, Scope, Code Path) | ||
* - Each tool displays correctly | ||
* - Tool-specific interactions work as expected (e.g. scope selection) | ||
*/ | ||
test("should switch to each tool and show it", async ({ page }) => { | ||
await page.goto("/"); | ||
|
||
await expect( | ||
page.getByRole("region", { name: "Code Analysis Tools Panel" }), | ||
).toHaveScreenshot("tools-ast.png"); | ||
|
||
await page.getByRole("button", { name: "Scope" }).click(); | ||
await page.getByRole("button", { name: "global" }).click(); | ||
// move mouse away to avoid accordion hover state | ||
await page.mouse.move(0, 0); | ||
|
||
await expect( | ||
page.getByRole("region", { name: "Code Analysis Tools Panel" }), | ||
).toHaveScreenshot("tools-scope.png"); | ||
|
||
await page.getByRole("button", { name: "Code Path" }).click(); | ||
|
||
await expect( | ||
page.getByRole("region", { name: "Code Analysis Tools Panel" }), | ||
).toHaveScreenshot("tools-code-path.png"); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+40.5 KB
e2e-tests/tools.spec.ts-snapshots/tools-code-path-chromium-docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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.