Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Commit ca5d610

Browse files
committed
Run cells individually and not run all on initial bootstrap of notebook.
(c) Copyright IBM Corp. 2016
1 parent 11aae36 commit ca5d610

File tree

4 files changed

+41
-18
lines changed

4 files changed

+41
-18
lines changed

etc/notebooks/tests/Walkthrough-Scala.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,9 @@
413413
],
414414
"metadata": {
415415
"kernelspec": {
416-
"display_name": "Apache Toree (Scala 2.10.4)",
417-
"language": "scala",
418-
"name": "scala"
416+
"display_name": "Apache_Toree",
417+
"language": "",
418+
"name": "apache_toree"
419419
},
420420
"language_info": {
421421
"name": "scala"

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"minimist": "latest",
1919
"selenium-standalone": "latest",
2020
"web-component-tester": "^4",
21-
"vulcanize": "1.14.8"
21+
"vulcanize": "1.14.8",
22+
"bluebird" : "3.3.5"
2223
},
2324
"config": {},
2425
"scripts": {

system-test/urth-system-test-specs.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var Boilerplate = require('./utils/boilerplate');
66
var boilerplate = new Boilerplate();
77

88
describe('Widgets Python System Test', function() {
9-
boilerplate.setup(this.title, '/notebooks/tests/Walkthrough.ipynb', 8);
9+
boilerplate.setup(this.title, '/notebooks/tests/Walkthrough.ipynb', 10);
1010

1111
it('should print the correct variable that is used for urth-core-function', function(done) {
1212
boilerplate.browser
@@ -52,6 +52,8 @@ describe('Widgets Python System Test', function() {
5252
.elementByCssSelector('>', 'input')
5353
.type('watched message')
5454
.waitForElementById('test4', wd.asserters.textInclude('watched message'), 10000)
55+
.elementsByCssSelector('div.output_area').nth(7)
56+
.click()
5557
.nodeify(done);
5658
});
5759

@@ -80,7 +82,7 @@ describe('Widgets Python System Test', function() {
8082
});
8183

8284
process.env.PYTHON != "python2" && describe('Widgets Scala System Test', function() {
83-
boilerplate.setup(this.title, '/notebooks/tests/Walkthrough-Scala.ipynb', 9);
85+
boilerplate.setup(this.title, '/notebooks/tests/Walkthrough-Scala.ipynb', 10);
8486

8587
var timeout = 30000;
8688

system-test/utils/boilerplate.js

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) Jupyter Development Team.
22
// Distributed under the terms of the Modified BSD License.
3-
3+
var Promise = require('bluebird');
44
var wd = require('wd');
55
require('colors');
66
var chai = require('chai');
@@ -75,7 +75,7 @@ Boilerplate.prototype.setup = function(testName, startingURL, outputCount){
7575
function(target) { // browser or el
7676
return target
7777
.elementsByCssSelector('div.output_area').then(function(nodes) {
78-
console.log(nodes.length+"/"+outputCount)
78+
console.log("output areas visible: ", nodes.length, "/", outputCount)
7979
nodes.should.have.length.above(outputCount-1);
8080
return target; // this will be returned by waitFor
8181
// and ignored by waitForElement.
@@ -101,22 +101,42 @@ Boilerplate.prototype.setup = function(testName, startingURL, outputCount){
101101
var kernelStartTimeout = 200000;
102102
var defaultTimeout = 10000;
103103
var runAllCompletionTimeout = 50000;
104+
105+
function clickTheElement(element) {
106+
return new Promise(function(resolve) {
107+
var newElement = element.click()
108+
.elementByLinkText("<", "Cell")
109+
.click()
110+
.waitForElementByLinkText("Run Cells", wd.asserters.isDisplayed, 10000)
111+
.elementByLinkText("Run Cells")
112+
.click()
113+
.sleep(5000);
114+
resolve(newElement);
115+
});
116+
}
117+
118+
function runAllCells(elements, idx) {
119+
if (idx > elements.length - 1) {
120+
return;
121+
}
122+
123+
var element = elements[idx];
124+
clickTheElement(element).then(function(elem) {
125+
console.log("running cell: ", idx);
126+
runAllCells(elements, idx+1);
127+
})
128+
}
129+
104130
this.browser.init(desired)
105131
.get(startingURL || '/')
106132
.waitForElementByCssSelector("#kernel_indicator_icon.kernel_idle_icon", wd.asserters.isDisplayed, kernelStartTimeout)
107-
.waitForElementByLinkText("Cell", wd.asserters.isDisplayed, defaultTimeout)
108-
.elementByLinkText("Cell")
109-
.click()
110-
.waitForElementByLinkText("Run All", wd.asserters.isDisplayed, defaultTimeout)
111-
.elementByLinkText("Run All")
112-
.click()
133+
.elementsByCssSelector('div.input').then(function (elements) {
134+
runAllCells(elements, 0);
135+
})
136+
.waitFor(outputAsserter, runAllCompletionTimeout*5, 1000)
113137
.eval("!!document.body.createShadowRoot", function(err, value) {
114138
this.browserSupportsShadowDOM = value;
115139
}.bind(this))
116-
.waitForElementByCssSelector('div.output_area', wd.asserters.isDisplayed, defaultTimeout)
117-
.elementByCssSelector('div.code_cell .input').click() // to keep the first code cell in view on sauce
118-
.waitFor(outputAsserter, runAllCompletionTimeout, 1000)
119-
.sleep(defaultTimeout*2) //FIXME: shouldn't need this?
120140
.nodeify(done);
121141
}.bind(this));
122142

0 commit comments

Comments
 (0)