Make sure to follow the steps outlined in the rest of this file before using these commands.
| Description | Command | Note |
|---|---|---|
| Start the local replica | make start | |
| Start the frontend server | npm start | |
| Build the canister | make build | |
| Build the frontend | npm run build | |
| Production frontend | make fe | |
| Production frontend local network | NODE_ENV=production DFX_NETWORK=local make fe | |
| Deploy the canister locally | make local_deploy | |
| Build the canister locally | make dev_build | |
| Set up and run e2e tests | make e2e_test | If you're using Ubuntu, it must be an LTS version. |
| Run e2e tests | npm run test:e2e | Assumes e2e setup is already done (see make e2e_test) |
- Install NodeJS.
- Install Rust & Cargo.
- Install ic-wasm.
- Install Docker.
- Install Git.
Clone the Taggr repo:
git clone https://seed.radicle.garden/z4TNAuSLgfxXUr8sYpYowk6mcx33B.git taggrChange your directory to the newly cloned Taggr repo:
cd taggrInstall DFX
DFX_VERSION=$(cat dfx.json | jq -r .dfx) sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"The remaining steps are only necessary for deploying the local ICP ledger canister. This makes it easier to test new account creation with Internet Identity, to make ICP transfers to those accounts or to run Taggr e2e tests without a Docker container. Alternatively, you can create a backup and then refer to the command reference to build and deploy.
Stop DFX if it's running:
dfx stopStart DFX with a clean environment:
dfx start --clean --backgroundInstall Taggr canister:
npm ci
make local_deploy
make dev_build
make local_reinstallUse make cycles to fabricate cycles for the canister.
Install the ICP ledger canister at its mainnet ID locally (the backend
hard-codes MAINNET_LEDGER_CANISTER_ID, so the ledger has to answer at
ryjl3-tyaaa-aaaaa-aaaba-cai):
./e2e/import_local_minter.sh
./e2e/install_icp_ledger.shNow you are ready to create a new Taggr account with Internet Identity locally. If you also want to make ICP transfers to this account then continue with the remaining steps, the remaining steps are not necessary for running e2e tests.
Set up the private key for the local minting account:
cat <<EOF >~/.config/dfx/local-minter.pem
-----BEGIN EC PRIVATE KEY-----
MHQCAQEEICJxApEbuZznKFpV+VKACRK30i6+7u5Z13/DOl18cIC+oAcGBSuBBAAK
oUQDQgAEPas6Iag4TUx+Uop+3NhE6s3FlayFtbwdhRVjvOar0kPTfE/N8N6btRnd
74ly5xXEBNSXiENyxhEuzOZrIWMCNQ==
-----END EC PRIVATE KEY-----
EOFImport the key into DFX:
dfx identity import local-minter --disable-encryption ~/.config/dfx/local-minter.pemChange to the new identity in DFX:
dfx identity use local-minterAt this point, you can refer to the command reference to deploy and run Taggr, create a new account and grab your account ID. Then you can transfer ICP to that account with this command:
dfx ledger transfer --memo 1000 --amount 10 ${accountId}Make sure to follow the first time setup instructions before running e2e tests without using the Dockerfile.
Run the test UI, this is great for watching the tests run as they are happening and checking screenshots at each stage:
Make sure javascript is built for tests (production) as it avoids binary file size limits. Make sure to re-build if you make changes.
make e2e_buildRun tests:
npm run test:e2e -- --uiTo collect a static trace for tests:
npm run test:e2e -- --trace onTo help determine if tests are flaky, run them multiple times, note that only the file's name is required, not its full path. If the filename is omitted then all tests will be run multiple times:
npm run test:e2e -- ${test_filename}.spec.ts --trace on --repeat-each 10During development, it can be common to write an incorrect selector or something else that will cause the test to timeout. If it's happening frequently and slowing down the feedback cycle then the max timeout can be set to a lower value. Be careful not to set it too low or you may get false negatives in the tests:
npm run test:e2e -- --timeout 10000