@@ -43,29 +43,33 @@ async function runTutorial() {
43
43
// inside the iFrame, open the first notebook
44
44
const notebookCBSelector = '#notebook_list > div:nth-child(2) > div > input[type=checkbox]' ;
45
45
await utils . waitAndClick ( nbIframe , notebookCBSelector )
46
- 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
47
await utils . waitAndClick ( nbIframe , notebookViewSelector )
49
- await tutorial . waitFor ( 2000 ) ;
50
- await tutorial . takeScreenshot ( "openNotebook" ) ;
48
+
51
49
52
50
// inside the first notebook, click Run all button
53
51
const runAllButtonSelector = '#run_int > button:nth-child(4)' ;
54
- await utils . waitAndClick ( nbIframe , runAllButtonSelector )
52
+ await utils . waitAndClick ( nbIframe , runAllButtonSelector ) ;
53
+ await tutorial . takeScreenshot ( "pressRunAllButtonNotebook" ) ;
54
+
55
+ // inside the first notebook, click confirm run all (NOTE: this dialog does not appear it seems)
56
+ // const confirmRunAllButtonSelector = 'body > div.modal.fade.in > div > div > div.modal-footer > button.btn.btn-default.btn-sm.btn-danger';
57
+ // await utils.waitAndClick(nbIframe, confirmRunAllButtonSelector);
58
+ // await tutorial.takeScreenshot("pressRunNotebookAfterConfirmation");
55
59
56
- // inside the first notebook, click confirm run all
57
- const confirmRunAllButtonSelector = 'body > div.modal.fade.in > div > div > div.modal-footer > button.btn.btn-default.btn-sm.btn-danger' ;
58
- await tutorial . takeScreenshot ( "pressRunNotebook" ) ;
59
- await utils . waitAndClick ( nbIframe , confirmRunAllButtonSelector )
60
- await tutorial . takeScreenshot ( "pressRunNotebookAfterConfirm" ) ;
61
60
// now check that the input contains [4]
62
61
console . log ( 'Waiting for notebook results...' ) ;
63
62
const finishedRunningCheckboxSelector = '#notebook-container > div:nth-child(5) > div.input > div.prompt_container > div.prompt.input_prompt' ;
63
+ // the page scrolls down, so first wait so that it becomes visible
64
+ await nbIframe . waitForSelector ( finishedRunningCheckboxSelector ) ;
64
65
await nbIframe . waitForFunction ( 'document.querySelector("' + finishedRunningCheckboxSelector + '").innerText.match(/\[[0-9]+\]/)' ) ;
66
+ await tutorial . takeScreenshot ( "notebookWaitingForNotebookCompleted" ) ;
67
+ console . log ( '...waiting completed' ) ;
65
68
const element = await nbIframe . $ ( finishedRunningCheckboxSelector ) ;
66
69
const value = await nbIframe . evaluate ( el => el . textContent , element ) ;
67
- await tutorial . takeScreenshot ( "notebookAfterRun" ) ;
68
- console . log ( 'Checking results for the notebook cell:' , value ) ;
70
+ console . log ( 'Results for the notebook cell is:' , value ) ;
71
+ // NOTE: we need to wait here to get the results.
72
+ await tutorial . waitFor ( 10000 ) ;
69
73
70
74
await tutorial . openNodeFiles ( 1 ) ;
71
75
const outFiles = [
@@ -92,12 +96,9 @@ async function runTutorial() {
92
96
await jLabIframe . click ( input2outputFileSelector , {
93
97
clickCount : 2
94
98
} ) ;
95
- await tutorial . waitFor ( 2000 ) ;
96
-
97
99
// click Run Menu
98
100
const mainRunMenuBtnSelector = '#jp-MainMenu > ul > li:nth-child(4)' ;
99
101
await utils . waitAndClick ( jLabIframe , mainRunMenuBtnSelector )
100
- await tutorial . waitFor ( 1000 ) ;
101
102
102
103
// click Run All Cells
103
104
const mainRunAllBtnSelector = ' body > div.lm-Widget.p-Widget.lm-Menu.p-Menu.lm-MenuBar-menu.p-MenuBar-menu > ul > li:nth-child(17)' ;
@@ -110,7 +111,8 @@ async function runTutorial() {
110
111
const jLabVvalue = await jLabIframe . evaluate ( el => el . textContent , jLabElement ) ;
111
112
console . log ( 'Checking results for the jupyter lab cell:' , jLabVvalue ) ;
112
113
await tutorial . takeScreenshot ( "pressRunJLab" ) ;
113
- await tutorial . waitFor ( 5000 ) ;
114
+ // wait sufficiently before getting the results
115
+ await tutorial . waitFor ( 10000 ) ;
114
116
console . log ( 'Checking results for the jupyter lab:' ) ;
115
117
await tutorial . openNodeFiles ( 2 ) ;
116
118
const outFiles2 = [
0 commit comments