Holochain Forum

Populating demo/test data before ui starts via "npm run start" command

I have created a test using tryorama and the orchestrator which creates agents Alice and Bob, and they exchange some test messages, and query for them.

The test runs fine with npm run test.

I would like to create a variant of the of npm run start command that populates the holochain with test messages from Alice and Bob before the UI starts.

My naive first idea was to run the test before the ui is launched.
But I believe that the test is run in an isolated environment (that would make sense of course…).

I’m sure there is a pattern for playing through a sequence of messages before an app starts, just not sure where to look.

for reference: here are npm commands I started with, and the the demo commands that I added:

    "start": "npm run build:happ && cross-env HC_PORT=$(port) concurrently -k \"npm run start:happ\" \"npm run start -w ui\"",
    "test": "npm run build:happ && npm t -w tests",
    "start:happ": "hc sandbox clean && RUST_LOG=warn hc s generate ./workdir/example-app.happ --run=$HC_PORT -a example-app network mdns",
    "demo": "npm run build:happ && cross-env HC_PORT=$(port) concurrently -k \"npm run start:happdemo\" \"npm run start -w ui\"",
    "start:happdemo": "hc sandbox clean && npm t -w tests && RUST_LOG=warn hc s generate ./workdir/rifff-explorer.happ --run=$HC_PORT -a example-app network mdns",
 

Even a tip would be appreciated. IE - should this be done with javascript/typescript or is there a place to hook into with rust.