Skip to content

Commit 715a707

Browse files
committed
Adapted validation
1 parent 1bb7db5 commit 715a707

1 file changed

Lines changed: 32 additions & 4 deletions

File tree

tests/internal/e2e/test/test_utils/vcast_utils.ts

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -558,12 +558,40 @@ export async function validateGeneratedTestScriptContent(
558558
);
559559
const tab = (await editorView.openEditor(tstFilename)) as TextEditor;
560560

561-
const fullGenTstScript = await tab.getText();
561+
// Strip TEST.NOTES: ... TEST.END_NOTES: — the wording changed between VC
562+
// releases (vc26 reworded the "no controllable inputs" note), so it isn't
563+
// something we should assert on. Structure/VALUE/STUB lines stay.
564+
const stripNotes = (s: string) =>
565+
s.replace(/TEST\.NOTES:[\s\S]*?TEST\.END_NOTES:/g, "");
566+
567+
// expectedTestCode may be a single string or an array of lines.
568+
const expectedLines = (
569+
Array.isArray(expectedTestCode)
570+
? expectedTestCode
571+
: stripNotes(expectedTestCode).split("\n")
572+
)
573+
.map((l) => l.trim())
574+
.filter((l) => l.length > 0);
575+
576+
// Wait until the editor has fully rendered all expected lines — it can
577+
// return partial text right after opening.
578+
let genStripped = "";
579+
await browser.waitUntil(
580+
async () => {
581+
genStripped = stripNotes(await tab.getText());
582+
return expectedLines.every((line) => genStripped.includes(line));
583+
},
584+
{
585+
timeout: 15_000,
586+
interval: 300,
587+
timeoutMsg: "Generated tst did not contain all expected lines in time",
588+
}
589+
);
562590

563591
await editorView.closeAllEditors();
564-
for (let line of expectedTestCode) {
565-
line = line.trim();
566-
expect(fullGenTstScript.includes(line)).toBe(true);
592+
593+
for (const line of expectedLines) {
594+
expect(genStripped.includes(line)).toBe(true);
567595
}
568596
}
569597

0 commit comments

Comments
 (0)