Testing is boring when you see messages like asdasdassdas
, kemdlwemkd
, gegsfgsdfsd
on the chat screen.
This internal tool for Stream will generate a nice set of data (which is pleasant for eye of dev and tester), which contain reactions, attachments, enriched urls replies etc etc. Feel free to add comments in issues sections for improvement :)
# Clone the repo
git clone git@github.com:GetStream/stream-chat-test-data-cli.git
# Go to directory
cd stream-chat-test-data-cli
# Install the dependencies and link the repo
yarn; yarn link;
# Install stream chat
yarn add stream-chat
# Create a copy of your config.
cp config.js.template dev.config.js
NOTE For SDK Teams
You can use the template file for corresponding team e.g., flutter.config.js.template contains appUsers from Flutter team.
cp flutter.config.js.template dev.config.js
NOTE: dev.config.js
gets used by default in all commands. Each SDK team will maintain their own config file for their dev app, on their local environment.
apiKey
and secret
in dev.config.js
. Please check other parameters as well.Most basic command that you will use is create-channels
. It serves two purposes:
You may want to pay attention to few config params before running the command for first time
# By default command uses dev.config.js
create-channels
You can create multiple config files in root directory.
create-channels --config custom.config.js
Error: getaddrinfo ENOTFOUND chat-us-east-staging.stream-io-api.com
Comment out the baseUrl
in the config file
Docs for all the commands is available here - https://github.com/GetStream/stream-chat-test-data-cli/blob/master/doc.md
Following config options are available
https://github.com/GetStream/stream-chat-test-data-cli/blob/master/config.js.template
create-channels
)?This will only reset channels with channelIdPrefix
, mentioned in your config file.
Use reset-all-channels instead, if you want to reset all the channels.
reset-channels
customProperties
if you wantcreate-channels
reset-all-channels
add-messages --channelId "default-channel-0" --number 50
So basically you want to add bunch of messages to channel, but not from your current logged in user.
# 50 messages will be added from other members of channel, other than vishal
add-messages --channelId "default-channel-0" --number 50 --excludeUser "vishal"
# 30 new randomly generated users will be added as members.
create-channel-members --channelId "default-channel-0" --number 30
create-user --id "vishal" --name "Vishal Narkhede" --image "user"
create-app-users --number 10
There are bunch of more commands available, please check the next Command Docs part.
You can use bin/playground.js
for it.
playground
If you want to add a new command:
cp bin/playground.js bin/<command-name>.js
package.json
file,...
"bin": {
...
"<command-name>": "bin/<command-name>.js"
}
yarn unlink && yarn link
<command-name>
Go to bin/generate-docs.js
and add new command to executables
array.
And then
yarn build