Skip to content

Commit 37c296d

Browse files
committed
Improve error message in UI test when the terminal text expected is not
found Signed-off-by: Aurélien Pupier <[email protected]>
1 parent c38739b commit 37c296d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/ui-test/utils.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ export async function waitUntilTerminalHasText(driver: WebDriver, textArray: str
149149
await driver.sleep(interval);
150150
await driver.wait(async function () {
151151
try {
152-
const terminal = await activateTerminalView();
153-
const terminalText = await terminal.getText();
152+
const terminalText = await getTerminalText();
154153
for await (const text of textArray) {
155154
if (!(terminalText.includes(text))) {
156155
return false;
@@ -160,7 +159,7 @@ export async function waitUntilTerminalHasText(driver: WebDriver, textArray: str
160159
} catch (err) {
161160
return false;
162161
}
163-
}, timeout, undefined, interval);
162+
}, timeout, `Expecting texts in termnial ${textArray} were not found in ${await getTerminalText()}`, interval);
164163
}
165164

166165
/**
@@ -633,3 +632,9 @@ export async function waitUntilNotificationShows(driver: WebDriver, notification
633632
}
634633
}, timeout, "Required notification not available", interval);
635634
}
635+
636+
async function getTerminalText() : Promise<string> {
637+
const terminal = await activateTerminalView();
638+
return await terminal.getText();
639+
}
640+

0 commit comments

Comments
 (0)