Skip to content

Commit

Permalink
ELEMENTS-1153: create testing helpers package
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuno Cunha committed Apr 6, 2020
1 parent 56e5dea commit 0a8d728
Show file tree
Hide file tree
Showing 56 changed files with 249 additions and 239 deletions.
5 changes: 2 additions & 3 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
"nuxeo": "^3.2.1"
},
"devDependencies": {
"@open-wc/testing-helpers": "^0.8.3",
"@nuxeo/testing-helpers": "3.0.0-SNAPSHOT",
"@polymer/iron-component-page": "^4.0.0",
"polymer-cli": "^1.8.0",
"sinon": "^7.3.1"
"polymer-cli": "^1.8.0"
},
"main": "nuxeo-elements.js"
}
2 changes: 1 addition & 1 deletion core/test/nuxeo-connection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.
*/
import { fixture, html } from './test-helpers';
import { fixture, html } from '@nuxeo/testing-helpers';
import '../nuxeo-connection.js';

const responseHeaders = {
Expand Down
2 changes: 1 addition & 1 deletion core/test/nuxeo-document.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.
*/
import { waitChanged, fixture, html } from './test-helpers';
import { waitChanged, fixture, html } from '@nuxeo/testing-helpers';
import '../nuxeo-document.js';

/* eslint-disable no-unused-expressions */
Expand Down
2 changes: 1 addition & 1 deletion core/test/nuxeo-operation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.
*/
import { fixture, html, waitChanged } from './test-helpers';
import { fixture, html, waitChanged } from '@nuxeo/testing-helpers';
import '../nuxeo-operation.js';
import '../nuxeo-page-provider.js';

Expand Down
2 changes: 1 addition & 1 deletion core/test/nuxeo-page-provider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.
*/
import { fixture, html } from './test-helpers';
import { fixture, html } from '@nuxeo/testing-helpers';
import '../nuxeo-page-provider.js';

/* eslint-disable no-unused-expressions */
Expand Down
2 changes: 1 addition & 1 deletion core/test/nuxeo-resource.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.
*/
import { fixture, html } from './test-helpers';
import { fixture, html } from '@nuxeo/testing-helpers';
import '../nuxeo-resource.js';

/* eslint-disable no-unused-expressions */
Expand Down
3 changes: 1 addition & 2 deletions core/test/nuxeo-task-page-provider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import '../nuxeo-task-page-provider.js';
import fakeServer from './nuxeo-mock-client';
import { fixture, html, waitForEvent } from './test-helpers';
import { fakeServer, fixture, html, waitForEvent } from '@nuxeo/testing-helpers';

/* eslint-disable no-unused-expressions */
suite('nuxeo-task-page-provider', () => {
Expand Down
44 changes: 0 additions & 44 deletions core/wct.conf.json

This file was deleted.

2 changes: 1 addition & 1 deletion dataviz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"serve": "polymer serve --npm -c ../node_modules"
},
"devDependencies": {
"moment": "^2.10.6",
"polymer-cli": "^1.8.0",
"@nuxeo/testing-helpers": "3.0.0-SNAPSHOT",
"@polymer/iron-component-page": "^4.0.0",
"@polymer/test-fixture": "^4.0.2",
"@webcomponents/webcomponentsjs": "^2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion dataviz/test/nuxeo-audit-data.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.
*/
import { fixture, html, login } from '@nuxeo/nuxeo-elements/test/test-helpers.js';
import { fixture, html, login } from '@nuxeo/testing-helpers';
import moment from '@nuxeo/moment';
import '../nuxeo-audit-data.js';

Expand Down
2 changes: 1 addition & 1 deletion dataviz/test/nuxeo-repository-data.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.
*/
import { fixture, html, login } from '@nuxeo/nuxeo-elements/test/test-helpers.js';
import { fixture, html, login } from '@nuxeo/testing-helpers';
import moment from '@nuxeo/moment';
import '../nuxeo-repository-data.js';

Expand Down
2 changes: 1 addition & 1 deletion dataviz/test/nuxeo-search-data.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.
*/
import { fixture, html, login } from '@nuxeo/nuxeo-elements/test/test-helpers.js';
import { fixture, html, login } from '@nuxeo/testing-helpers';
import moment from '@nuxeo/moment';
import '../nuxeo-search-data.js';

Expand Down
2 changes: 1 addition & 1 deletion dataviz/test/nuxeo-workflow-data.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.
*/
import { fixture, html, login } from '@nuxeo/nuxeo-elements/test/test-helpers.js';
import { fixture, html, login } from '@nuxeo/testing-helpers';
import moment from '@nuxeo/moment';
import '../nuxeo-workflow-data.js';

Expand Down
48 changes: 0 additions & 48 deletions dataviz/wct.conf.json

This file was deleted.

7 changes: 0 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"karma-static": "^1.0.1",
"lerna": "^3.13.1",
"lint-staged": "^8.0.0",
"lit-html": "^1.0.0",
"mocha": "^6.0.2",
"npm-run-all": "^4.1.5",
"polymer-cli": "^1.8.0",
Expand All @@ -78,7 +77,6 @@
"dependencies": {
"@nuxeo/moment": "^2.24.0",
"@nuxeo/paper-typeahead": "^0.6.0-SNAPSHOT",
"@open-wc/testing-helpers": "^0.8.3",
"@polymer/iron-autogrow-textarea": "^3.0.1",
"@polymer/iron-collapse": "^3.0.0",
"@polymer/iron-flex-layout": "^3.0.0",
Expand All @@ -96,7 +94,6 @@
"@polymer/iron-resizable-behavior": "^3.0.1",
"@polymer/iron-scroll-threshold": "^3.0.0",
"@polymer/iron-selector": "^3.0.1",
"@polymer/iron-test-helpers": "^3.0.0",
"@polymer/iron-validatable-behavior": "^3.0.1",
"@polymer/marked-element": "^3.0.1",
"@polymer/neon-animation": "^3.0.1",
Expand All @@ -123,10 +120,6 @@
"@polymer/polymer": "^3.0.0",
"@polymer/test-fixture": "^4.0.2",
"@vaadin/vaadin-date-picker": "^3.0.0",
"cropperjs": "1.0.0",
"d3-hierarchy": "^1.1.5",
"d3-selection": "^1.3.0",
"d3-shape": "^1.2.0",
"nuxeo": "^3.2.1"
}
}
2 changes: 1 addition & 1 deletion storybook/.storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fakeServer from '@nuxeo/nuxeo-elements/test/nuxeo-mock-client';
import { fakeServer } from '@nuxeo/testing-helpers';
import { configure, addDecorator, addParameters, setAddon } from '@storybook/polymer';
import { withActions } from '@storybook/addon-actions';
import { withKnobs } from '@storybook/addon-knobs';
Expand Down
4 changes: 2 additions & 2 deletions storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
"dependencies": {
"@babel/core": "^7.3.4",
"@nuxeo/nuxeo-elements": "3.0.0-SNAPSHOT",
"@nuxeo/testing-helpers": "3.0.0-SNAPSHOT",
"@nuxeo/nuxeo-ui-elements": "3.0.0-SNAPSHOT",
"@polymer/iron-icon": "^3.0.1",
"@polymer/iron-icon": "^3.0.0",
"@polymer/iron-meta": "^3.0.1",
"@polymer/polymer": "^3.0.0",
"@storybook/addon-actions": "^5.1.11",
Expand All @@ -30,7 +31,6 @@
"lit-html": "^1.0.0",
"nuxeo": "^3.2.1",
"polymer-webpack-loader": "^2.0.3",
"sinon": "^7.2.7",
"uuid": "^3.3.2"
},
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions testing-helpers/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
analysis.json
coverage
2 changes: 2 additions & 0 deletions testing-helpers/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/**/\.*
/test/**/*.html
14 changes: 14 additions & 0 deletions testing-helpers/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@license
(C) Copyright Nuxeo Corp. (http://nuxeo.com/)

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.
23 changes: 23 additions & 0 deletions testing-helpers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# About testing-helpers

**Nuxeo Testing Helpers** is a library of helpers to be used when implementing unit tests on Nuxeo custom elements.

## Installation

This module should be installed as one of your project's `devDependencies`:

`npm install --save-dev @nuxeo/testing-helpers`

In very specific contexts it could also be considered as part of `dependencies` if a mock of [Nuxeo Client](https://www.npmjs.com/package/nuxeo) is needed.
A possible use case would be for demo purposes (see [Nuxeo Elements Storybook](https://nuxeo.github.io/nuxeo-elements)).

## License

[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt)

(C) Copyright Nuxeo Corp. [http://nuxeo.com/](http://nuxeo.com/)

All images, icons, fonts, and videos contained in this folder are copyrighted by Nuxeo, all rights reserved.

## About Nuxeo
Nuxeo dramatically improves how content-based applications are built, managed and deployed, making customers more agile, innovative and successful. Nuxeo provides a next generation, enterprise ready platform for building traditional and cutting-edge content oriented applications. Combining a powerful application development environment with SaaS-based tools and a modular architecture, the Nuxeo Platform and Products provide clear business value to some of the most recognizable brands including Verizon, Electronic Arts, Sharp, FICO, the U.S. Navy, and Boeing. Nuxeo is headquartered in New York and Paris. More information is available at [www.nuxeo.com](http://www.nuxeo.com).
29 changes: 29 additions & 0 deletions testing-helpers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
@license
(C) Copyright Nuxeo Corp. (http://nuxeo.com/)
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.
*/
export { fixture, fixtureCleanup, html } from '@open-wc/testing-helpers';
export { focus, pressAndReleaseKeyOn, tap } from '@polymer/iron-test-helpers/mock-interactions';
export { default as fakeServer } from './nuxeo-mock-client.js';
export {
flush,
isElementVisible,
login,
timePasses,
waitChanged,
waitForAttrMutation,
waitForChildListMutation,
waitForEvent,
} from './test-helpers.js';
Loading

0 comments on commit 0a8d728

Please sign in to comment.