The last bunch of "spec has ho expectations" warnings is fixed
for the latest Jasmine. The option failSpecWithNoExpectations
is set to true now.
Related-Bug: #1894127
Change-Id: I87d6a3e0a21eb8f3e5a548d7fdd0ae01bbda54e1
This patch updates outdated JavaScript dev dependencies.
The latest Jasmine version makes nested beforeEach and unhandled
promise rejection fail, this was fixed.
Also, the latest Jasmine version runs tests in random order by default,
random is set to false for now to prevent tests failures.
Finally, the latest Jasmine version supports a new configuration option
failSpecWithNoExpectations. By default, this option is set to false and
Jasmine reports specs that have no expectations as passed. Setting this
option to true tells Jasmine to report specs without as expectations as
failed. For now, it is set to false for openstack-dashboard tests, this
should be changed in future.
Change-Id: I04d5c3ce7f7e0a9a38251e975b68bfa1998e556f
Pip 20.x requires ensure_str method from six which was introduced
in v.1.12.0 and wrapt v.1.11 is required by astroid v.2.4.0 with
the pylint dependency. So this patch update six and wrapt version
in lower-constraints.txt to fix the gate.
It also updates the browser to Firefox in karma.conf.js and adds
'karma-firefox-launchers' in package.json because nodejs-job
fail with chromium-browser due to not able to access some URL.
It also removes 'karma-chrome-launcher' enteries from all files
as it is no longer used. So let's switch to Firefox browser to
unblock the gate then we can investigate later how to fix it with
chromium-browser.
Depends-On: https://review.opendev.org/c/zuul/zuul-jobs/+/766744
Co-Authored-By: Vishal Manchanda <manchandavishal143@gmail.com>
Change-Id: I13e68d89f55407b1b3c64219969912700feef500
This change makes it so the tests will look for the actual
python folder where the xstatic files are located instead
of looking only for a python2.7/ folder.
Change-Id: Ib2a56475b79b002085922ab752038239635fb9a5
Closes-bug: #1706980
The Horizon spinner was using a spinner generated and animated
entirely out of JavaScript. Since CSS3 provides animates and we have
access to icon fonts, doing everything with JavaScript is not
necessary and actually taxing on the browser. Plus, all of the
spinner options were being passed in and around with JavaScript,
including the colors. This makes it supremely difficult to use the
theme to style the spinner.
The new spinner is just defined by a handful of templates now. There
are two clientside templates to support Legacy Horizon, and one
template in the Angular to support spinners going forward. Legacy
Horizon had two forms of spinners, so it was broken up. Angular as
not yet made use of the inline spinner, but should follow the same
markup when it is made.
There are two types of spinners, inline spinners (those shown when a
dynamic tab content is loading) and modal spinners (various other
places). These are consistent with each other for the 'default'
experience, but their experience can be entirely customized separate
from each other. 'material' has been augmented with loaders defined
within their design spec to show the power of this new feature.
horizon.templates.js was augmented with this refactor to support only
having to compile one tempalte at a time (instead of all of them) and
caching that template so that all of them can be recompiled later.
Also, horizon.loader.js was added to house template compilation code
that was repeated in several locations.
To test overwriting page modal spinner and inline-modal spinner
examples, please follow the instructions in _loading_inline_exmaple.html,
_loading_modal_example.html under
openstack_dashboard/themes/material/templates/horizon/client_side
Change-Id: I92bc786160e070d30691eeabd4f2a50d6e2bb395
Partially-implements: blueprint horizon-theme-css-reorg
Partially-Implements: blueprint bootstrap-html-standards
Closes-bug: #1570485
- Updated tox envlist, so just running `tox` from the CLI will now run all
voting gate tests
- Reduce duplicated definitions and commands
- Remove any reliance on run_tests within tox
- Removes all doc references to run_tests.sh, and replaces them
with their tox equivalent. Where necessary, language around the tox
commands has been altered or extended so that it makes sense and is
consistent with other parts of the docs. Also adds a new "Test Environment"
list to the docs, so that newcomers do not have to piece together CLI
commands and their cryptic extensions from tox.ini
- Move the inline shell scripting to its own file. Also fixes a bug when
passing args, since the logic assumed you were attempting a subset test
run (try `tox -e py27 -- --pdb` on master to compare)
- Moved translation tooling from run_tests to manage.py, w/ help text
and arg restrictions. This is much more flexible so that plugins can use
it without having to copy commands, but still defaults to exactly the
same parameters/behaviour from run_tests. Docs updated appropriately.
- Removed npm/karma strange reliance on either .venv or tox/py27. Now
it only uses tox/npm.
Change-Id: I883f885bd424955d39ddcfde5ba396a88cfc041e
Implements: blueprint enhance-tox
Closes-Bug: 1638672
This patch adds Angular Schema Form[1] and its requirements to Horizon.
There are a number of advantages to this over the current methods of
defining forms and workflows:
- All fields have an individual template, making theming improvements,
bug fixes, and bootstrap conformity easier.
- The file and line count, especially for workflows, is dramatically
reduced. The Create Net workflow, for example, goes from 12+ files to
2, with a big reduction in boilerplate HTML.
- All field validation messages are standardised, so we can match them
across Horizon and plugins
What this patch contains:
- Many common form fields, including things like the themable checkboxes
and selects.
- A basic modal template that can be passed with ui-bootstraps $modal
service to take advantage of schema-form
Next steps:
- Remove the other modal templates so we can standardise. A single
template opened from the $modal service is fine, and we shouldn't need
several directives. In this case, we should deprecate them, as the
modal forms will be used elsewhere.
- Map commonly used form items, like transfer tables, to a schema form
type like array (they serve similar purposes, so maybe thats what
should be replaced)
- Use themable selects instead of regular ones
1. http://schemaform.io/
Co-Authored-By: Tyr Johanson <tyr@hpe.com>
Implements: blueprint angular-schema-form
Change-Id: Ib22b2d0db2c4d4775fdef62a180cc994e8ae6280
Per CTI direction (see bug filing), this patch moves the JS Karma test coverage
reports to ./cover/ so they may be collected in the gate for archiving.
The two runs each have their own directory so they don't overlap/conflict.
Change-Id: I0b1536c115a516f4b6ab80b5ebab5337b308c210
Closes-Bug: 1588389
PhantomJS has setup issues and is slowing down the gate with false
failures. We should change to Chrome until Phantom is more
reliable, at which point this patch can be reverted.
Change-Id: I4bf1c1e8e26ac708bd35145aff98562f30b3a050
Closes-Bug: 1568325
This patch updates the JS unit test coverage threshold. As we've added
code we've increased the coverage. To keep new code well-covered, we
should increase the threshold so new code doesn't decrease the overall
coverage. The rule of thumb is to keep it at the highest whole percentage
point that greater than .5% of a difference from the current coverage.
Change-Id: I89e18841b4e9ba4a2cbd49ee222d3234e9d26c88
Write unit tests for the directive to increase test coverage
Split file read into a separate service for easier testing.
Co-Authored-By: Matt Borland <matt.borland@hpe.com>
Co-Authored-By: Shaoquan Chen <sean.chen2@hp.com>
Co-Authored-By: Rajat Vig<rajatv@thoughtworks.com>
Change-Id: Ie886c374b19d24351766bb48023ddfb7426b7a06
Partial-Bug: #1506891
As people have been raising the unit test coverage, we should make sure
we're raising the thresholds as well. This keeps the new code from
being lax in coverage.
The metric used here was to set whole number percentage points that were
more than one-half of a percentage point below the actual coverage.
Change-Id: I348d4b8cafcf6c7d0dc8e770b66609984e89c20b
Partial-Bug: 1506891
This patch adds ngroute libraries to appropriate paths and creates an
ng_route_base block in the Django base so templates can insert routing
blocks, such as establishing a base path.
Implements: blueprint add-ngroute
Change-Id: I11dd3890d336f288e93bf884197e3f22dcd1da93
This patch updates the file names of the coverage reports so they are
visible by default on most systems. Also updates the .gitignore, so the
new files are not pushed to the Horizon repo.
DocImpact
Closes-Bug: 1508526
Change-Id: I3c1c8f4c88819e2f49b60722ea8cc37bdc711b8c
Adding JS tests where appropriate to raise coverage.
Added a little safety into the original code.
Closes-Bug: 1506942
Change-Id: I57cbc0250d30e2fc3eb27863858f60f96dea1171
Changes the basepath and other paths to allow for correct specification
of template dirs, etc.
Change-Id: I6a5d155382dd2ff942d7738e67296a09d85b354b
Closes-Bug: 1507703
This patch is testing untested branches.
There is a bug in the Launch Instance model where it is supposed to
remove null properties from the top level of the model. It is not doing
that properly. So that bug is also fixed.
This patch currently raises the branch coverage in openstack_dashboard
from ~84% to ~89%.
Closes-bug: 1506891
Change-Id: I7434126246b15209b62daeff75744e0a3b435494
Controllers image-form and hz-namespace-resource-type-form
do not have any tests.
This patch simply adds unit tests.
Change-Id: I537b7bdf6b778c333f84491891afeb8dbc45eb53
Closes-Bug: #1501513
Code coverage metrics in Horizon for openstack_dashboard do not include
metrics from JS files in openstack_dashboard/**/static.
Change-Id: I24c5914e723e20ed4406635dfdeb8579c8e57840
Closes-Bug: #1498788
This patch adds unit test coverage threshold reporting, adding
statement, branch, function, and line coverage to the console
output in infra, and failing the build if the threshold has not
been met.
The threshold values have been set to the current observed
coverage values - future patches should update this up as
coverage improves.
Closes-Bug: 1487109
Change-Id: Ie83ebf5d976b3538e3528787b05de3e83df18af8
The xstatic files in dashboard/karma.conf is missing the smart-table
reference causing tests that rely on smart-table to fail. This patch fixes this.
Change-Id: I60ca60819f3a6ad525615dfdd6f6e6428c62d728
Closes-Bug: #1485746
The makemessages side of translation is now angular compatible via babel.
Now we need the directives and filters that angular-gettext provides.
This patch also configures angular-gettext to use the django catalog.
Partially-Implements: blueprint angular-translate-makemessages
Change-Id: Ib180953d7bd77170092293247543398d964e7305
Depends-On: Ica8d73752093f2e5d30f70fc37ba87610f6823b1
We currently have two Karma files: one for horizon and one for
dashboard. Because dashboard code relies horizon, the karma conf in
dashboard should include the needed files from framework.
Change-Id: I06f2ebe1da845f559a6562156e8ad9e6a7ffb128
Closes-Bug: #1473176
This patch extends karma's config to cover code in
/openstack_dashboard/dashboards/
where plugins should reside.
Co-Authored-By: Tyr Johanson <tyr@hp.com>
Change-Id: I82d7463f64b26bb36c2182488e20d41f1b2d87dd
Partially-Implements: blueprint angularize-instances-table
This patch breaks up launc-instance.js into small pieces according to
Horizon code style.
Change-Id: I852943a5223289391b1b8a315be80a48dcd39fb6
Partially-Implements: blueprint jscs-cleanup
This patch breaks up workflow.js into small pieces according to
Horizon code style.
Change-Id: I2358020f29de4a235dd35553621b007da70d47fa
Partially-Implements: blueprint jscs-cleanup
karma.config.js files are wirtten in node.js and therefore should
be compliant to the JavaScript code style applyed in Horizon. Also
some formatting inconsistency should be fixed.
Change-Id: I98978ddb271af9dc3cf18c73d2bd83948d723de7
Partially-Implements: blueprint jscs-cleanup
This cleans up the karma configuration to use auto-discovery
in place of explicitly listing files.
Change-Id: I7b05f7d6921af3a577270638a02717d04e7b20cd
Closes-Bug: #1467684
Move the angular app module from the framework to
openstack_dashboard at the top level as "horizon.app".
This edit also removes the old hzUtils.log function: it
exists in the framework, but is configured in the application,
thus causing dependency issues. It is only used in one place
(hz.tables.js), and for debugging. I contend that if debugging
is needed then $log can be asked for as needed.
The hzConfig.debug flag was only used by that one function,
so it is also removed in this edit.
Change-Id: Ie538940cd8d1b0eabe677790bad979cc146bfbd1
Closes-Bug: #1458697
Closes-Bug: #1465885
This commit moves the Angular-based API services to the
openstack_dashboard directory.
It also simplifies the naming scheme for the Angular-based
API modules.
Fixes all JSCS issues in files that were modified by this patch.
This is one step in a larger effort to restructure the Angular
source. See https://review.openstack.org/#/c/176152/ for the
full set of planned changes.
Change-Id: I4200336508761fb0155be422ebcecd4bf2907035
Closes-Bug: #1446886
This change moves the controller ImageFormCtrl and
hzNamespaceResourceTypeFormController from horizon (the framework)
to openstack_dashboard (the application) where they belong.
Co-Authored-By: Tyr Johanson <tyr@hp.com>
Change-Id: I2309f0867c2f657a6065003475dcb10448f907bc
Partial-Bug: #1458697
This patch adds several fixes to improve karma test handling.
* A postinstall hook was added to package.json, which tests for
the existence of .venv. If it is not found, it will invoke
tox -e py27 --notest.
* Both karma.conf files were taught to automatically detect the
directories in which the xstatic dependencies might live, and
pick the appropriate directory.
postinstall was chosen, because setting up a virtual environment
is likely to be useful for more than one type of npm job.
Change-Id: I822cb020bd8b2ca8d4f994b9734af5636e4bd144
Establish features for running Karma tests. Separate karma configurations
are used due to current overlap of template file structure.
You can run the karma tests via:
./run_tests.sh --karma
The Karma framework allows for many features like unit test coverage and
provides a common configuration for different test runners.
Change-Id: I79680ef6369383c148da68e6677945886a48df81
Implements: blueprint karma