diff --git a/page-objects/src/components/editor/TextEditor.ts b/page-objects/src/components/editor/TextEditor.ts index 6071f6044..2ca67f655 100644 --- a/page-objects/src/components/editor/TextEditor.ts +++ b/page-objects/src/components/editor/TextEditor.ts @@ -226,12 +226,19 @@ export class TextEditor extends Editor { */ async getSelectedText(): Promise { const originalClipboard = clipboard.readSync(); - const selection = await this.getSelection(); - if (!selection) { - return ''; + if(process.platform !== 'darwin') { + const selection = await this.getSelection(); + if (!selection) { + return ''; + } + const menu = await selection.openContextMenu(); + await menu.select('Copy'); + } else { + const inputarea = await this.findElement(TextEditor.locators.Editor.inputArea); + await inputarea.sendKeys(Key.chord(TextEditor.ctlKey, 'c')); + await new Promise(res => setTimeout(res, 500)); + await inputarea.sendKeys(Key.UP); } - const menu = await selection.openContextMenu(); - await menu.select('Copy'); await new Promise(res => setTimeout(res, 500)); const text = clipboard.readSync(); clipboard.writeSync(originalClipboard); @@ -477,6 +484,7 @@ export class TextEditor extends Editor { * Text selection block */ class Selection extends ElementWithContexMenu { + constructor(el: WebElement, editor: TextEditor) { super(el, editor); } diff --git a/test/test-project/src/test/editor/textEditor-test.ts b/test/test-project/src/test/editor/textEditor-test.ts index 118fdd7f9..a28a9a312 100644 --- a/test/test-project/src/test/editor/textEditor-test.ts +++ b/test/test-project/src/test/editor/textEditor-test.ts @@ -169,7 +169,7 @@ describe('TextEditor', function () { expect(line).equals(6); }); - (process.platform === 'darwin' ? it.skip : it)('text can be selected', async function () { + it('selected text can be get', async function () { const text = 'bline'; await editor.selectText(text); expect(await editor.getSelectedText()).equals(text);