webdriverio-community / wdio-vscode-service

A service to test VSCode extensions from end to end using WebdriverIO
https://webdriverio-community.github.io/wdio-vscode-service/
MIT License
29 stars 23 forks source link

`editor.getText()` fails in headless mode #125

Open haberdashPI opened 1 month ago

haberdashPI commented 1 month ago

In one of my tests, I'm trying to evaluate the impact of a command on the contents of a text document. Right now I just have some console.log statements peppered throughout the test so I can debug what's going on:

        const workbench = await browser.getWorkbench();
        const editorView = await workbench.getEditorView();
        const tab = await editorView.getActiveTab();
        const editor = await editorView.openEditor(await tab?.getTitle()!) as TextEditor;
        console.log("[DEBUG]: "+(await editor.getTitle()));

When I'm using a headless browser (as follows) I get an empty string for the above [DEBUG] statement:

        "goog:chromeOptions": {
            args: ['headless'],
        },

Commenting out the args: ['headless'] command causes console.log to print out the expected file contents.

christian-bromann commented 1 month ago

Thanks for reporting. I wonder if we could enhance the getTitle method to also check for html content if getText returns an empty string. I think I've seen similar issues with Chrome Headless and getting visible text elsewhere. Any help investigating this issue or possible fix are appreciated.