2024-09-26 12:35:32 +02:00
|
|
|
|
|
|
|
import { test } from './util/test';
|
|
|
|
import MainScreen from './models/MainScreen';
|
|
|
|
|
|
|
|
test.describe('pluginApi', () => {
|
2024-11-05 11:04:44 +02:00
|
|
|
test('the editor.setText command should update the current note (use RTE: false)', async ({ startAppWithPlugins }) => {
|
|
|
|
const { app, mainWindow } = await startAppWithPlugins(['resources/test-plugins/execCommand.js']);
|
2024-11-20 13:35:22 +02:00
|
|
|
const mainScreen = await new MainScreen(mainWindow).setup();
|
2024-11-05 11:04:44 +02:00
|
|
|
await mainScreen.createNewNote('First note');
|
|
|
|
const editor = mainScreen.noteEditor;
|
2024-09-26 12:35:32 +02:00
|
|
|
|
2024-11-05 11:04:44 +02:00
|
|
|
await editor.focusCodeMirrorEditor();
|
|
|
|
await mainWindow.keyboard.type('This content should be overwritten.');
|
2024-09-26 12:35:32 +02:00
|
|
|
|
2024-11-05 11:04:44 +02:00
|
|
|
await editor.expectToHaveText('This content should be overwritten.');
|
|
|
|
await mainScreen.goToAnything.runCommand(app, 'testUpdateEditorText');
|
|
|
|
await editor.expectToHaveText('PASS');
|
2024-09-26 12:35:32 +02:00
|
|
|
|
2024-11-05 11:04:44 +02:00
|
|
|
// Should still have the same text after switching notes:
|
|
|
|
await mainScreen.createNewNote('Second note');
|
|
|
|
await editor.goBack();
|
2024-09-26 12:35:32 +02:00
|
|
|
|
2024-11-05 11:04:44 +02:00
|
|
|
await editor.expectToHaveText('PASS');
|
|
|
|
});
|
2024-09-26 12:35:32 +02:00
|
|
|
});
|
|
|
|
|