GeezerVison is showing github.com — test(app): test for toggling model variant (#11221) · MarsQiu007/openNovel@5befba3
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +25Lines changed: 25 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { test, expect } from "./fixtures" |
| 2 | +import { modelVariantCycleSelector } from "./utils" |
| 3 | + |
| 4 | +test("smoke model variant cycle updates label", async ({ page, gotoSession }) => { |
| 5 | + await gotoSession() |
| 6 | + |
| 7 | + await page.addStyleTag({ |
| 8 | + content: `${modelVariantCycleSelector} { display: inline-block !important; }`, |
| 9 | + }) |
| 10 | + |
| 11 | + const button = page.locator(modelVariantCycleSelector) |
| 12 | + const exists = (await button.count()) > 0 |
| 13 | + test.skip(!exists, "current model has no variants") |
| 14 | + if (!exists) return |
| 15 | + |
| 16 | + await expect(button).toBeVisible() |
| 17 | + |
| 18 | + const before = (await button.innerText()).trim() |
| 19 | + await button.click() |
| 20 | + await expect(button).not.toHaveText(before) |
| 21 | + |
| 22 | + const after = (await button.innerText()).trim() |
| 23 | + await button.click() |
| 24 | + await expect(button).not.toHaveText(after) |
| 25 | +}) |
Collapse file
Copy file name to clipboardExpand all lines: packages/app/e2e/utils.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,6 +12,7 @@ export const terminalToggleKey = "Control+Backquote" |
12 | 12 |
|
13 | 13 | export const promptSelector = '[data-component="prompt-input"]' |
14 | 14 | export const terminalSelector = '[data-component="terminal"]' |
| 15 | +export const modelVariantCycleSelector = '[data-action="model-variant-cycle"]' |
15 | 16 |
|
16 | 17 | export function createSdk(directory?: string) { |
17 | 18 | return createOpencodeClient({ baseUrl: serverUrl, directory, throwOnError: true }) |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/app/src/components/prompt-input.tsx +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1953,6 +1953,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => { |
1953 | 1953 | keybind={command.keybind("model.variant.cycle")} |
1954 | 1954 | > |
1955 | 1955 | <Button |
| 1956 | + data-action="model-variant-cycle" |
1956 | 1957 | variant="ghost" |
1957 | 1958 | class="text-text-base _hidden group-hover/prompt-input:inline-block capitalize text-12-regular" |
1958 | 1959 | onClick={() => local.model.variant.cycle()} |
|