redhat-developer / vscode-extension-tester

ExTester: Your Essential UI Testing Companion for Visual Studio Code Extensions! Seamlessly execute UI tests with Selenium WebDriver, ensuring robustness and reliability in your extension development journey. Simplify UI testing for your VS Code extensions and elevate the quality of your user interface effortlessly.
Apache License 2.0
243 stars 67 forks source link

[🚫 Bug] Wait periods needed to make sure tree items are loaded #1320

Open ronsig opened 1 month ago

ronsig commented 1 month ago

Describe the bug

I often seem to need to add wait periods when loading elements, in order to make sure my extension's prjeuct view is loaded and expanded.

For example

 await VSBrowser.instance.openResources(testWorkspacePath);
 await (await new ActivityBar().getViewControl(generalHelpers.TestConstants.VIEW_CONTAINER_TITLE))?.openView();
 // now to initialize the view
 const view = new SideBarView();
 content = view.getContent();
 let tree = await content.getSection("Structure");
 await new Promise(res => setTimeout(res, 300));  <--- I had to add this to make sure the tree was indeed instantiated
 await tree.expand();

I often encounter elements that are created, but I have to artificially add wait periods, so they finish loading their content. I can't use wait(until.elementLocated() since the element is there and can be located, but is not fully loaded

Steps to reproduce

This happens in my extension's project view, so I don't have steps beyond the above

Logs

None. Without the wait period, I get "undefined" when trying to access content of elements not fullly loaded

Operating System

Windows 10

Visual Studio Code

1.89.1

vscode-extension-tester

8.0.2

NodeJS

18.13

npm

8.19.3