Skip to content

Commit

Permalink
#6772: show null execution result tests (#6799)
Browse files Browse the repository at this point in the history
* #6772 add test notebook

* #6772 add test cases

* #6772 fix null execution test case
  • Loading branch information
wojciechowskim authored and scottdraves committed Feb 8, 2018
1 parent 4b69d6e commit 9fa5892
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 0 deletions.
92 changes: 92 additions & 0 deletions test/notebooks/groovy/ShowNullExecutionResultTest.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"com.twosigma.beakerx.kernel.Kernel.showNullExecutionResult"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"null"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"com.twosigma.beakerx.kernel.Kernel.showNullExecutionResult = true;\n",
"String seeNullString = null;\n",
"seeNullString"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"null"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"com.twosigma.beakerx.kernel.Kernel.showNullExecutionResult = false;\n",
"String noNullString = null;\n",
"noNullString"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Groovy",
"language": "groovy",
"name": "groovy"
},
"language_info": {
"codemirror_mode": "groovy",
"file_extension": ".groovy",
"mimetype": "",
"name": "Groovy",
"nbconverter_exporter": "",
"version": "2.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
59 changes: 59 additions & 0 deletions test/tests/groovy/showNullExecutionResultTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2017 TWO SIGMA OPEN SOURCE, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

var BeakerXPageObject = require('../beakerx.po.js');
var beakerxPO;

describe('(Groovy) Testing of showing the null execution result', function() {

beforeAll(function () {
beakerxPO = new BeakerXPageObject();
beakerxPO.runNotebookByUrl('/notebooks/test/notebooks/groovy/ShowNullExecutionResultTest.ipynb');
}, 2);

afterAll(function () {
beakerxPO.closeAndHaltNotebook();
});

describe('(Groovy) Show null execution result as true', function() {
it('Cell displays true output', function () {
cellIndex = 0;
var codeCell = beakerxPO.runCodeCellByIndex(cellIndex);

expect(codeCell.$('div.output_result').isEnabled()).toBeTruthy();
expect(codeCell.$('div.output_result').getText()).toBe('true');
});
});

describe('(Groovy) Show null execution result as null', function() {
it('Cell displays null output', function () {
cellIndex += 1;
var codeCell = beakerxPO.runCodeCellByIndex(cellIndex);

expect(codeCell.$('div.output_result').isEnabled()).toBeTruthy();
expect(codeCell.$('div.output_result').getText()).toBe('null');
});
});

describe('(Groovy) Do not show null execution result', function() {
it('Cell displays no output', function () {
cellIndex += 1;
var codeCell = beakerxPO.runCodeCellByIndex(cellIndex);

expect(codeCell.$('div.output').getText()).toBe('');
});
});
});

0 comments on commit 9fa5892

Please sign in to comment.