Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 2.34 KB

File metadata and controls

43 lines (32 loc) · 2.34 KB

@itwin/object-storage-tests-frontend

Copyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice.

About this package

This package contains a framework for testing different FrontendStorage implementations in browser environment.

Workflow

Test launch workflow:

  1. Generate a script that will be loaded by integration tests to create an instance of storage class under test.
    1. Define a script that sets the window.frontendStorage property to an instance of frontend storage implementation.
    2. Transpile the script from TS to JS.
    3. Bundle the script using webpack to include all of its dependencies.
  2. Start a web server that will be used by the tests to get object access information.
    1. Construct an instance of ServerStorageProxyBackend and bind an implementation of ServerStorage to its container.
    2. Start the configured server by calling BackendStorageServer.start on the constructed instance.
  3. Construct an instance of FrontendStorageIntegrationTests and pass the path of the bundled script as a constructor argument.
  4. Start the tests by calling FrontendStorageIntegrationTests.start on the test class instance which:
    1. Copies the bundled storage setting script into a location that cypress can access.
    2. Launches cypress with a specific configuration.

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.

TS compiler configuration files

.
|-- cypress
|   |-- tsconfig.json (1)
|-- tools.tsconfig.json (2)
|-- tsconfig.json (3)
  1. tsconfig.json in cypress directory is used by cypress framework to transpile test and test helper files when running tests.
  2. tools.tsconfig.json is used to transpile test running utilities that are imported by other CommonJS modules (storage packages).
  3. tsconfig.json in root directory is only used to reference typings so that VS Code would not highlight the code as incorrect.

Useful links: