File tree Expand file tree Collapse file tree 3 files changed +51
-14
lines changed Expand file tree Collapse file tree 3 files changed +51
-14
lines changed Original file line number Diff line number Diff line change @@ -25,23 +25,29 @@ async function runTutorial () {
2525 const studyData = await tutorial . openStudyLink ( ) ;
2626
2727 const workbenchData = utils . extractWorkbenchData ( studyData [ "data" ] ) ;
28+ const vtkNodeId = workbenchData [ "nodeIds" ] [ 1 ] ;
2829 await tutorial . waitForServices (
2930 workbenchData [ "studyId" ] ,
30- [ workbenchData [ "nodeIds" ] [ 1 ] ] ,
31+ [ vtkNodeId ] ,
3132 startTimeout ,
3233 false
3334 ) ;
3435
3536 await tutorial . waitFor ( 10000 , 'Some time for starting the service' ) ;
3637 await utils . takeScreenshot ( page , screenshotPrefix + 'service_started' ) ;
3738
38- // This study opens in fullscreen mode
39- await tutorial . restoreIFrame ( ) ;
40-
41- const outFiles = [
42- "data.zip"
39+ const iframe = await tutorial . getIframe ( vtkNodeId ) ;
40+ const entitiesListed = [
41+ "Vein.vtk" ,
42+ "Artery.vtk" ,
43+ "Bones.e" ,
4344 ] ;
44- await tutorial . checkNodeOutputs ( 1 , outFiles ) ;
45+ for ( const text of entitiesListed ) {
46+ const found = await utils . waitForLabelText ( iframe , text ) ;
47+ if ( ! found ) {
48+ throw new Error ( `Text "${ text } " not visible on the page within timeout.` ) ;
49+ }
50+ }
4551 }
4652 catch ( err ) {
4753 await tutorial . setTutorialFailed ( ) ;
Original file line number Diff line number Diff line change @@ -25,23 +25,28 @@ async function runTutorial () {
2525 const studyData = await tutorial . openStudyLink ( ) ;
2626
2727 const workbenchData = utils . extractWorkbenchData ( studyData [ "data" ] ) ;
28+ const vtkNodeId = workbenchData [ "nodeIds" ] [ 2 ] ;
2829 await tutorial . waitForServices (
2930 workbenchData [ "studyId" ] ,
30- [ workbenchData [ "nodeIds" ] [ 2 ] ] ,
31+ [ vtkNodeId ] ,
3132 startTimeout ,
3233 false
3334 ) ;
3435
3536 await tutorial . waitFor ( 10000 , 'Some time for starting the service' ) ;
3637 await utils . takeScreenshot ( page , screenshotPrefix + 'service_started' ) ;
3738
38- // This study opens in fullscreen mode
39- await tutorial . restoreIFrame ( ) ;
40-
41- const outFiles = [
42- "data.zip"
39+ const iframe = await tutorial . getIframe ( vtkNodeId ) ;
40+ const entitiesListed = [
41+ "EM_02mm.vtk" ,
42+ "CellDatatoPointData1" ,
4343 ] ;
44- await tutorial . checkNodeOutputs ( 2 , outFiles ) ;
44+ for ( const text of entitiesListed ) {
45+ const found = await utils . waitForLabelText ( iframe , text ) ;
46+ if ( ! found ) {
47+ throw new Error ( `Text "${ text } " not visible on the page within timeout.` ) ;
48+ }
49+ }
4550 }
4651 catch ( err ) {
4752 await tutorial . setTutorialFailed ( ) ;
Original file line number Diff line number Diff line change @@ -634,6 +634,31 @@ async function getButtonsWithText(page, text) {
634634 return buttons ;
635635}
636636
637+ async function waitForLabelText ( page , text , timeout = 10000 ) {
638+ console . log ( "Waiting for label text:" , text ) ;
639+ try {
640+ await page . waitForFunction (
641+ ( text ) => {
642+ return [ ...document . body . querySelectorAll ( '*' ) ] . some ( el => {
643+ if ( typeof el . innerText !== 'string' ) return false ;
644+
645+ const lines = el . innerText . split ( '\n' ) . map ( line => line . trim ( ) ) ;
646+ return lines . some ( line =>
647+ line . includes ( text ) &&
648+ ! ! ( el . offsetWidth || el . offsetHeight || el . getClientRects ( ) . length )
649+ ) ;
650+ } ) ;
651+ } ,
652+ { timeout } ,
653+ text
654+ ) ;
655+ return true ;
656+ } catch ( err ) {
657+ console . error ( "waitForLabelText failed:" , err ) ;
658+ return false ;
659+ }
660+ }
661+
637662
638663module . exports = {
639664 makeRequest,
@@ -671,4 +696,5 @@ module.exports = {
671696 isElementVisible,
672697 clickLoggerTitle,
673698 getButtonsWithText,
699+ waitForLabelText,
674700}
You can’t perform that action at this time.
0 commit comments