wdio-vscode-service icon indicating copy to clipboard operation
wdio-vscode-service copied to clipboard

Not able to run tests against a VSIX

Open jeffb-sfdc opened this issue 1 year ago • 11 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 avatar Mar 20 '23 15:03 jeffb-sfdc

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

christian-bromann avatar Jul 08 '23 01:07 christian-bromann

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 avatar Sep 28 '23 19:09 CristiCanizales

image

maybe with any of this mentioned in the screenshot?

CristiCanizales avatar Sep 28 '23 19:09 CristiCanizales

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

christian-bromann avatar Sep 28 '23 21:09 christian-bromann

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.

tzAcee avatar Oct 09 '23 21:10 tzAcee

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

CristiCanizales avatar Oct 09 '23 22:10 CristiCanizales

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)

tzAcee avatar Oct 09 '23 22:10 tzAcee

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

mikhail-g avatar Nov 17 '23 10:11 mikhail-g

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

CristiCanizales avatar Nov 17 '23 10:11 CristiCanizales

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.

NevEinsit avatar Jan 12 '24 22:01 NevEinsit