-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
694e1ec
commit f82ffa8
Showing
10 changed files
with
95 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -8,3 +8,4 @@ node_modules | |
pnpm-lock.yaml | ||
preview/index.js | ||
preview/index.js.map | ||
test-results |
This file contains 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 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 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,11 @@ | ||
import { defineConfig } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testDir: 'tests', | ||
fullyParallel: true, | ||
webServer: { | ||
command: 'pnpm run preview', | ||
port: 9000, | ||
reuseExistingServer: true | ||
} | ||
}) |
This file contains 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 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,7 @@ | ||
declare global { | ||
interface Window { | ||
fcitxReady: Promise<void> | ||
} | ||
} | ||
|
||
export {} |
This file contains 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,39 @@ | ||
import { expect, test } from '@playwright/test' | ||
import { init } from './util' | ||
|
||
test('keyboard-us', async ({ page }) => { | ||
const addons: string[] = [] | ||
page.on('console', (msg) => { | ||
const match = msg.text().match(/Loaded addon (\S+)/) | ||
if (match) { | ||
addons.push(match[1]) | ||
} | ||
}) | ||
|
||
await init(page) | ||
expect(addons.sort()).toEqual(['clipboard', 'imselector', 'keyboard', 'quickphrase', 'unicode', 'wasmfrontend', 'webpanel']) | ||
|
||
const textarea = page.locator('textarea') | ||
await textarea.click() | ||
await page.keyboard.press('q') | ||
await expect(textarea).toHaveValue('q') | ||
|
||
const input = page.locator('input') | ||
await input.click() | ||
await page.keyboard.press('w') | ||
await expect(input).toHaveValue('w') | ||
}) | ||
|
||
test('keyboard-th', async ({ page }) => { | ||
await init(page) | ||
|
||
await page.evaluate(async () => { | ||
window.fcitx.setInputMethods(['keyboard-th']) | ||
}) | ||
const textarea = page.locator('textarea') | ||
await textarea.click() | ||
for (const key of 'l;ylfu') { | ||
await page.keyboard.press(key) | ||
} | ||
await expect(textarea).toHaveValue('สวัสดี') | ||
}) |
This file contains 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 @@ | ||
import type { | ||
Page, | ||
} from '@playwright/test' | ||
|
||
export async function init(page: Page) { | ||
await page.goto('http://localhost:9000') | ||
return page.evaluate(() => { | ||
return window.fcitxReady | ||
}) | ||
} |
This file contains 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