holochain / tryorama

Toolset to manage Holochain conductors and facilitate test scenarios
212 stars 13 forks source link

Error when calling `appWs.callZome({ role_name: '', ... })` #203

Closed guillemcordoba closed 6 months ago

guillemcordoba commented 6 months ago

Latest PR https://github.com/holochain/tryorama/pull/201/files removed the ability to call appWs.callZome({ role_name, ... }), using role name instead of cell id to identify the cell. This is the technique I use in all my tryorama tests, which are actually also testing my real UI code, which calls the AppClient using the role_name.

This is the error I get:

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  src/profile.test.ts > create Profile
TypeError: Cannot read properties of undefined (reading '0')
 ❯ getSigningCredentials ../node_modules/@holochain/client/lib/api/zome-call-signing.js:13:48
 ❯ AppWebsocket.appWs.callZome ../node_modules/@holochain/tryorama/lib/local/conductor.js:250:12
 ❯ ProfilesClient.callZome ../node_modules/@holochain-open-dev/utils/src/zome-client.ts:32:24
 ❯ ProfilesClient.getAgentsWithProfile ../ui/src/profiles-client.ts:53:17
     51|    */
     52|   async getAgentsWithProfile(): Promise<Link[]> {
     53|     return this.callZome("get_agents_with_profile", null);
       |                 ^
     54|   }
     55|
 ❯ ../ui/src/profiles-store.ts:39:25
 ❯ fetch ../node_modules/@holochain-open-dev/signals/src/holochain.ts:92:11
 ❯ e.[watched] ../node_modules/@holochain-open-dev/signals/src/holochain.ts:106:9
 ❯ K ../node_modules/signal-polyfill/dist/index.js:136:34
 ❯ K ../node_modules/signal-polyfill/dist/index.js:138:34
 ❯ L ../node_modules/signal-polyfill/dist/index.js:79:88

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

 Test Files  1 failed (1)
      Tests  1 failed (1)
   Start at  19:17:54
   Duration  18.04s (transform 628ms, setup 0ms, collect 2.38s, tests 14.74s, environment 1ms, prepare 354ms)

npm ERR! Lifecycle script `test` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: tests
npm ERR!   at location: /home/guillem/projects/holochain/open-dev/profiles/tests

It's because in this line, there is no cell_id in the request. I think it's because of the removal of this function.

Another issue is that I don't see anywhere in the tests for tryorama that callZome is tested using the role name instead of the cell_id.

ThetaSinner commented 6 months ago

@guillemcordoba The linked PR should resolve the issue and adds a test so that it shouldn't be accidentally lost again

ThetaSinner commented 6 months ago

Released as dev.6 - > https://github.com/holochain/tryorama/releases/tag/v0.16.0-dev.6