shlomiassaf / ngrid

A angular grid for the enterprise
https://shlomiassaf.github.io/ngrid
MIT License
241 stars 40 forks source link

[V3] Introduce testing heplers #133

Closed shlomiassaf closed 3 years ago

shlomiassaf commented 3 years ago

Currently there are no tests in nGrid, not Unit and not E2E.
We need both Unit Test & E2E support.

Since nGrid is a 3rd party component it should also provide a small utility framework to support testing nGrid in applications.

Steps:

Unit Tests

Integration should be simple, using nx schematics. We chose Karma because we need a real DOM to test layout related feature, scrolling behaviour (virtual scroll) and other features missing in JSDOM hence making Jest impractical for testing nGrid.

The harnesses should support all unit test frameworks/runners out of the box due to the unique abstraction offered by the component harness eco-system.

In addition, multi environment support is also offered out of the box so protractor should work for E2E testing as well. An exception about E2E might be some custom behaviours in the harness might require working with DOM elements, which will require special support when used in protractor.

Using Karma will not remove support from Jest, testers will still be able to use the harnesses with Jest although with some testing features unavilable.

E2E Tests

Integration should be simple, using nx schematics.
We chose Cypress because protractor is already supported through the unit tests and personally I think it's an excellent framework.

The harnesses in this case will be limited for Cypress use only and will not share logic with other implementations. Cypress has a unique flow and it runs different than other frameworks so we will need to build it from scratch.

We will not be able to use the test harness infrastructure provided by the angular CDK not we will be able to build a TestEnvironment for it. (see this issue)

shlomiassaf commented 3 years ago

Done, helpers are lightweight and will get more sugar as we add tests to the repo