diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-02-17 16:04:18 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-02-17 16:04:18 +0100 |
commit | d0e47e1bfb32f14b2613d353e1df7c11ad51cb61 (patch) | |
tree | 55b5528a11d79e84a29df7498f144c3410c40012 | |
parent | 8eb8d09db5b68972de4507df33c13a2dee738cf3 (diff) | |
download | kvision-d0e47e1bfb32f14b2613d353e1df7c11ad51cb61.tar.gz kvision-d0e47e1bfb32f14b2613d353e1df7c11ad51cb61.tar.bz2 kvision-d0e47e1bfb32f14b2613d353e1df7c11ad51cb61.zip |
Fixed tests with headless Chrome.
14 files changed, 44 insertions, 4 deletions
diff --git a/build.gradle b/build.gradle index 705fe84a..69d5470a 100644 --- a/build.gradle +++ b/build.gradle @@ -139,6 +139,7 @@ if (!project.gradle.startParameter.taskNames.contains("dokka")) { dependency("element-resize-event", "3.0.3") dependency("navigo", "7.0.0") devDependency("karma", "3.1.4") + devDependency("karma-chrome-launcher", "2.2.0") devDependency("qunit", "2.8.0") } @@ -147,7 +148,10 @@ if (!project.gradle.startParameter.taskNames.contains("dokka")) { contentPath = file('src/main/web') mode = production ? "production" : "development" } - + karma { + plugins = ["karma-chrome-launcher"] + browsers = ["ChromeHeadless"] + } define "PRODUCTION", production } @@ -233,6 +237,7 @@ if (!project.gradle.startParameter.taskNames.contains("dokka")) { afterEvaluate { tasks.getByName("webpack-bundle") { dependsOn(copyResources) } tasks.getByName("webpack-run") { dependsOn(copyResources) } + tasks.getByName("test") { dependsOn(copyResources, copyResourcesForTests) } tasks.getByName("karma-start") { dependsOn(copyResources, copyResourcesForTests) } } } diff --git a/kvision-modules/kvision-bootstrap/build.gradle b/kvision-modules/kvision-bootstrap/build.gradle index a1aec534..e81e384c 100644 --- a/kvision-modules/kvision-bootstrap/build.gradle +++ b/kvision-modules/kvision-bootstrap/build.gradle @@ -9,6 +9,9 @@ kotlinFrontend { dependency("font-awesome-webpack", "github:jarecsni/font-awesome-webpack") dependency("awesome-bootstrap-checkbox", "0.3.7") dependency("bootstrap-vertical-tabs", "1.2.2") + devDependency("karma", "3.1.4") + devDependency("karma-chrome-launcher", "2.2.0") + devDependency("qunit", "2.8.0") } } diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/window/WindowSpec.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/window/WindowSpec.kt index 477ab1f6..e87626ca 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/window/WindowSpec.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/window/WindowSpec.kt @@ -44,7 +44,7 @@ class WindowSpec : DomSpec { ) window.isResizable = true assertEqualsHtml( - "<div class=\"modal-content kv-window\" id=\"$id\" style=\"width: auto; position: absolute; z-index: 901; overflow: hidden; resize: both; height: 12px;\"><div class=\"modal-header\"><h4 class=\"modal-title\">Window title</h4></div><div style=\"height: auto; overflow: auto; margin-bottom: 11px;\"></div><object style=\"display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1; opacity: 0;\" class=\"resize-sensor\" type=\"text/html\" data=\"about:blank\"></object></div>", + "<div class=\"modal-content kv-window\" id=\"$id\" style=\"width: auto; position: absolute; z-index: 901; overflow: hidden; resize: both;\"><div class=\"modal-header\"><h4 class=\"modal-title\">Window title</h4></div><div style=\"height: auto; overflow: auto; margin-bottom: 11px;\"></div><object style=\"position: absolute; top: 0; left: 0; height: 100%; width: 100%; pointer-events: none; z-index: -1; opacity: 0;\" class=\"resize-sensor\" tabindex=\"-1\" type=\"text/html\" data=\"about:blank\"></object></div>", element?.innerHTML, "Should render floating window with resizable handler" ) diff --git a/kvision-modules/kvision-bootstrap/webpack.config.d/bootstrap.js b/kvision-modules/kvision-bootstrap/webpack.config.d/bootstrap.js new file mode 100644 index 00000000..32a7c4d0 --- /dev/null +++ b/kvision-modules/kvision-bootstrap/webpack.config.d/bootstrap.js @@ -0,0 +1,4 @@ +config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'}); +config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'}); +config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'}); +config.module.rules.push({test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml'}); diff --git a/kvision-modules/kvision-bootstrap/webpack.config.d/css.js b/kvision-modules/kvision-bootstrap/webpack.config.d/css.js new file mode 100644 index 00000000..5d710d35 --- /dev/null +++ b/kvision-modules/kvision-bootstrap/webpack.config.d/css.js @@ -0,0 +1,2 @@ +config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" }); + diff --git a/kvision-modules/kvision-datetime/build.gradle b/kvision-modules/kvision-datetime/build.gradle index b853d2f4..610b1d9c 100644 --- a/kvision-modules/kvision-datetime/build.gradle +++ b/kvision-modules/kvision-datetime/build.gradle @@ -4,6 +4,9 @@ kotlinFrontend { npm { dependency("bootstrap-datetime-picker", "2.4.4") + devDependency("karma", "3.1.4") + devDependency("karma-chrome-launcher", "2.2.0") + devDependency("qunit", "2.8.0") } } diff --git a/kvision-modules/kvision-handlebars/build.gradle b/kvision-modules/kvision-handlebars/build.gradle index 3a374298..f0cc69ec 100644 --- a/kvision-modules/kvision-handlebars/build.gradle +++ b/kvision-modules/kvision-handlebars/build.gradle @@ -5,6 +5,9 @@ kotlinFrontend { npm { dependency("handlebars", "4.0.12") dependency("handlebars-loader", "1.7.1") + devDependency("karma", "3.1.4") + devDependency("karma-chrome-launcher", "2.2.0") + devDependency("qunit", "2.8.0") } } diff --git a/kvision-modules/kvision-i18n/build.gradle b/kvision-modules/kvision-i18n/build.gradle index a2b6d3f8..88147bbe 100644 --- a/kvision-modules/kvision-i18n/build.gradle +++ b/kvision-modules/kvision-i18n/build.gradle @@ -4,6 +4,9 @@ kotlinFrontend { npm { dependency("jed", "1.1.1") + devDependency("karma", "3.1.4") + devDependency("karma-chrome-launcher", "2.2.0") + devDependency("qunit", "2.8.0") } } diff --git a/kvision-modules/kvision-richtext/build.gradle b/kvision-modules/kvision-richtext/build.gradle index 6f0c918d..9b74fd1c 100644 --- a/kvision-modules/kvision-richtext/build.gradle +++ b/kvision-modules/kvision-richtext/build.gradle @@ -4,6 +4,9 @@ kotlinFrontend { npm { dependency("trix", "1.0.0") + devDependency("karma", "3.1.4") + devDependency("karma-chrome-launcher", "2.2.0") + devDependency("qunit", "2.8.0") } } diff --git a/kvision-modules/kvision-select/build.gradle b/kvision-modules/kvision-select/build.gradle index f8fcbc8a..65b8a83c 100644 --- a/kvision-modules/kvision-select/build.gradle +++ b/kvision-modules/kvision-select/build.gradle @@ -5,6 +5,9 @@ kotlinFrontend { npm { dependency("bootstrap-select", "1.12.4") dependency("ajax-bootstrap-select", "1.4.3") + devDependency("karma", "3.1.4") + devDependency("karma-chrome-launcher", "2.2.0") + devDependency("qunit", "2.8.0") } } diff --git a/kvision-modules/kvision-spinner/build.gradle b/kvision-modules/kvision-spinner/build.gradle index 0c3a2940..e7600e5a 100644 --- a/kvision-modules/kvision-spinner/build.gradle +++ b/kvision-modules/kvision-spinner/build.gradle @@ -4,6 +4,9 @@ kotlinFrontend { npm { dependency("bootstrap-touchspin", "4.2.5") + devDependency("karma", "3.1.4") + devDependency("karma-chrome-launcher", "2.2.0") + devDependency("qunit", "2.8.0") } } diff --git a/kvision-modules/kvision-spinner/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt b/kvision-modules/kvision-spinner/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt index e2eec3f9..30f12a93 100644 --- a/kvision-modules/kvision-spinner/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt +++ b/kvision-modules/kvision-spinner/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt @@ -43,13 +43,13 @@ class SpinnerSpec : DomSpec { val element = document.getElementById("test") val id = ti.input.id assertEqualsHtml( - "<div class=\"form-group\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"input-group kv-spinner-btn-vertical\"><span><div class=\"input-group bootstrap-touchspin\"><span class=\"input-group-addon bootstrap-touchspin-prefix\" style=\"display: none;\"></span><input class=\"form-control\" id=\"$id\" type=\"text\" value=\"13\" placeholder=\"place\" name=\"name\" disabled=\"disabled\" style=\"display: block;\"><span class=\"input-group-addon bootstrap-touchspin-postfix\" style=\"display: none;\"></span><span class=\"input-group-btn-vertical\"><button class=\"btn btn-default bootstrap-touchspin-up\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-up\"></i></button><button class=\"btn btn-default bootstrap-touchspin-down\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-down\"></i></button></span></div></span></div></div>", + "<div class=\"form-group\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"input-group kv-spinner-btn-vertical\"><span><div class=\"input-group bootstrap-touchspin bootstrap-touchspin-injected\"><input class=\"form-control\" id=\"$id\" type=\"text\" value=\"13\" placeholder=\"place\" name=\"name\" disabled=\"disabled\"><span class=\"input-group-btn-vertical\"><button class=\"btn btn-default bootstrap-touchspin-up \" type=\"button\"><i class=\"fa fa-caret-up\"></i></button><button class=\"btn btn-default bootstrap-touchspin-down \" type=\"button\"><i class=\"fa fa-caret-down\"></i></button></span></div></span></div></div>", element?.innerHTML, "Should render correct spinner input form control" ) ti.validatorError = "Validation Error" assertEqualsHtml( - "<div class=\"form-group has-error\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"input-group kv-spinner-btn-vertical\"><span><div class=\"input-group bootstrap-touchspin\"><span class=\"input-group-addon bootstrap-touchspin-prefix\" style=\"display: none;\"></span><input class=\"form-control\" id=\"$id\" type=\"text\" value=\"13\" placeholder=\"place\" name=\"name\" disabled=\"disabled\" style=\"display: block;\"><span class=\"input-group-addon bootstrap-touchspin-postfix\" style=\"display: none;\"></span><span class=\"input-group-btn-vertical\"><button class=\"btn btn-default bootstrap-touchspin-up\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-up\"></i></button><button class=\"btn btn-default bootstrap-touchspin-down\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-down\"></i></button></span></div></span></div><span class=\"help-block small\">Validation Error</span></div>", + "<div class=\"form-group has-error\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"input-group kv-spinner-btn-vertical\"><span><div class=\"input-group bootstrap-touchspin bootstrap-touchspin-injected\"><input class=\"form-control\" id=\"$id\" type=\"text\" value=\"13\" placeholder=\"place\" name=\"name\" disabled=\"disabled\"><span class=\"input-group-btn-vertical\"><button class=\"btn btn-default bootstrap-touchspin-up \" type=\"button\"><i class=\"fa fa-caret-up\"></i></button><button class=\"btn btn-default bootstrap-touchspin-down \" type=\"button\"><i class=\"fa fa-caret-down\"></i></button></span></div></span></div><span class=\"help-block small\">Validation Error</span></div>", element?.innerHTML, "Should render correct spinner input form control with validation error" ) diff --git a/kvision-modules/kvision-upload/build.gradle b/kvision-modules/kvision-upload/build.gradle index 943bb927..8b90532c 100644 --- a/kvision-modules/kvision-upload/build.gradle +++ b/kvision-modules/kvision-upload/build.gradle @@ -4,6 +4,9 @@ kotlinFrontend { npm { dependency("bootstrap-fileinput", "4.5.2") + devDependency("karma", "3.1.4") + devDependency("karma-chrome-launcher", "2.2.0") + devDependency("qunit", "2.8.0") } } diff --git a/kvision-modules/shared.gradle b/kvision-modules/shared.gradle index 4ded9c6c..2b45f630 100644 --- a/kvision-modules/shared.gradle +++ b/kvision-modules/shared.gradle @@ -11,6 +11,11 @@ kotlinFrontend { } define "PRODUCTION", production + + karma { + plugins = ["karma-chrome-launcher"] + browsers = ["ChromeHeadless"] + } } |