You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context
Currently, it seems that there's no clear indicator from VSCode that a given extension is fully activated on the workbench.
What is the feature you are missing? vscode-extension-tester to provide a method that will be executed to determine whether the extension is activated. As an example, for vscode-kaoto we're using a timeout of 5 seconds as a workaround to ensure that the underlying backend is loaded and the UI had the chance to communicate with it (related issue).
Could you provide some example of usage?
The idea would be to have a method like the existing waitForWorkbench that allows passing a custom function to test against the extension.
/** * Waits until the activation function returns true to signal that the extension is ready */asyncwaitForExtensionActivation(timeout=30000,activationFn: ()=>Promise<void>): Promise<void>;
In addition to that, we could also provide some context to the activationFn, for instance, the underlying WebDriver or the stdout and stderr if available to have a better way to ensure that the extension is ready. Another possibility could be to give access to the Output pane of VSCode.
constactivationFn=(context,stdout,sterr)=>{//The context might be the WebDriver or another relevant object from VSCode// interact with the stdout if there's an underlying backend for the extension.}
The text was updated successfully, but these errors were encountered:
If I understand your test case, you wait for the Kaoto editor to show up. If it is the case, then I would check periodically for current CustomEditor title or some other feature which identifies your Kaoto WebView. Regarding the linked issue, I would recommend adding openResource call for each driver.wait attempt. After applying changes, it might look like the following code snippet, however I have not tested it:
exportasyncfunctionopenAndSwitchToKaotoFrame(workspaceFolder: string,fileNameToOpen: string,driver: WebDriver,checkNotDirty: boolean){// try to open editor, I believe wait interval should be set as wellawaitawaitVSBrowser.instance.driver.wait(async()=>{awaitVSBrowser.instance.openResources(path.join(workspaceFolder,fileNameToOpen));returnawaitswitchToKaotoFrame(driver,checkNotDirty);}, ...);}exportasyncfunctionswitchToKaotoFrame(driver: WebDriver,checkNotDirty: boolean){letkaotoEditor=newCustomEditor();// handle error.NoSuchElementError just in caseif(awaitkaotoEditor.getTitle()!=="your_title"){returnundefined};// or any other feature/flag identifier, depending on your applicationif(checkNotDirty){assert.isFalse(awaitkaotoEditor.isDirty(),'The Kaoto editor should not be dirty when opening it.');}letkaotoWebview :WebView=awaitkaotoEditor.getWebView();awaitdriver.wait(async()=>{try{kaotoEditor=newCustomEditor();kaotoWebview=awaitkaotoEditor.getWebView();awaitkaotoWebview.switchToFrame();returntrue;}catch(exception){console.log('failed to switch to frame '+exception);returnfalse;}},20000,'Failed to switch to frame',1000);return{ kaotoWebview, kaotoEditor };}
I know it does not exactly answer your question, but hopefully it will help you to find workaround for now.
Cool, thanks for sharing @mlorinc, I'll give it a try and see what happens.
djelinek
changed the title
[Request] Provide a method to check whether an extension is activated
[馃殌 Request] Provide a method to check whether an extension is activated
Oct 17, 2023
Context
Currently, it seems that there's no clear indicator from VSCode that a given extension is fully activated on the workbench.
What is the feature you are missing?
vscode-extension-tester
to provide a method that will be executed to determine whether the extension is activated. As an example, forvscode-kaoto
we're using a timeout of 5 seconds as a workaround to ensure that the underlying backend is loaded and the UI had the chance to communicate with it (related issue).Could you provide some example of usage?
The idea would be to have a method like the existing
waitForWorkbench
that allows passing a custom function to test against the extension.In addition to that, we could also provide some context to the
activationFn
, for instance, the underlyingWebDriver
or thestdout
andstderr
if available to have a better way to ensure that the extension is ready. Another possibility could be to give access to theOutput
pane of VSCode.The text was updated successfully, but these errors were encountered: