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
31 stars 26 forks source link

Not able to run tests against a VSIX #67

Open jeffb-sfdc opened 1 year ago

jeffb-sfdc commented 1 year ago

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.

christian-bromann commented 1 year ago

@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.

CristiCanizales commented 11 months ago

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?

CristiCanizales commented 11 months ago
image

maybe with any of this mentioned in the screenshot?

christian-bromann commented 11 months ago

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

tzAcee commented 11 months ago

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.

CristiCanizales commented 11 months ago

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

tzAcee commented 11 months ago

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)

mikhail-g commented 10 months ago

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
    }],
    ...
}
CristiCanizales commented 10 months ago

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

NevEinsit commented 8 months ago

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.

jodespanola commented 3 months ago

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

Hemavathy12 commented 1 month ago

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
    }],
    ...
}

Didn't install the extensions in the test instance. @mikhail-g, Can you please help with this.