Copyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice.
This package contains a framework for testing different FrontendStorage
implementations in browser environment.
Test launch workflow:
- Generate a script that will be loaded by integration tests to create an instance of storage class under test.
- Define a script that sets the
window.frontendStorage
property to an instance of frontend storage implementation. - Transpile the script from TS to JS.
- Bundle the script using
webpack
to include all of its dependencies.
- Define a script that sets the
- Start a web server that will be used by the tests to get object access information.
- Construct an instance of
ServerStorageProxyBackend
and bind an implementation ofServerStorage
to itscontainer
. - Start the configured server by calling
BackendStorageServer.start
on the constructed instance.
- Construct an instance of
- Construct an instance of
FrontendStorageIntegrationTests
and pass the path of the bundled script as a constructor argument. - Start the tests by calling
FrontendStorageIntegrationTests.start
on the test class instance which:- Copies the bundled storage setting script into a location that
cypress
can access. - Launches cypress with a specific configuration.
- Copies the bundled storage setting script into a location that
The tests communicate with the server launched on http://localhost:{SOME_PORT}
. The server supports several operations that create resources in cloud storage and return access information. After the test run POST /cleanup
request must be issued to delete all created resources.
.
|-- cypress
| |-- tsconfig.json (1)
|-- tools.tsconfig.json (2)
|-- tsconfig.json (3)
tsconfig.json
incypress
directory is used bycypress
framework to transpile test and test helper files when running tests.tools.tsconfig.json
is used to transpile test running utilities that are imported by other CommonJS modules (storage packages).tsconfig.json
in root directory is only used to reference typings so that VS Code would not highlight the code as incorrect.
- Cypress Node API: https://docs.cypress.io/guides/guides/module-api
- Cypress TS support: https://docs.cypress.io/guides/tooling/typescript-support