Skip to content

Commit 2f8919d

Browse files
authored
Merge branch 'develop' into chore/ddw-895-update-cardano-launcher
2 parents aa39f65 + 1cc884f commit 2f8919d

File tree

69 files changed

+2399
-474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2399
-474
lines changed

.eslintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@
109109
"no-useless-constructor": "off",
110110
"@typescript-eslint/no-useless-constructor": "error"
111111
}
112+
},
113+
{
114+
"files": "hardware-wallet-tests/**/*.ts",
115+
"rules": {
116+
"jest/no-standalone-expect": "off",
117+
}
112118
}
113119
]
114120
}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
!source/
66
!features/
77
!storybook/
8+
!hardware-wallet-tests/
89

910
# Now we ignore all files
1011
*.*

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Features
66

7+
- Implemented hover tooltips for menu ([PR 2938](https://github.com/input-output-hk/daedalus/pull/2938))
78
- Improved UI regarding the Hardware Wallet public key export error ([PR 2922](https://github.com/input-output-hk/daedalus/pull/2922))
89
- Added ASCII name to token header when metadata name is missing ([PR 2904](https://github.com/input-output-hk/daedalus/pull/2904))
910
- Improved IPC by reducing the amount of messages from periodic events ([PR 2892](https://github.com/input-output-hk/daedalus/pull/2892))
@@ -12,6 +13,10 @@
1213

1314
### Fixes
1415

16+
- Fixed dialogs being closed after receiving address shared ([PR 2965](https://github.com/input-output-hk/daedalus/pull/2965))
17+
- Fixed no progress shown on loading screen on Windows ([PR 2967](https://github.com/input-output-hk/daedalus/pull/2967))
18+
- Fixes hardware wallet issues on Windows ([PR 2900](https://github.com/input-output-hk/daedalus/pull/2900))
19+
- Fixed stake pool list styling ([PR 2920](https://github.com/input-output-hk/daedalus/pull/2920))
1520
- Fixed PopOver overlap ([PR 2954](https://github.com/input-output-hk/daedalus/pull/2954))
1621
- Fixed tooltip being hidden in several places ([PR-2934](https://github.com/input-output-hk/daedalus/pull/2934))
1722
- Adjusted padding for search field in stake pools ([PR 2945](https://github.com/input-output-hk/daedalus/pull/2945))
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import expect from 'expect';
2+
3+
import {
4+
createAndRegisterHardwareWalletChannels,
5+
createHardwareWalletConnectionChannel,
6+
initLedgerChannel,
7+
createTestInstructions,
8+
createCardanoAppChannel,
9+
createGetPublicKeyChannel,
10+
ipcRenderer,
11+
} from './utils';
12+
13+
export const run = () => {
14+
expect.assertions(3);
15+
16+
createTestInstructions([
17+
'Plug Ledger Nano S to your computer',
18+
'Launch Cardano APP on Nano S/Nano X',
19+
'Run the test again with Cardano App opened',
20+
'Export the public key',
21+
]);
22+
23+
createAndRegisterHardwareWalletChannels();
24+
25+
const cardanoAppChannel = createCardanoAppChannel();
26+
const publicKeyChannel = createGetPublicKeyChannel();
27+
const hardwareWalletConnectionChannel = createHardwareWalletConnectionChannel();
28+
29+
return new Promise<void>((resolve) => {
30+
hardwareWalletConnectionChannel.onReceive(
31+
async (params: { path: string }) => {
32+
expect(params).toEqual({
33+
disconnected: expect.any(Boolean),
34+
deviceType: expect.any(String),
35+
deviceId: null,
36+
deviceModel: expect.any(String),
37+
deviceName: expect.any(String),
38+
path: expect.any(String),
39+
product: expect.any(String),
40+
});
41+
42+
const cardanoAppChannelReply = await cardanoAppChannel.request(
43+
{ path: params.path },
44+
ipcRenderer,
45+
ipcRenderer
46+
);
47+
48+
expect(cardanoAppChannelReply).toEqual({
49+
minor: expect.any(Number),
50+
major: expect.any(Number),
51+
patch: expect.any(Number),
52+
deviceId: expect.any(String),
53+
});
54+
55+
const extendedPublicKey = await publicKeyChannel.request(
56+
{
57+
path: "1852'/1815'/0'",
58+
// Shelley 1852 ADA 1815 indicator for account '0'
59+
isTrezor: false,
60+
devicePath: params.path,
61+
},
62+
ipcRenderer,
63+
ipcRenderer
64+
);
65+
66+
expect(extendedPublicKey).toEqual({
67+
chainCodeHex: expect.any(String),
68+
publicKeyHex: expect.any(String),
69+
deviceId: expect.any(String),
70+
});
71+
72+
resolve();
73+
}
74+
);
75+
76+
initLedgerChannel();
77+
});
78+
};
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import expect from 'expect';
2+
3+
import {
4+
createAndRegisterHardwareWalletChannels,
5+
createHardwareWalletConnectionChannel,
6+
initLedgerChannel,
7+
createTestInstructions,
8+
createGetPublicKeyChannel,
9+
ipcRenderer,
10+
requestLaunchingCardanoAppOnLedger,
11+
} from './utils';
12+
13+
export const run = () => {
14+
expect.assertions(3);
15+
16+
createTestInstructions([
17+
'Start test runner',
18+
'Plug Ledger Nano S to your computer',
19+
'Start Cardano APP on Nano S',
20+
'Nano S will prompt to export the public key',
21+
'Export the public key',
22+
]);
23+
24+
createAndRegisterHardwareWalletChannels();
25+
26+
const publicKeyChannel = createGetPublicKeyChannel();
27+
const hardwareWalletConnectionChannel = createHardwareWalletConnectionChannel();
28+
29+
return new Promise<void>((resolve) => {
30+
hardwareWalletConnectionChannel.onReceive(
31+
async (params: { path: string }) => {
32+
expect(params).toEqual({
33+
disconnected: expect.any(Boolean),
34+
deviceType: expect.any(String),
35+
deviceId: null,
36+
deviceModel: expect.any(String),
37+
deviceName: expect.any(String),
38+
path: expect.any(String),
39+
product: expect.any(String),
40+
});
41+
42+
const cardanoAppChannelResponse = await requestLaunchingCardanoAppOnLedger(
43+
params.path
44+
);
45+
46+
expect(cardanoAppChannelResponse).toEqual({
47+
minor: expect.any(Number),
48+
major: expect.any(Number),
49+
patch: expect.any(Number),
50+
deviceId: expect.any(String),
51+
});
52+
53+
const extendedPublicKey = await publicKeyChannel.request(
54+
{
55+
path: "1852'/1815'/0'",
56+
// Shelley 1852 ADA 1815 indicator for account '0'
57+
isTrezor: false,
58+
devicePath: params.path,
59+
},
60+
ipcRenderer,
61+
ipcRenderer
62+
);
63+
64+
expect(extendedPublicKey).toEqual({
65+
chainCodeHex: expect.any(String),
66+
publicKeyHex: expect.any(String),
67+
deviceId: expect.any(String),
68+
});
69+
70+
resolve();
71+
}
72+
);
73+
74+
initLedgerChannel();
75+
});
76+
};
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import expect from 'expect';
2+
3+
import {
4+
createAndRegisterHardwareWalletChannels,
5+
createHardwareWalletConnectionChannel,
6+
createSequentialResult,
7+
initLedgerChannel,
8+
createTestInstructions,
9+
waitForZombieMessages,
10+
} from './utils';
11+
12+
export const run = () => {
13+
expect.assertions(2);
14+
15+
createAndRegisterHardwareWalletChannels();
16+
17+
const hardwareWalletConnectionChannel = createHardwareWalletConnectionChannel();
18+
19+
createTestInstructions([
20+
'Start test runner',
21+
'Plug Ledger Nano S to your computer',
22+
'Plug Ledger Nano X to your computer',
23+
]);
24+
25+
const getNextExpectedSequence = createSequentialResult([
26+
{
27+
disconnected: false,
28+
deviceModel: 'nanoS',
29+
},
30+
{
31+
disconnected: false,
32+
deviceModel: 'nanoX',
33+
},
34+
]);
35+
36+
return new Promise<void>((resolve) => {
37+
hardwareWalletConnectionChannel.onReceive(
38+
async (message: { path: string; deviceModel: string }) => {
39+
const [expectedValue, isOver] = getNextExpectedSequence();
40+
expect(message).toEqual(expectedValue);
41+
42+
if (isOver) {
43+
await waitForZombieMessages();
44+
resolve();
45+
}
46+
}
47+
);
48+
49+
initLedgerChannel();
50+
});
51+
};
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import expect from 'expect';
2+
3+
import {
4+
createAndRegisterHardwareWalletChannels,
5+
createHardwareWalletConnectionChannel,
6+
createSequentialResult,
7+
initLedgerChannel,
8+
createTestInstructions,
9+
waitForZombieMessages,
10+
} from './utils';
11+
12+
const getNextExpectedSequence = createSequentialResult([
13+
{
14+
disconnected: false,
15+
deviceModel: 'nanoS',
16+
},
17+
{
18+
disconnected: false,
19+
deviceModel: 'nanoX',
20+
},
21+
{
22+
disconnected: true,
23+
deviceModel: 'nanoS',
24+
},
25+
{
26+
disconnected: true,
27+
deviceModel: 'nanoX',
28+
},
29+
]);
30+
31+
export const run = () => {
32+
expect.assertions(4);
33+
34+
createAndRegisterHardwareWalletChannels();
35+
36+
const hardwareWalletConnectionChannel = createHardwareWalletConnectionChannel();
37+
38+
createTestInstructions([
39+
'Connect Nano S',
40+
'Connect Nano X',
41+
'Disconnect Nano S',
42+
'Disconnect Nano X',
43+
]);
44+
45+
return new Promise<void>((resolve) => {
46+
hardwareWalletConnectionChannel.onReceive(
47+
async (params: { path: string; deviceModel: string }) => {
48+
const [expectedValue, isOver] = getNextExpectedSequence();
49+
50+
expect(params).toEqual(expectedValue);
51+
52+
if (isOver) {
53+
await waitForZombieMessages();
54+
return resolve();
55+
}
56+
}
57+
);
58+
59+
initLedgerChannel();
60+
});
61+
};
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import expect from 'expect';
2+
3+
import {
4+
createAndRegisterHardwareWalletChannels,
5+
createHardwareWalletConnectionChannel,
6+
initLedgerChannel,
7+
createTestInstructions,
8+
createSequentialResult,
9+
waitForZombieMessages,
10+
} from './utils';
11+
12+
export const run = () => {
13+
expect.assertions(3);
14+
15+
createTestInstructions([
16+
'Plug Ledger Nano S to your computer',
17+
'Disconnect Nano S',
18+
]);
19+
20+
createAndRegisterHardwareWalletChannels();
21+
22+
const hardwareWalletConnectionChannel = createHardwareWalletConnectionChannel();
23+
24+
const getNextExpectedSequence = createSequentialResult([
25+
{
26+
disconnected: false,
27+
},
28+
{
29+
disconnected: true,
30+
},
31+
]);
32+
33+
return new Promise<void>((resolve) => {
34+
hardwareWalletConnectionChannel.onReceive(
35+
async (params: { path: string }) => {
36+
const [expectedValue, isOver] = getNextExpectedSequence();
37+
expect(params).toEqual(expectedValue);
38+
39+
if (isOver) {
40+
await waitForZombieMessages();
41+
return resolve();
42+
}
43+
}
44+
);
45+
46+
initLedgerChannel();
47+
});
48+
};

0 commit comments

Comments
 (0)