Simulator
To view and test your component, run the command:
npx cdk simulate my-component
This will open the simulator app in a browser and build your component in watch mode, meaning that any changes to the component source files will trigger a rebuild and automatically reload the simulator.
By default, the simulator provides your component with a device with mocked historical data and can only use a locally running Cloud Function. To access platform resources you have access to, such as historical data, agents and production Cloud Functions, you can log in with the command:
npx cdk login
If your component has different behaviour for different user permissions, it is possible to simulate a user with different permissions to your own.
Testing with a Cloud Function
Settings (Cogwheel) > Component > Cloud Function
- None:
- The BackendComponentClient will reject all calls;
- The ObjectStorageClient will accept all calls;
- All storage operations will be in Simulator memory on the developer's computer.
- Local Cloud Function Ingress:
- The BackendComponentClient will call the locally running ingress;
- The ObjectStorageClient will try to authorize all calls with the locally running ingress;
- All storage operations will be in Simulator memory on the developer's computer.
- Production Cloud Function:
- The BackendComponentClient will call the Cloud Function running in IXON Cloud
- The ObjectStorageClient will authorize all calls with the Cloud Function running in IXON Cloud;
- All storage operations will be with the IXON Cloud.
Using mock data or platform data
Settings (Cogwheel) > API > General > API
- Use mock data: The simulator generates fake data for the LoggingDataClient and ResourceDataClient.
- Use platform data: The simulator calls the platform API for the LoggingDataClient and ResourceDataClient.
Testing with different permissions
Settings (Cogwheel) >API > Permissions
- Standard permissions: When using mock data, no permissions are given. If platform data is used, the user's actual permissions are given.
- Use fixed permissions: The selected permissions are given. This can only be used with mock data.
Updated 8 months ago