Skip to content

Commit ba8dddc

Browse files
committed
refactor: e2e testing configs, lint and ts issues
1 parent 37c72f6 commit ba8dddc

File tree

8 files changed

+197
-193
lines changed

8 files changed

+197
-193
lines changed

apps/browser-extension/src/core/BitcoinProvider.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ bitcoin.initEccLib(ecc)
1313

1414
// eslint-disable-next-line new-cap
1515
const bip32 = BIP32Factory(ecc)
16+
// eslint-disable-next-line new-cap
1617
const ECPair = ECPairFactory(ecc)
1718
const privateKey = AccountUtil.privateKeyBitcoin
1819
const mnemonic = privateKey ? privateKey : bip39.generateMnemonic()
@@ -41,11 +42,13 @@ export class BitcoinProvider {
4142

4243
private getDerivationPath(): string {
4344
const isMainnet = this.activeNetwork === 'bip122:000000000019d6689c085ae165831e93'
45+
4446
return `m/84'/${isMainnet ? '0' : '1'}'/0'/0/0`
4547
}
4648

4749
private getDerivedKey() {
4850
const path = this.getDerivationPath()
51+
4952
return root.derivePath(path)
5053
}
5154

@@ -142,23 +145,20 @@ export class BitcoinProvider {
142145
}
143146

144147
const child = this.getDerivedKey()
148+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
145149
const keyPair = ECPair.fromPrivateKey(child.privateKey!)
146-
const privateKey = keyPair.privateKey!
150+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
151+
const pKey = keyPair.privateKey!
147152

148-
// Convert Uint8Array to string for message signing
149153
const messageString = new TextDecoder().decode(message)
150-
console.log('>>> signMessage, messageString:', `'${messageString}'`)
151154

152-
// Use bitcoin-message signing for P2WPKH addresses
153155
// @ts-expect-error - will fix privatekey type
154-
const signature = bitcoinMessage.sign(messageString, privateKey, keyPair.compressed, {
156+
const signature = bitcoinMessage.sign(messageString, pKey, keyPair.compressed, {
155157
segwitType: 'p2wpkh'
156158
})
157159

158-
console.log('>>> signMessage, signature length:', signature.length)
159-
160160
// Return signature as Buffer for proper base64 conversion
161-
return [{ signature: signature }]
161+
return Promise.resolve([{ signature }])
162162
}
163163

164164
switchNetwork(network: `${string}:${string}`) {

apps/laboratory/tests/email-default-account-types.spec.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,7 @@ emailTest.afterAll(async () => {
4848
})
4949

5050
// -- Tests --------------------------------------------------------------------
51-
52-
emailTest('it should make the default account type as smart account', async ({ library }) => {
53-
const namespace = library === 'solana' ? 'solana' : 'eip155'
54-
55-
if (namespace !== 'eip155') {
56-
return
57-
}
58-
51+
emailTest('it should make the default account type as smart account', async () => {
5952
await page.goToProfileWalletsView()
6053
await page.clickProfileWalletsMoreButton()
6154
await validator.expectChangePreferredAccountToShow(EOA)
@@ -71,13 +64,7 @@ emailTest('it should make the default account type as smart account', async ({ l
7164
await validator.expectDisconnected()
7265
})
7366

74-
emailTest('it should show make the default account type as EOA', async ({ library }) => {
75-
const namespace = library === 'solana' ? 'solana' : 'eip155'
76-
77-
if (namespace !== 'eip155') {
78-
return
79-
}
80-
67+
emailTest('it should show make the default account type as EOA', async () => {
8168
page = new ModalWalletPage(browserPage, 'default-account-types-eoa', 'default')
8269
await page.load()
8370

apps/laboratory/tests/shared/pages/ModalPage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ export class ModalPage {
939939
}
940940

941941
async connectToExtensionMultichain(
942-
chainNamespace: 'eip155' | 'solana' | 'bitcoin',
942+
chainNamespace: 'eip155' | 'solana' | 'bip122',
943943
modalOpen?: boolean,
944944
isAnotherNamespaceConnected?: boolean
945945
) {

apps/laboratory/tests/shared/types/index.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,30 @@ export interface SessionParams {
33
optAccounts: string[]
44
accept: boolean
55
}
6+
7+
export interface UseOptions {
8+
launchOptions: {
9+
executablePath: string
10+
}
11+
}
12+
13+
export interface CustomProperties {
14+
testIgnore?: RegExp | string
15+
testMatch?: RegExp | string
16+
useOptions?: UseOptions
17+
grep?: RegExp
18+
}
19+
20+
export type CustomProjectProperties = {
21+
[T in string]: CustomProperties
22+
}
23+
24+
export interface Permutation {
25+
device: string
26+
library: string
27+
}
28+
29+
export interface CreateProjectParameters {
30+
device: string
31+
library: string
32+
}

0 commit comments

Comments
 (0)