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

Commit 3c13509

Browse files
committed
Move scala tests to own file and update output counts
(c) Copyright IBM Corp. 2016
1 parent eb6070b commit 3c13509

8 files changed

+124
-82
lines changed

Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ BROWSER_LIST?=chrome
4141
ALT_BROWSER_LIST?=chrome
4242
BASEURL?=http://192.168.99.100:9500
4343
TEST_TYPE?=local
44-
SPECS?=system-test/*-specs.js
44+
SPECS?=system-test/urth-system-test-specs.js system-test/urth-core-bind-specs.js system-test/urth-viz-table-specs.js
4545
PYTHON2_SPECS?=system-test/urth-system-test-specs.js
46-
ALT_JUPYTER_SPECS?=system-test/urth-system-test-specs.js system-test/urth-r-widgets-specs.js
46+
ALT_JUPYTER_SPECS?=system-test/urth-system-test-specs.js
47+
R_SPECS?=system-test/urth-r-widgets-specs.js
48+
SCALA_SPECS?=system-test/urth-scala-widgets-specs.js
4749
ALT_JUPYTER_VERSION?=4.2
4850
PYTHON?=python3
4951
TEST_MSG?="Starting system tests"
@@ -394,7 +396,17 @@ system-test-alt-jupyter: TEST_MSG="Starting system tests for Jupyter $(ALT_JUPYT
394396
system-test-alt-jupyter:
395397
@TEST_MSG=$(TEST_MSG) TEST_TYPE=$(TEST_TYPE) BROWSER_LIST="$(ALT_BROWSER_LIST)" JUPYTER=$(JUPYTER) SPECS="$(SPECS)" BASEURL=$(BASEURL) $(MAKE) run-test
396398

397-
system-test-all: system-test-python3 system-test-python2 system-test-alt-jupyter
399+
system-test-scala: SPECS:=$(SCALA_SPECS)
400+
system-test-scala: TEST_MSG="Starting system tests for Scala"
401+
system-test-scala:
402+
@TEST_MSG=$(TEST_MSG) TEST_TYPE=$(TEST_TYPE) BROWSER_LIST="$(ALT_BROWSER_LIST)" JUPYTER=$(JUPYTER) SPECS="$(SPECS)" BASEURL=$(BASEURL) $(MAKE) run-test
403+
404+
system-test-r: SPECS:=$(R_SPECS)
405+
system-test-r: TEST_MSG="Starting system tests for R"
406+
system-test-r:
407+
@TEST_MSG=$(TEST_MSG) TEST_TYPE=$(TEST_TYPE) BROWSER_LIST="$(ALT_BROWSER_LIST)" JUPYTER=$(JUPYTER) SPECS="$(SPECS)" BASEURL=$(BASEURL) $(MAKE) run-test
408+
409+
system-test-all: system-test-python3 system-test-python2 system-test-alt-jupyter system-test-scala system-test-r
398410

399411
start-selenium: node_modules stop-selenium
400412
@echo "Installing and starting Selenium Server..."

etc/notebooks/tests/Walkthrough-Scala.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@
4444
"outputs": [],
4545
"source": [
4646
"// modify to IP and Port of this notebook server\n",
47-
"%addjar http://localhost:8888/nbextensions/urth_widgets/urth-widgets.jar"
47+
"%addjar http://localhost:8888/nbextensions/declarativewidgets/urth-widgets.jar"
4848
]
4949
},
5050
{
5151
"cell_type": "code",
5252
"execution_count": null,
5353
"metadata": {
54-
"collapsed": true
54+
"collapsed": false
5555
},
5656
"outputs": [],
5757
"source": [

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var boilerplate = new Boilerplate();
77

88
describe('Urth Core Bind', function() {
99

10-
boilerplate.setup(this.title, '/notebooks/tests/urth-core-bind.ipynb', 3);
10+
boilerplate.setup(this.title, '/notebooks/tests/urth-core-bind.ipynb', 4);
1111

1212
it('should wait for dependency to load', function(done) {
1313
// Using a random number to protect against the possibility of a previous

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

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

88
process.env.PYTHON != "python2" && describe('Widgets R System Test', function() {
9-
boilerplate.setup(this.title, '/notebooks/tests/urth-r-widgets.ipynb', 7);
9+
boilerplate.setup(this.title, '/notebooks/tests/urth-r-widgets.ipynb', 8);
1010

1111
it('should print the result of a Function Widget invocation', function(done) {
1212
boilerplate.browser
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright (c) Jupyter Development Team.
2+
// Distributed under the terms of the Modified BSD License.
3+
4+
var wd = require('wd');
5+
var Boilerplate = require('./utils/boilerplate');
6+
var boilerplate = new Boilerplate();
7+
8+
process.env.PYTHON != "python2" && describe('Widgets Scala System Test', function() {
9+
boilerplate.setup(this.title, '/notebooks/tests/Walkthrough-Scala.ipynb', 11);
10+
11+
var timeout = 30000;
12+
13+
it('should print the correct variable that is used for urth-core-function', function(done) {
14+
15+
boilerplate.browser
16+
.elementsByCssSelector('div.code_cell').nth(5)
17+
.elementByXPath('//button[text()="invoke"]').click()
18+
.waitForElementById('test1', wd.asserters.textInclude('world'), timeout)
19+
.nodeify(done);
20+
});
21+
22+
it('should bind variable to channel a', function(done) {
23+
boilerplate.browser
24+
.elementsByCssSelector('div.code_cell').nth(6)
25+
.elementByCssSelector('>', 'input')
26+
.type('A')
27+
.waitForElementById('test2', wd.asserters.textInclude('A'), timeout)
28+
.nodeify(done);
29+
});
30+
31+
it('should bind variable to channel b', function(done) {
32+
boilerplate.browser
33+
.elementsByCssSelector('div.code_cell').nth(7)
34+
.elementByCssSelector('>', 'input')
35+
.type('B')
36+
.waitForElementById('test3', wd.asserters.textInclude('B'), timeout)
37+
.nodeify(done);
38+
});
39+
40+
it('should bind variables to channels independently', function(done) {
41+
boilerplate.browser
42+
.elementsByCssSelector('div.code_cell').nth(6)
43+
.elementByCssSelector('>', 'input')
44+
.type('2')
45+
.elementByCssSelector('#test2')
46+
.text().should.eventually.include('A2')
47+
.waitForElementById('test2', wd.asserters.textInclude('A2'), timeout)
48+
.waitForElementById('test3', wd.asserters.textInclude('B'), timeout)
49+
.nodeify(done);
50+
});
51+
52+
it('should watch for changes in a watched variable', function(done) {
53+
boilerplate.browser
54+
.elementByXPath('//button[text()="initChannelWatch"]').click()
55+
.elementsByCssSelector('div.code_cell').nth(8)
56+
.elementByCssSelector('>', 'input')
57+
.type('watched message')
58+
.waitForElementById('test4', wd.asserters.textInclude('watched message'), timeout)
59+
.nodeify(done);
60+
});
61+
62+
it('should update output when DataFrame is modified and set to auto', function(done) {
63+
boilerplate.browser
64+
.elementsByCssSelector('div.code_cell').nth(14)
65+
.waitForElementByClassName('test5', wd.asserters.textInclude('Richard Roe'), timeout)
66+
.nodeify(done);
67+
});
68+
});

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

Lines changed: 1 addition & 62 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', 10);
9+
boilerplate.setup(this.title, '/notebooks/tests/Walkthrough.ipynb', 13);
1010

1111
it('should not execute Urth.whenReady API until components have upgraded', function(done) {
1212
boilerplate.browser
@@ -89,64 +89,3 @@ describe('Widgets Python System Test', function() {
8989
});
9090
});
9191

92-
process.env.PYTHON != "python2" && describe('Widgets Scala System Test', function() {
93-
boilerplate.setup(this.title, '/notebooks/tests/Walkthrough-Scala.ipynb', 10);
94-
95-
var timeout = 30000;
96-
97-
it('should print the correct variable that is used for urth-core-function', function(done) {
98-
99-
boilerplate.browser
100-
.elementsByCssSelector('div.code_cell').nth(5)
101-
.elementByXPath('//button[text()="invoke"]').click()
102-
.waitForElementById('test1', wd.asserters.textInclude('world'), timeout)
103-
.nodeify(done);
104-
});
105-
106-
it('should bind variable to channel a', function(done) {
107-
boilerplate.browser
108-
.elementsByCssSelector('div.code_cell').nth(6)
109-
.elementByCssSelector('>', 'input')
110-
.type('A')
111-
.waitForElementById('test2', wd.asserters.textInclude('A'), timeout)
112-
.nodeify(done);
113-
});
114-
115-
it('should bind variable to channel b', function(done) {
116-
boilerplate.browser
117-
.elementsByCssSelector('div.code_cell').nth(7)
118-
.elementByCssSelector('>', 'input')
119-
.type('B')
120-
.waitForElementById('test3', wd.asserters.textInclude('B'), timeout)
121-
.nodeify(done);
122-
});
123-
124-
it('should bind variables to channels independently', function(done) {
125-
boilerplate.browser
126-
.elementsByCssSelector('div.code_cell').nth(6)
127-
.elementByCssSelector('>', 'input')
128-
.type('2')
129-
.elementByCssSelector('#test2')
130-
.text().should.eventually.include('A2')
131-
.waitForElementById('test2', wd.asserters.textInclude('A2'), timeout)
132-
.waitForElementById('test3', wd.asserters.textInclude('B'), timeout)
133-
.nodeify(done);
134-
});
135-
136-
it('should watch for changes in a watched variable', function(done) {
137-
boilerplate.browser
138-
.elementByXPath('//button[text()="initChannelWatch"]').click()
139-
.elementsByCssSelector('div.code_cell').nth(8)
140-
.elementByCssSelector('>', 'input')
141-
.type('watched message')
142-
.waitForElementById('test4', wd.asserters.textInclude('watched message'), timeout)
143-
.nodeify(done);
144-
});
145-
146-
it('should update output when DataFrame is modified and set to auto', function(done) {
147-
boilerplate.browser
148-
.elementsByCssSelector('div.code_cell').nth(14)
149-
.waitForElementByClassName('test5', wd.asserters.textInclude('Richard Roe'), timeout)
150-
.nodeify(done);
151-
});
152-
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('Urth Viz Table Test', function() {
2222
.catch(tagChaiAssertionError);
2323
};
2424

25-
boilerplate.setup(this.title, '/notebooks/tests/urth-viz-table.ipynb', 3);
25+
boilerplate.setup(this.title, '/notebooks/tests/urth-viz-table.ipynb', 4);
2626

2727
it('should run all cells and find a handsontable in the 3rd output area', function(done) {
2828
boilerplate.browser

system-test/utils/boilerplate.js

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ Boilerplate.prototype.setup = function(testName, startingURL, outputCount){
107107
var kernelStartTimeout = 200000;
108108
var defaultTimeout = 10000;
109109
var runAllCompletionTimeout = 50000;
110+
var sleepBetweenCells = 2000;
111+
if (testName.indexOf("Scala") > -1) {
112+
sleepBetweenCells = 5000;
113+
}
110114

111115
function clickTheElement(element) {
112116
return new Promise(function(resolve) {
@@ -116,7 +120,7 @@ Boilerplate.prototype.setup = function(testName, startingURL, outputCount){
116120
.waitForElementByLinkText("Run Cells", wd.asserters.isDisplayed, 10000)
117121
.elementByLinkText("Run Cells")
118122
.click()
119-
.sleep(5000);
123+
.sleep(sleepBetweenCells);
120124
resolve(newElement);
121125
});
122126
}
@@ -135,21 +139,40 @@ Boilerplate.prototype.setup = function(testName, startingURL, outputCount){
135139

136140
this.browser.init(desired)
137141
.get(startingURL || '/')
138-
.waitForElementByCssSelector("#kernel_indicator_icon.kernel_idle_icon", wd.asserters.isDisplayed, kernelStartTimeout)
142+
.waitForElementByCssSelector('#kernel_indicator_icon.kernel_idle_icon', wd.asserters.isDisplayed, 80000)
143+
.waitForElementByLinkText('Cell', wd.asserters.isDisplayed, 10000)
139144
.safeExecute('localStorage.clear()')
140-
.waitForElementByCssSelector('div.output_area', wd.asserters.isDisplayed, defaultTimeout)
141-
.setAsyncScriptTimeout(15000)
142-
.waitForConditionInBrowser('window.Urth && Urth.kernel && Urth.kernel.is_connected()', defaultTimeout)
143-
.waitForElementByCssSelector('#kernel_indicator_icon.kernel_idle_icon', wd.asserters.isDisplayed, kernelStartTimeout)
144-
.waitForConditionInBrowser('typeof Urth.whenReady === "function"', kernelStartTimeout)
145-
.elementsByCssSelector('div.input').then(function (elements) {
146-
runAllCells(elements, 0);
147-
})
148-
.waitFor(outputAsserter, runAllCompletionTimeout*5, defaultTimeout)
149-
.eval("!!document.body.createShadowRoot", function(err, value) {
145+
.elementByLinkText('Cell')
146+
.click()
147+
.waitForElementByLinkText('Run All', wd.asserters.isDisplayed, 10000)
148+
.elementByLinkText('Run All')
149+
.click()
150+
.eval('!!document.body.createShadowRoot', function(err, value) {
150151
this.browserSupportsShadowDOM = value;
151152
}.bind(this))
153+
.waitForElementByCssSelector('div.output_area', wd.asserters.isDisplayed, 10000)
154+
.setAsyncScriptTimeout(15000)
155+
.waitForConditionInBrowser('window.Urth && Urth.kernel && Urth.kernel.is_connected()', 10000)
156+
.waitForElementByCssSelector('#kernel_indicator_icon.kernel_idle_icon', wd.asserters.isDisplayed, 20000)
157+
.waitForConditionInBrowser('typeof Urth.whenReady === "function"', 10000)
158+
.waitFor(outputAsserter, runAllCompletionTimeout*5, 1000)
152159
.nodeify(done);
160+
161+
// this.browser.init(desired)
162+
// .get(startingURL || '/')
163+
// .waitForElementByCssSelector("#kernel_indicator_icon.kernel_idle_icon", wd.asserters.isDisplayed, kernelStartTimeout)
164+
// .setAsyncScriptTimeout(15000)
165+
// .waitForConditionInBrowser('window.Urth && Urth.kernel && Urth.kernel.is_connected()', defaultTimeout)
166+
// .waitForElementByCssSelector('#kernel_indicator_icon.kernel_idle_icon', wd.asserters.isDisplayed, kernelStartTimeout)
167+
// .waitForConditionInBrowser('typeof Urth.whenReady === "function"', kernelStartTimeout)
168+
// .elementsByCssSelector('div.input').then(function (elements) {
169+
// runAllCells(elements, 0);
170+
// })
171+
// .waitFor(outputAsserter, runAllCompletionTimeout*5, 1000)
172+
// .eval("!!document.body.createShadowRoot", function(err, value) {
173+
// this.browserSupportsShadowDOM = value;
174+
// }.bind(this))
175+
// .nodeify(done);
153176
}.bind(this));
154177

155178
after(function(done){

0 commit comments

Comments
 (0)