forked from namuh-eng/ralph-to-ralph
-
Notifications
You must be signed in to change notification settings - Fork 2
Repository file finder /find path-list contract (search-007-final) #38
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
jaeyunha
wants to merge
1
commit into
staging
Choose a base branch
from
qa/search-007-final
base: staging
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
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
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
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,93 @@ | ||
| import { execFileSync } from "node:child_process"; | ||
| import { expect, type Page, test } from "@playwright/test"; | ||
|
|
||
| const databaseUrl = process.env.TEST_DATABASE_URL ?? process.env.DATABASE_URL; | ||
|
|
||
| type SeededSession = { | ||
| cookieName: string; | ||
| cookieValue: string; | ||
| firstRepositoryHref: string; | ||
| }; | ||
|
|
||
| function seedSession(): SeededSession { | ||
| if (!databaseUrl) | ||
| throw new Error("TEST_DATABASE_URL or DATABASE_URL is required"); | ||
| return JSON.parse( | ||
| execFileSync( | ||
| "cargo", | ||
| [ | ||
| "run", | ||
| "--quiet", | ||
| "-p", | ||
| "opengithub-api", | ||
| "--example", | ||
| "dashboard_e2e_seed", | ||
| ], | ||
| { | ||
| cwd: "..", | ||
| env: { | ||
| ...process.env, | ||
| SESSION_COOKIE_NAME: "og_session", | ||
| }, | ||
| }, | ||
| ).toString(), | ||
| ) as SeededSession; | ||
| } | ||
|
|
||
| async function signIn(page: Page, seeded: SeededSession) { | ||
| await page.context().addCookies([ | ||
| { | ||
| name: seeded.cookieName, | ||
| value: seeded.cookieValue, | ||
| domain: "localhost", | ||
| path: "/", | ||
| httpOnly: true, | ||
| sameSite: "Lax", | ||
| secure: false, | ||
| }, | ||
| ]); | ||
| } | ||
|
|
||
| test.skip( | ||
| !databaseUrl, | ||
| "repository file finder E2E needs TEST_DATABASE_URL or DATABASE_URL", | ||
| ); | ||
|
|
||
| test("repo t shortcut opens file finder with local fuzzy filtering and keyboard open", async ({ | ||
| page, | ||
| }) => { | ||
| const seeded = seedSession(); | ||
| await signIn(page, seeded); | ||
| const repositoryHref = seeded.firstRepositoryHref; | ||
| const [, owner, repositoryName] = repositoryHref.split("/"); | ||
|
|
||
| await page.goto(repositoryHref); | ||
| await page.keyboard.press("t"); | ||
| await expect(page).toHaveURL( | ||
| new RegExp(`/${owner}/${repositoryName}/find/main$`), | ||
| ); | ||
|
|
||
| const input = page.getByRole("combobox", { name: "Fuzzy-find a file path" }); | ||
| await expect(input).toBeFocused(); | ||
| await expect(page.getByRole("listbox")).toBeVisible(); | ||
| await expect(page.getByText(/cached paths/)).toBeVisible(); | ||
| await expect(page.getByRole("option", { name: /README\.md/ })).toBeVisible(); | ||
|
|
||
| await input.fill("read"); | ||
| await expect(page.getByRole("option", { name: /README\.md/ })).toBeVisible(); | ||
| await expect(page.getByText(/matching paths/)).toBeVisible(); | ||
|
|
||
| await page.keyboard.press("ArrowDown"); | ||
| await page.keyboard.press("ArrowUp"); | ||
| await page.keyboard.press("Enter"); | ||
| await expect(page).toHaveURL( | ||
| new RegExp(`/${owner}/${repositoryName}/blob/main/README.md$`), | ||
| ); | ||
|
|
||
| await page.goto(`/${owner}/${repositoryName}/find/main`); | ||
| await page | ||
| .getByRole("combobox", { name: "Fuzzy-find a file path" }) | ||
| .fill("zzzz-no-file"); | ||
| await expect(page.getByRole("status")).toContainText("No matching files"); | ||
| await expect(page.locator('a[href="#"], a:not([href])')).toHaveCount(0); | ||
| }); | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this new signed-in Playwright spec,
web/tests/e2e/AGENTS.mdrequires all new signed-in specs to go through_fixtures/auth.tsand explicitly says not to importexecFileSync. Manually running the Rust seeder and minting cookies here bypasses the standardized scene/persona setup, so fixture contract changes or required shared assertions can break or be skipped only in this test; importtest,expect, andsignIn/seedfrom the auth fixture instead.Useful? React with 👍 / 👎.