webdriverio-community / wdio-vscode-service

A service to test VSCode extensions from end to end using WebdriverIO

Home Page:https://webdriverio-community.github.io/wdio-vscode-service/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not able to run tests against a VSIX

jeffb-sfdc opened this issue · comments

At the moment, one specifies where there extension's code is located by setting the extensionPath setting in wdio.conf.ts, and this location is the path to the extension's source files. We would like the ability to instead run the tests agains a VSIX that had been built.

@jeffb-sfdc the best way to implement this would be to rename the extension into .zip, extract it and then point to that directory. Afaik .vsix files are just .zip files. Any contributions would be appreciated.

Hi @christian-bromann, how could we do if it's not only one .vsix but like 10 and some have dependencies with each other? Like is there a way to point to a directory with all those vsixes?

image

maybe with any of this mentioned in the screenshot?

@CristiCanizales thanks for providing more context. Yeah probably this is how it could work, not sure in detail though. Any contributions would be appreciated.

I feel like setting the "install-extension" inside of the vscodeArgs option should be the way to go, to install an extension by .vsix.

Idk whether this works already or has to be implemented, maybe worth a test.

thanks @tzAcee! do you have any examples? or where did you get that feeling on 'install-extension'? Thanks in advance🙌🏼

thanks @tzAcee! do you have any examples? or where did you get that feeling on 'install-extension'? Thanks in advance🙌🏼

With the vscode CLI tool you can install extensions via "code --install-extension=ext.vsix", if the vscodeArgs propagates the arguments to the used binary as they are, I would expect that to work :)
But I really dont know whether thats the case or the vscodeArgs is for something else.
(I also dont know whether --install-extension" stops the execution of the code UI)

Hey @jeffb-sfdc here's the solution for .vsix installation:

export const config: Options.Testrunner = {
    capabilities: [{
        ...
        'wdio:vscodeOptions': {
            ...
            // extensionPath is required
            extensionPath: __dirname,
            vscodeArgs: {
                force: true,
                // installs an extension from the specified extension.vsix file
                installExtension: path.join(__dirname, 'dist/my-extension.vsix')
            },
        // helps ts to recognize capabilities type when 'wdio:vscodeOptions' doesn't have required fields
        } as VSCodeOptions
    }],
    ...
}

Hi @mikhail-g! Thanks for the help! Does it work with multiple extensions too? In that case, how would it be? Thanks in advance! 😄

Hello @mikhail-g, I tried with your solution and I noticed the following in the launch log:

[0-0] 2024-01-12T21:43:42.905Z INFO wdio-vscode-service: Start VSCode: /home/user/workspace/poc-wd/node_modules/wdio-vscode-service/dist/chromium/index.js --no-sandbox --disable-updates --skip-welcome --skip-release-notes --disable-workspace-trust --disable-extensions --extension-development-path=/home/user/workspace/poc-wd --extension-tests-path=/home/user/workspace/poc-wd/node_modules/wdio-vscode-service/dist/proxy/cjs/entry.js --user-data-dir=/tmp/tmp-2601655-r449PpH2mQJa/settings --extensions-dir=/tmp/tmp-2601655-r449PpH2mQJa/extensions --vscode-binary-path=/home/user/workspace/poc-wd/.wdio-vscode-service/vscode-linux-x64-1.85.1/code --install-extension=/home/user/workspace/poc-wd/extensions/my-extension.vsix --force

Still it didn't install for the test instance. Do you mind to share some knowledge on this? Thanks.

For my local env, I'm using node 16.20 on Ubuntu 22.04.

commented

Hi @mikhail-g, I am having the same problem as @NevEinsit.