Skip to content

Commit

Permalink
chore: updating pnpm filters and documentation for dummy apps
Browse files Browse the repository at this point in the history
  • Loading branch information
ggilchrist-ledger committed Jul 11, 2023
1 parent e504ba2 commit a8be4ca
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/test-mobile-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ jobs:
pnpm build:llm:deps
- name: Build Dummy Live SDK and Dummy Wallet API apps for testing
run: |
pnpm --filter="test-utils" i
pnpm --filter="test-utils" build
pnpm --filter="test-utils" install-deps:dummy-apps
pnpm --filter="test-utils" build:dummy-apps
pnpm test-utils dummy-apps:install
pnpm test-utils dummy-apps:build
shell: bash
- name: Create iOS simulator
id: simulator
Expand Down
7 changes: 3 additions & 4 deletions libs/test-utils/dummy-live-app/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Ledger Live Dummy Platform App

The purpose of this app is to allow automated front end testing of Ledger Live Platform apps, and verify that Ledger Live correctly:

- handles the rendering of external Live Apps
- handles calls of the Live SDK from external Live apps

The app is a simple [Create React App](https://github.com/facebook/create-react-app) which uses the [Ledger Live App SDK](https://www.npmjs.com/package/@ledgerhq/live-app-sdk). It has some buttons that have hardcoded responses that can be triggered from the playwright tests, thus allowing us to check the UI. This means the app isn't suitable for manual testing or full E2E testing since it is not dynamic, and does not make calls to external services or the Nano itself.

## How to run locally for development

Run `pnpm --filter="dummy-live-app" start`.
Run `pnpm test-utils:dummy-live-app i` and `pnpm test-utils:dummy-live-app start`

## Quick script to build the app from scratch

To use the Dummy app in the Playwright tests, you must install and build the dependencies and source code for the dummy app. To do this run the following from the root folder of this monorepo:

`pnpm clean && pnpm --filter="dummy-live-app" i && pnpm --filter="dummy-live-app" build`

Then run `pnpm --filter="dummy-live-app" serve`
`pnpm test-utils:dummy-live-app i` and `pnpm test-utils:dummy-live-app build`. You can then run the apps with `npx http-server` in the same folder as the apps. Alternatively this app is started automatically in the playwright tests.
2 changes: 1 addition & 1 deletion libs/test-utils/dummy-ptx-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ The purpose of this app is to allow automated front end testing of Ledger Live P

## How to run locally for development

Run `npx http-serve` in the same folder as the dummy-ptx-app
Run `pnpm test-utils dummy-apps:start-ptx-app` in the same folder as the dummy-ptx-app
4 changes: 2 additions & 2 deletions libs/test-utils/dummy-wallet-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The app is a simple [Create React App](https://github.com/facebook/create-react-

```sh
pnpm i
pnpm --filter="dummy-wallet-app" start # Start development server
pnpm test-utils:dummy-wallet-app start # Start development server
```

## Serve production build
Expand All @@ -20,7 +20,7 @@ pnpm --filter="dummy-wallet-app" start # Start development server
### Setup

pnpm i
pnpm --filter="dummy-wallet-app" build
pnpm test-utils:dummy-wallet-app build

### Desktop
pnpm build:lld:deps
Expand Down
6 changes: 4 additions & 2 deletions libs/test-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@ledgerhq/test-utils",
"version": "0.0.1",
"private": true,
"description": "Dummy apps and utils for tests",
"keywords": [
"Ledger"
Expand All @@ -11,8 +12,9 @@
"scripts": {
"clean": "rimraf lib lib-es",
"build": "tsc && tsc -m ES6 --outDir lib-es",
"install-deps:dummy-apps": "pnpm --filter='dummy-wallet-app' --filter='dummy-live-app' i",
"build:dummy-apps": "pnpm --filter='dummy-wallet-app' --filter='dummy-live-app' build"
"dummy-apps:install": "pnpm --filter='dummy-*' i",
"dummy-apps:build": "pnpm --filter='dummy-*' build",
"dummy-apps:start-ptx-app": "cd dummy-ptx-app && npx http-server"
},
"dependencies": {
"@ledgerhq/live-common": "workspace:^",
Expand Down
1 change: 0 additions & 1 deletion libs/test-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export const dummyAppServer: http.Server = http.createServer(
// You pass two more arguments for config and middleware
// More details here: https://github.com/vercel/serve-handler#options

console.log(path.resolve(__dirname, dummyAppPath));
handler(request, response, {
public: path.resolve(__dirname, "..", dummyAppPath),
});
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
"ljs:types-cryptoassets": "pnpm --filter types-cryptoassets",
"ljs:types-devices": "pnpm --filter types-devices",
"ljs:types-live": "pnpm --filter types-live",
"test-utils": "pnpm --filter test-utils",
"test-utils:dummy-live-app": "pnpm --filter dummy-live-app",
"test-utils:dummy-wallet-app": "pnpm --filter dummy-wallet-app",
"ui": "pnpm --filter ui",
"ui:react": "pnpm --filter react-ui",
"ui:native": "pnpm --filter native-ui",
Expand Down
2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
packages:
- "apps/*"
- "libs/test-utils/**"
- "libs/*"
- "libs/test-utils/**"
- "libs/ledgerjs/**"
- "libs/ui/packages/*"
- "libs/ledger-live-common/tools"
Expand Down
7 changes: 3 additions & 4 deletions tools/actions/composites/setup-test-desktop/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ runs:
- name: Install dependencies
env:
LANG: en_US.UTF-8
run: pnpm i --filter="ledger-live-desktop..." --filter="ledger-live" --filter="test-utils" --unsafe-perm
run: pnpm i --filter="ledger-live-desktop..." --filter="ledger-live" --unsafe-perm
shell: bash
- name: Install playwright dependencies
if: ${{ inputs.install_playwright }}
Expand All @@ -77,7 +77,6 @@ runs:
- name: Build Dummy Live SDK and Dummy Wallet API apps for testing
if: ${{ !inputs.skip_builds }}
run: |
pnpm --filter="test-utils" build
pnpm --filter="test-utils" install-deps:dummy-apps
pnpm --filter="test-utils" build:dummy-apps
pnpm test-utils dummy-apps:install
pnpm test-utils dummy-apps:build
shell: bash

0 comments on commit a8be4ca

Please sign in to comment.