|
|
@@ -10,8 +10,9 @@ import { appendTextToEditorUntilContains } from '../utils/AppendTextToEditorUnti
|
|
|
|
|
|
const changeKeymap = async (page: Page, keymap: string) => {
|
|
|
// Open OptionsSelector
|
|
|
- await expect(page.getByTestId('options-selector')).toBeVisible();
|
|
|
- await page.getByTestId('options-selector').click();
|
|
|
+ await expect(page.getByTestId('options-selector-btn')).toBeVisible();
|
|
|
+ await page.getByTestId('options-selector-btn').click();
|
|
|
+ await expect(page.getByTestId('options-selector-menu')).toBeVisible();
|
|
|
|
|
|
// Click keymap selection button to navigate to keymap selector
|
|
|
await expect(page.getByTestId('keymap_current_selection')).toBeVisible();
|
|
|
@@ -21,9 +22,9 @@ const changeKeymap = async (page: Page, keymap: string) => {
|
|
|
await expect(page.getByTestId(`keymap_radio_item_${keymap}`)).toBeVisible();
|
|
|
await page.getByTestId(`keymap_radio_item_${keymap}`).click();
|
|
|
|
|
|
- // Close OptionsSelector by clicking outside
|
|
|
- await expect(page.locator('.cm-content')).toBeVisible();
|
|
|
- await page.locator('.cm-content').click();
|
|
|
+ // Close OptionsSelector
|
|
|
+ await page.getByTestId('options-selector-btn').click();
|
|
|
+ await expect(page.getByTestId('options-selector-menu')).not.toBeVisible();
|
|
|
};
|
|
|
|
|
|
const targetPagePath = '/Sandbox/vim-keymap-test-page';
|
|
|
@@ -46,90 +47,16 @@ test.describe('Vim keymap mode', () => {
|
|
|
// Change to Vim keymap
|
|
|
await changeKeymap(page, 'vim');
|
|
|
|
|
|
+ // Focus the editor
|
|
|
+ await page.locator('.cm-content').click();
|
|
|
+
|
|
|
// Enter insert mode
|
|
|
await page.keyboard.type('i');
|
|
|
|
|
|
// Append text
|
|
|
await appendTextToEditorUntilContains(page, testText);
|
|
|
|
|
|
- // // Enter normal mode
|
|
|
- // await page.keyboard.press('Escape');
|
|
|
-
|
|
|
- // // Enter command mode
|
|
|
- // await page.keyboard.type(':')
|
|
|
-
|
|
|
- // // Command mode should be accessible
|
|
|
- // await expect(page.locator('.cm-vim-panel')).toBeVisible();
|
|
|
-
|
|
|
- // // Save page
|
|
|
- // await page.keyboard.type('w');
|
|
|
-
|
|
|
// Change back to default keymap
|
|
|
await changeKeymap(page, 'default');
|
|
|
-
|
|
|
- //
|
|
|
});
|
|
|
-
|
|
|
- // test('Insert mode should persist after append command (a)', async ({
|
|
|
- // page,
|
|
|
- // }) => {
|
|
|
- // const editor = page.locator('.cm-content');
|
|
|
- // const testText = 'Appended Text';
|
|
|
-
|
|
|
- // // Focus the editor
|
|
|
- // await editor.click();
|
|
|
-
|
|
|
- // // Enter insert mode with 'a' (append) key
|
|
|
- // await page.keyboard.press('a');
|
|
|
-
|
|
|
- // // Type multiple characters - insert mode should persist
|
|
|
- // await page.keyboard.type(testText, { delay: 50 });
|
|
|
-
|
|
|
- // // Verify the text was typed correctly
|
|
|
- // await expect(editor).toContainText(testText);
|
|
|
- // });
|
|
|
-
|
|
|
- // test('Insert mode should only exit when Escape is pressed', async ({
|
|
|
- // page,
|
|
|
- // }) => {
|
|
|
- // const editor = page.locator('.cm-content');
|
|
|
- // const firstText = 'First';
|
|
|
- // const secondText = 'Second';
|
|
|
-
|
|
|
- // // Focus the editor
|
|
|
- // await editor.click();
|
|
|
-
|
|
|
- // // Enter insert mode and type
|
|
|
- // await page.keyboard.press('i');
|
|
|
- // await page.keyboard.type(firstText, { delay: 50 });
|
|
|
-
|
|
|
- // // Press Escape to exit insert mode
|
|
|
- // await page.keyboard.press('Escape');
|
|
|
-
|
|
|
- // // Try to type more - should not insert text (in normal mode, 'd' would delete)
|
|
|
- // // Instead, enter insert mode again and type
|
|
|
- // await page.keyboard.press('A'); // Append at end of line
|
|
|
- // await page.keyboard.type(secondText, { delay: 50 });
|
|
|
-
|
|
|
- // // Verify both texts are present
|
|
|
- // await expect(editor).toContainText(firstText);
|
|
|
- // await expect(editor).toContainText(secondText);
|
|
|
- // });
|
|
|
-
|
|
|
- // test('Insert mode should persist during rapid typing', async ({ page }) => {
|
|
|
- // const editor = page.locator('.cm-content');
|
|
|
- // const testText = 'RapidTypingTest123';
|
|
|
-
|
|
|
- // // Focus the editor
|
|
|
- // await editor.click();
|
|
|
-
|
|
|
- // // Enter insert mode
|
|
|
- // await page.keyboard.press('i');
|
|
|
-
|
|
|
- // // Type rapidly without delay
|
|
|
- // await page.keyboard.type(testText);
|
|
|
-
|
|
|
- // // Verify all characters were typed (insert mode didn't exit unexpectedly)
|
|
|
- // await expect(editor).toContainText(testText);
|
|
|
- // });
|
|
|
});
|