Skip to content

Commit

Permalink
add e2e tests for code autocomplete (#6915)
Browse files Browse the repository at this point in the history
* add tests for autocomplete

* clean notebook outputs
  • Loading branch information
EfimovVladimir authored and scottdraves committed Mar 1, 2018
1 parent 8e3ad4d commit 2f01e26
Show file tree
Hide file tree
Showing 15 changed files with 191 additions and 103 deletions.
18 changes: 17 additions & 1 deletion test/ipynb/clojure/ClojureTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@
"(run 6 6 6 100000)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"press 'Tab' for autocomplete"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -76,7 +92,7 @@
"mimetype": "text/x-clojure",
"name": "Clojure",
"nbconverter_exporter": "",
"version": "1.7"
"version": "1.9.0"
}
},
"nbformat": 4,
Expand Down
16 changes: 16 additions & 0 deletions test/ipynb/groovy/GroovyTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,22 @@
"beakerx.getCodeCells('tg1')[0].outputs"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"press 'Tab' for autocomplete"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"de"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
23 changes: 23 additions & 0 deletions test/ipynb/java/JavaTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,22 @@
"System.out.println(t.getObjectTest());"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"press 'Tab' for autocomplete"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"imp"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -205,6 +221,13 @@
"source": [
"OutputManager.setOutput(null);"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
65 changes: 23 additions & 42 deletions test/ipynb/kotlin/KotlinTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,9 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"null"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"fun double(x: Int): Int {\n",
" return 2*x\n",
Expand All @@ -25,42 +14,18 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"hello, 623"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"\"hello, \" + double(3) + x"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b2296a89-2940-40d2-9b0b-693162ad9256",
"version_major": 2,
"version_minor": 0
},
"method": "display_data"
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"val numbers: MutableList<Number> = mutableListOf(1, 4, 3)\n",
"val line = Line()\n",
Expand All @@ -71,6 +36,22 @@
"plot"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"press 'Tab' for autocomplete"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fu"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -91,7 +72,7 @@
"mimetype": "",
"name": "Kotlin",
"nbconverter_exporter": "",
"version": "1.2.0"
"version": "1.2.21"
}
},
"nbformat": 4,
Expand Down
16 changes: 16 additions & 0 deletions test/ipynb/python/InitCellsTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
"print(time.strftime(\"%a %b %d %Y\"))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"press 'Tab' for autocomplete"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"im"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
55 changes: 21 additions & 34 deletions test/ipynb/scala/ScalaTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,9 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"defined class Greeter\n"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"class Greeter(prefix: String, suffix: String) {\n",
" def greet(name: String): Unit =\n",
Expand All @@ -25,32 +14,30 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello, Scala developer!\n"
]
},
{
"data": {
"text/plain": [
"null"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"val greeter = new Greeter(\"Hello, \", \"!\")\n",
"greeter.greet(\"Scala developer\") // Hello, Scala developer!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"press 'Tab' for autocomplete"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"pr"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -71,7 +58,7 @@
"mimetype": "",
"name": "Scala",
"nbconverter_exporter": "",
"version": "2.11.11"
"version": "2.11.12"
}
},
"nbformat": 4,
Expand Down
21 changes: 4 additions & 17 deletions test/ipynb/sql/SQLTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -36,22 +36,9 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "aa300682-d63e-4b54-97d2-b9b35327360c",
"version_major": 2,
"version_minor": 0
},
"method": "display_data"
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"SELECT * FROM color WHERE name LIKE 'A%';"
]
Expand Down
11 changes: 11 additions & 0 deletions test/js/beakerx.po.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,17 @@ function BeakerXPageObject() {
return codeCell.$('div.beaker-easyform-container');
};

this.callAutocompleteAndGetItsList = function(codeCell){
codeCell.scroll();
codeCell.click('div.CodeMirror-code[role="presentation"]');
browser.keys("Tab");
browser.keys('\uE000');
browser.waitUntil(function() {
return browser.isVisible('#complete');
}, 10000, 'autocomplete list is not visible');
return $$('#complete > select > option');
}

};

module.exports = BeakerXPageObject;
9 changes: 9 additions & 0 deletions test/js/clojure/clojureTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,13 @@ describe('Clojure base tests ', function () {
});
});

describe('(Clojure) Press "Tab" to autocomplete code ', function(){
it('Autocomplete list is not empty ', function(){
cellIndex += 1;
var codeCell = beakerxPO.getCodeCellByIndex(cellIndex);
var completeList = beakerxPO.callAutocompleteAndGetItsList(codeCell);
expect(completeList.length).toBeGreaterThan(0);
});
});

});
9 changes: 9 additions & 0 deletions test/js/groovy/groovyTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,13 @@ describe('Groovy base tests. ', function () {
});
});

describe('(Groovy) Press "Tab" to autocomplete code ', function(){
it('Autocomplete list is not empty ', function(){
cellIndex += 1;
var codeCell = beakerxPO.getCodeCellByIndex(cellIndex);
var completeList = beakerxPO.callAutocompleteAndGetItsList(codeCell);
expect(completeList.length).toBeGreaterThan(0);
});
});

});
Loading

0 comments on commit 2f01e26

Please sign in to comment.