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

Commit 62371fe

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

8 files changed

+84
-72
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ SCALA_BUILD_REPO:=1science/sbt
3939
PORT_MAP?=-p 9500:8888
4040
BROWSER_LIST?=chrome
4141
ALT_BROWSER_LIST?=chrome
42+
RUN_ALL_TESTS_BROWSER_LIST?="chrome"
4243
BASEURL?=http://192.168.99.100:9500
4344
TEST_TYPE?=local
4445
SPECS?=system-test/*-specs.js
@@ -375,7 +376,9 @@ run-test: sdist remove-server
375376
@OPTIONS=-d SERVER_NAME=$(SERVER_NAME) $(MAKE) server$(JUPYTER)
376377
@echo 'Waiting for server to start...'
377378
@LIMIT=60; while [ $$LIMIT -gt 0 ] && ! docker logs $(SERVER_NAME) 2>&1 | grep 'Notebook is running'; do echo waiting $$LIMIT...; sleep 1; LIMIT=$$(expr $$LIMIT - 1); done
378-
@$(foreach browser, $(BROWSER_LIST), echo 'Running system integration tests on $(browser)...'; npm run system-test -- $(SPECS) --baseurl $(BASEURL) --test-type $(TEST_TYPE) --browser $(browser) || exit)
379+
@$(foreach browser, $(BROWSER_LIST), echo 'Running system integration tests on $(browser)...'; \
380+
[[ $(RUN_ALL_TESTS_BROWSER_LIST) =~ $(browser) ]] && (npm run system-test -- $(SPECS) --baseurl $(BASEURL) --test-type $(TEST_TYPE) --browser $(browser) || exit) \
381+
|| (npm run system-test -- system-test/urth-system-test-specs.js --baseurl $(BASEURL) --test-type $(TEST_TYPE) --browser $(browser) || exit))
379382
@SERVER_NAME=$(SERVER_NAME) $(MAKE) remove-server
380383

381384
system-test-python3: TEST_MSG="Starting system tests for Python 3"

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: 6 additions & 4 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 = 1000;
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
}
@@ -136,16 +140,14 @@ Boilerplate.prototype.setup = function(testName, startingURL, outputCount){
136140
this.browser.init(desired)
137141
.get(startingURL || '/')
138142
.waitForElementByCssSelector("#kernel_indicator_icon.kernel_idle_icon", wd.asserters.isDisplayed, kernelStartTimeout)
139-
.safeExecute('localStorage.clear()')
140-
.waitForElementByCssSelector('div.output_area', wd.asserters.isDisplayed, defaultTimeout)
141143
.setAsyncScriptTimeout(15000)
142144
.waitForConditionInBrowser('window.Urth && Urth.kernel && Urth.kernel.is_connected()', defaultTimeout)
143145
.waitForElementByCssSelector('#kernel_indicator_icon.kernel_idle_icon', wd.asserters.isDisplayed, kernelStartTimeout)
144146
.waitForConditionInBrowser('typeof Urth.whenReady === "function"', kernelStartTimeout)
145147
.elementsByCssSelector('div.input').then(function (elements) {
146148
runAllCells(elements, 0);
147149
})
148-
.waitFor(outputAsserter, runAllCompletionTimeout*5, defaultTimeout)
150+
.waitFor(outputAsserter, runAllCompletionTimeout*5, 1000)
149151
.eval("!!document.body.createShadowRoot", function(err, value) {
150152
this.browserSupportsShadowDOM = value;
151153
}.bind(this))

0 commit comments

Comments
 (0)