Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to run tests against a VSIX #67

Open
jeffb-sfdc opened this issue Mar 20, 2023 · 11 comments
Open

Not able to run tests against a VSIX #67

jeffb-sfdc opened this issue Mar 20, 2023 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@jeffb-sfdc
Copy link
Contributor

jeffb-sfdc commented Mar 20, 2023

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 christian-bromann added the help wanted Extra attention is needed label Mar 20, 2023
@christian-bromann
Copy link
Contributor

@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
Copy link

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
Copy link

image

maybe with any of this mentioned in the screenshot?

@christian-bromann
Copy link
Contributor

@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
Copy link
Contributor

tzAcee commented Oct 9, 2023

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
Copy link

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

@tzAcee
Copy link
Contributor

tzAcee commented Oct 9, 2023

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
Copy link
Contributor

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
Copy link

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
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants