| 1189 | return result; |
| 1190 | } |
| 1191 | export async function waitForTextOutput( |
| 1192 | cell: NotebookCell, |
| 1193 | text: string, |
| 1194 | index: number = 0, |
| 1195 | isExactMatch = true, |
| 1196 | timeout = defaultNotebookTestTimeout |
| 1197 | ) { |
| 1198 | await waitForCondition( |
| 1199 | async () => assertHasTextOutputInVSCode(cell, text, index, isExactMatch), |
| 1200 | timeout, |
| 1201 | () => |
| 1202 | `After ${timeout}ms output, does not contain provided text '${text}' for Cell ${ |
| 1203 | cell.index + 1 |
| 1204 | } in output index ${index}, the outputs are: \n${cell.outputs |
| 1205 | .map( |
| 1206 | (output, index) => |
| 1207 | `${index}. Output for Index "${index}" with total outputs ${ |
| 1208 | output.items.length |
| 1209 | } is "${output.items.map(getOutputText).join('\n')}"` |
| 1210 | ) |
| 1211 | .join(',\n')}` |
| 1212 | ); |
| 1213 | } |
| 1214 | export function assertNotHasTextOutputInVSCode(cell: NotebookCell, text: string, index: number, isExactMatch = true) { |
| 1215 | const cellOutputs = cell.outputs; |
| 1216 | assert.ok(cellOutputs, 'No output'); |