Skip to content

Commit

Permalink
[DDW-596] merge-in latest develop
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikGuzei committed May 9, 2022
2 parents 6cc778b + e0fd21e commit d567319
Show file tree
Hide file tree
Showing 107 changed files with 4,457 additions and 3,905 deletions.
8 changes: 7 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"@typescript-eslint/no-empty-function": 1,
"@typescript-eslint/ban-types": 1,
"import/no-unresolved": 1,
"@typescript-eslint/no-var-requires": 1,
"@typescript-eslint/no-var-requires": 0,
"camelcase": 1,
"no-empty": 1,
"@typescript-eslint/no-explicit-any": 1,
Expand Down Expand Up @@ -115,6 +115,12 @@
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": "error"
}
},
{
"files": "hardware-wallet-tests/**/*.ts",
"rules": {
"jest/no-standalone-expect": "off",
}
}
]
}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
!source/
!features/
!storybook/
!hardware-wallet-tests/
!tests/

# Now we ignore all files
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

### Fixes

- Fixed dialogs being closed after receiving address shared ([PR 2965](https://github.com/input-output-hk/daedalus/pull/2965))
- Fixed no progress shown on loading screen on Windows ([PR 2967](https://github.com/input-output-hk/daedalus/pull/2967))
- Fixes hardware wallet issues on Windows ([PR 2900](https://github.com/input-output-hk/daedalus/pull/2900))
- Fixed stake pool list styling ([PR 2920](https://github.com/input-output-hk/daedalus/pull/2920))
- Fixed PopOver overlap ([PR 2954](https://github.com/input-output-hk/daedalus/pull/2954))
- Fixed tooltip being hidden in several places ([PR-2934](https://github.com/input-output-hk/daedalus/pull/2934))
Expand All @@ -30,6 +33,7 @@

### Chores

- Updated cardano-launcher to 0.20220119.0 ([PR 2839](https://github.com/input-output-hk/daedalus/pull/2839))
- Added `storybook:build` check to pre-push hook ([PR 2955](https://github.com/input-output-hk/daedalus/pull/2955))
- Bumped vulnerable dependencies versions ([PR 2943](https://github.com/input-output-hk/daedalus/pull/2943))
- Using new faker.js ([PR 2855](https://github.com/input-output-hk/daedalus/pull/2855))
Expand Down
79 changes: 79 additions & 0 deletions hardware-wallet-tests/cardano-app-already-launched.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import expect from 'expect';

import {
createAndRegisterHardwareWalletChannels,
createHardwareWalletConnectionChannel,
initLedgerChannel,
createTestInstructions,
createCardanoAppChannel,
createGetPublicKeyChannel,
ipcRenderer,
} from './utils';

export const run = () => {
expect.assertions(3);

createTestInstructions([
'Plug Ledger Nano S to your computer',
'Launch Cardano APP on Nano S/Nano X',
'Run the test again with Cardano App opened',
'Export the public key',
]);

createAndRegisterHardwareWalletChannels();

const cardanoAppChannel = createCardanoAppChannel();
const publicKeyChannel = createGetPublicKeyChannel();
const hardwareWalletConnectionChannel =
createHardwareWalletConnectionChannel();

return new Promise<void>((resolve) => {
hardwareWalletConnectionChannel.onReceive(
async (params: { path: string }) => {
expect(params).toEqual({
disconnected: expect.any(Boolean),
deviceType: expect.any(String),
deviceId: null,
deviceModel: expect.any(String),
deviceName: expect.any(String),
path: expect.any(String),
product: expect.any(String),
});

const cardanoAppChannelReply = await cardanoAppChannel.request(
{ path: params.path },
ipcRenderer,
ipcRenderer
);

expect(cardanoAppChannelReply).toEqual({
minor: expect.any(Number),
major: expect.any(Number),
patch: expect.any(Number),
deviceId: expect.any(String),
});

const extendedPublicKey = await publicKeyChannel.request(
{
path: "1852'/1815'/0'",
// Shelley 1852 ADA 1815 indicator for account '0'
isTrezor: false,
devicePath: params.path,
},
ipcRenderer,
ipcRenderer
);

expect(extendedPublicKey).toEqual({
chainCodeHex: expect.any(String),
publicKeyHex: expect.any(String),
deviceId: expect.any(String),
});

resolve();
}
);

initLedgerChannel();
});
};
76 changes: 76 additions & 0 deletions hardware-wallet-tests/cardano-app-not-started.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import expect from 'expect';

import {
createAndRegisterHardwareWalletChannels,
createHardwareWalletConnectionChannel,
initLedgerChannel,
createTestInstructions,
createGetPublicKeyChannel,
ipcRenderer,
requestLaunchingCardanoAppOnLedger,
} from './utils';

export const run = () => {
expect.assertions(3);

createTestInstructions([
'Start test runner',
'Plug Ledger Nano S to your computer',
'Start Cardano APP on Nano S',
'Nano S will prompt to export the public key',
'Export the public key',
]);

createAndRegisterHardwareWalletChannels();

const publicKeyChannel = createGetPublicKeyChannel();
const hardwareWalletConnectionChannel =
createHardwareWalletConnectionChannel();

return new Promise<void>((resolve) => {
hardwareWalletConnectionChannel.onReceive(
async (params: { path: string }) => {
expect(params).toEqual({
disconnected: expect.any(Boolean),
deviceType: expect.any(String),
deviceId: null,
deviceModel: expect.any(String),
deviceName: expect.any(String),
path: expect.any(String),
product: expect.any(String),
});

const cardanoAppChannelResponse =
await requestLaunchingCardanoAppOnLedger(params.path);

expect(cardanoAppChannelResponse).toEqual({
minor: expect.any(Number),
major: expect.any(Number),
patch: expect.any(Number),
deviceId: expect.any(String),
});

const extendedPublicKey = await publicKeyChannel.request(
{
path: "1852'/1815'/0'",
// Shelley 1852 ADA 1815 indicator for account '0'
isTrezor: false,
devicePath: params.path,
},
ipcRenderer,
ipcRenderer
);

expect(extendedPublicKey).toEqual({
chainCodeHex: expect.any(String),
publicKeyHex: expect.any(String),
deviceId: expect.any(String),
});

resolve();
}
);

initLedgerChannel();
});
};
52 changes: 52 additions & 0 deletions hardware-wallet-tests/connect-multiple-hardware-wallets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import expect from 'expect';

import {
createAndRegisterHardwareWalletChannels,
createHardwareWalletConnectionChannel,
createSequentialResult,
initLedgerChannel,
createTestInstructions,
waitForZombieMessages,
} from './utils';

export const run = () => {
expect.assertions(2);

createAndRegisterHardwareWalletChannels();

const hardwareWalletConnectionChannel =
createHardwareWalletConnectionChannel();

createTestInstructions([
'Start test runner',
'Plug Ledger Nano S to your computer',
'Plug Ledger Nano X to your computer',
]);

const getNextExpectedSequence = createSequentialResult([
{
disconnected: false,
deviceModel: 'nanoS',
},
{
disconnected: false,
deviceModel: 'nanoX',
},
]);

return new Promise<void>((resolve) => {
hardwareWalletConnectionChannel.onReceive(
async (message: { path: string; deviceModel: string }) => {
const [expectedValue, isOver] = getNextExpectedSequence();
expect(message).toEqual(expectedValue);

if (isOver) {
await waitForZombieMessages();
resolve();
}
}
);

initLedgerChannel();
});
};
62 changes: 62 additions & 0 deletions hardware-wallet-tests/disconnect-multiple-hardware-wallets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import expect from 'expect';

import {
createAndRegisterHardwareWalletChannels,
createHardwareWalletConnectionChannel,
createSequentialResult,
initLedgerChannel,
createTestInstructions,
waitForZombieMessages,
} from './utils';

const getNextExpectedSequence = createSequentialResult([
{
disconnected: false,
deviceModel: 'nanoS',
},
{
disconnected: false,
deviceModel: 'nanoX',
},
{
disconnected: true,
deviceModel: 'nanoS',
},
{
disconnected: true,
deviceModel: 'nanoX',
},
]);

export const run = () => {
expect.assertions(4);

createAndRegisterHardwareWalletChannels();

const hardwareWalletConnectionChannel =
createHardwareWalletConnectionChannel();

createTestInstructions([
'Connect Nano S',
'Connect Nano X',
'Disconnect Nano S',
'Disconnect Nano X',
]);

return new Promise<void>((resolve) => {
hardwareWalletConnectionChannel.onReceive(
async (params: { path: string; deviceModel: string }) => {
const [expectedValue, isOver] = getNextExpectedSequence();

expect(params).toEqual(expectedValue);

if (isOver) {
await waitForZombieMessages();
return resolve();
}
}
);

initLedgerChannel();
});
};
49 changes: 49 additions & 0 deletions hardware-wallet-tests/disconnect-single-hardware-wallet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import expect from 'expect';

import {
createAndRegisterHardwareWalletChannels,
createHardwareWalletConnectionChannel,
initLedgerChannel,
createTestInstructions,
createSequentialResult,
waitForZombieMessages,
} from './utils';

export const run = () => {
expect.assertions(3);

createTestInstructions([
'Plug Ledger Nano S to your computer',
'Disconnect Nano S',
]);

createAndRegisterHardwareWalletChannels();

const hardwareWalletConnectionChannel =
createHardwareWalletConnectionChannel();

const getNextExpectedSequence = createSequentialResult([
{
disconnected: false,
},
{
disconnected: true,
},
]);

return new Promise<void>((resolve) => {
hardwareWalletConnectionChannel.onReceive(
async (params: { path: string }) => {
const [expectedValue, isOver] = getNextExpectedSequence();
expect(params).toEqual(expectedValue);

if (isOver) {
await waitForZombieMessages();
return resolve();
}
}
);

initLedgerChannel();
});
};
Loading

0 comments on commit d567319

Please sign in to comment.