test: wait for element
This commit is contained in:
parent
120e46fcbc
commit
8d06b9f381
2 changed files with 4 additions and 7 deletions
|
|
@ -5,7 +5,7 @@ export class TestUtils {
|
|||
locatorFn: () => Promise<WebElement>,
|
||||
timeout: number = 5000,
|
||||
interval: number = 500,
|
||||
): Promise<any> {
|
||||
): Promise<WebElement> {
|
||||
const startTime = Date.now();
|
||||
|
||||
while (Date.now() - startTime < timeout) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
Workbench,
|
||||
} from "vscode-extension-tester";
|
||||
import { GUISelectors } from "../selectors/GUI.selectors";
|
||||
import { TestUtils } from "../TestUtils";
|
||||
|
||||
export class GUIActions {
|
||||
public static switchToReactIframe = async (driver: WebDriver) => {
|
||||
|
|
@ -49,14 +50,10 @@ export class GUIActions {
|
|||
const dropdownButton = await GUISelectors.getModelDropdownButton(view);
|
||||
await dropdownButton.click();
|
||||
|
||||
await new Promise((res) => {
|
||||
setTimeout(res, 2000);
|
||||
const dropdownOption = await TestUtils.waitForElement(() => {
|
||||
return GUISelectors.getModelDropdownOption(view, option);
|
||||
});
|
||||
|
||||
const dropdownOption = await GUISelectors.getModelDropdownOption(
|
||||
view,
|
||||
option,
|
||||
);
|
||||
await dropdownOption.click();
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue