@@ -41,12 +41,10 @@ async function runTutorial() {
41
41
42
42
// inside the iFrame, open the first notebook
43
43
const notebookCBSelector = '#notebook_list > div:nth-child(2) > div > input[type=checkbox]' ;
44
- await nbIframe . waitForSelector ( notebookCBSelector ) ;
45
- await nbIframe . click ( notebookCBSelector ) ;
44
+ await utils . waitAndClick ( nbIframe , notebookCBSelector )
46
45
await tutorial . waitFor ( 2000 ) ;
47
46
const notebookViewSelector = "#notebook_toolbar > div.col-sm-8.no-padding > div.dynamic-buttons > button.view-button.btn.btn-default.btn-xs"
48
- await nbIframe . waitForSelector ( notebookViewSelector ) ;
49
- await nbIframe . click ( notebookViewSelector ) ;
47
+ await utils . waitAndClick ( nbIframe , notebookViewSelector )
50
48
await tutorial . waitFor ( 2000 ) ;
51
49
await tutorial . takeScreenshot ( "openNotebook" ) ;
52
50
@@ -57,35 +55,13 @@ async function runTutorial() {
57
55
const confirmRunAllButtonSelector = 'body > div.modal.fade.in > div > div > div.modal-footer > button.btn.btn-default.btn-sm.btn-danger' ;
58
56
await utils . waitAndClick ( nbIframe , confirmRunAllButtonSelector )
59
57
// now check that the input contains [4]
58
+ console . log ( 'Waiting for notebook results...' ) ;
60
59
const finishedRunningCheckboxSelector = '#notebook-container > div:nth-child(5) > div.input > div.prompt_container > div.prompt.input_prompt' ;
61
- await nbIframe . waitForSelector ( finishedRunningCheckboxSelector ) ;
60
+ await nbIframe . waitForFunction ( 'document.querySelector("' + finishedRunningCheckboxSelector + '").innerText.match(/\[[0-9]+\]/)' )
61
+ const element = await nbIframe . $ ( finishedRunningCheckboxSelector )
62
+ const value = await nbIframe . evaluate ( el => el . textContent , element ) ;
63
+ console . log ( 'Checking results for the notebook cell:' , value ) ;
62
64
63
-
64
- let inputElement = await nbIframe . $ ( finishedRunningCheckboxSelector ) ;
65
-
66
-
67
-
68
- // async function checkNotebookCompleted(page, el) {
69
- // let value = await page.evaluate(el => el.textContent, el);
70
- // return value.match(/\[[0-9]+\]/) != null;
71
- // }
72
- await nbIframe . waitForFunction ( async ( page , el ) => {
73
- let value = await page . evaluate ( el => el . textContent , el ) ;
74
- if ( value . match ( / \[ [ 0 - 9 ] + \] / ) ) {
75
- return true ;
76
- } else {
77
- return false ;
78
- }
79
- } , { } , nbIframe , inputElement ) ;
80
- // await nbIframe.waitForFunction(async (page, selector) => {
81
- // element = await page.$(selector);
82
- // return element.innerText.match(/\[[0-9]+\]/) != null;
83
- // }, { polling: 200, timeout: 20000 }, nbIframe, finishedRunningCheckboxSelector);
84
- // checkNotebookCompleted(nbIframe, inputElement, /\[[0-9]+\]/g), { polling: 200, timeout: 20000 });
85
-
86
-
87
-
88
- console . log ( 'Checking results for the notebook:' ) ;
89
65
await tutorial . openNodeFiles ( 1 ) ;
90
66
const outFiles = [
91
67
"TheNumberNumber.txt" ,
0 commit comments