-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't require pkcs key format; simplify key loading and add docs
- Loading branch information
1 parent
9134d36
commit 97c4b29
Showing
5 changed files
with
62 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Contribution Guide | ||
|
||
## End-to-end Tests | ||
|
||
### How to run | ||
|
||
To run end-to-end tests with chromium, run `pnpm test:e2e` in terminal. | ||
|
||
**Before you begin**, you need to setup some environment variables/secrets in `tests/.env`. | ||
|
||
1. Copy `tests/.env.example` to `tests/.env` | ||
2. Update `tests/.env` with your secrets. | ||
|
||
| Environment Variable | Description | Is secret? | | ||
| ---------------------------- | ----------------------------------------------------------- | ---------- | | ||
| `WALLET_URL_ORIGIN` | URL of the wallet (e.g. https://rafiki.money) | No | | ||
| `WALLET_USERNAME` | Login email for the wallet | No | | ||
| `WALLET_PASSWORD` | Login password for the wallet | Yes | | ||
| `CONNECT_WALLET_ADDRESS_URL` | Your wallet address that will be connected to extension | No | | ||
| `CONNECT_KEY_ID` | ID of the key that will be connected to extension (UUID v4) | No | | ||
| `CONNECT_PRIVATE_KEY` | Private key (hex-encoded Ed25519 private key) | Yes | | ||
| `CONNECT_PUBLIC_KEY` | Public key (base64-encoded Ed25519 public key) | No | | ||
|
||
To get the `CONNECT_KEY_ID`, `CONNECT_PRIVATE_KEY` and `CONNECT_PUBLIC_KEY`: | ||
|
||
1. Load the extension in browser (via `chrome://extensions/`) | ||
- Once the extension is loaded, it'll generate a key-pair that we will need to connect with our wallet. | ||
1. Inspect service worker with "Inspect views service worker" | ||
1. Run following in devtools console to copy keys to your clipboard, and paste it in `tests/.env`: | ||
```js | ||
// 1. Gets generated keys from extension storage. | ||
// 2. Converts result to `CONNECT_{X}="VAL"` format for use in .env file. | ||
// 3. Copies result to clipboard. | ||
copy( | ||
Object.entries( | ||
await chrome.storage.local.get(['privateKey', 'publicKey', 'keyId']), | ||
) | ||
.map( | ||
([k, v]) => | ||
`CONNECT_${k.replace(/([A-Z])/g, '_$1').toUpperCase()}="${v}"`, | ||
) | ||
.join('\n'), | ||
); | ||
``` | ||
|
||
Then copy `CONNECT_PUBLIC_KEY` key to https://rafiki.money/settings/developer-keys under your wallet address. | ||
|
||
Now you're ready to run the tests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters