Skip to content

Commit e28ce81

Browse files
authored
test(cat-voices): add other wallets (#3721)
1 parent 32fcb9d commit e28ce81

File tree

9 files changed

+172
-106
lines changed

9 files changed

+172
-106
lines changed

catalyst_voices/apps/voices/e2e_tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ These tests cover browser-based end-to-end workflows for the Catalyst Voices app
3434

3535
```bash
3636
cd catalyst_voices/apps/voices &&
37-
flutter run --dart-define=ENV_NAME=preprod --web-port 5555 \
37+
flutter run --dart-define=ENV_NAME=dev --web-port 5555 \
3838
--web-header "Cross-Origin-Opener-Policy=same-origin" \
3939
--web-header "Cross-Origin-Embedder-Policy=require-corp" \
4040
-d web-server --target lib/configs/main.dart

catalyst_voices/apps/voices/e2e_tests/data/browserExtensionConfigs.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
BrowserExtensionModel,
3-
BrowserExtensionName,
4-
} from "../models/browserExtensionModel";
1+
import { BrowserExtensionModel, BrowserExtensionName } from "../models/browserExtensionModel";
52

63
/* cspell: disable */
74
export const browserExtensions: BrowserExtensionModel[] = [
@@ -17,23 +14,24 @@ export const browserExtensions: BrowserExtensionModel[] = [
1714
},
1815
{
1916
Name: BrowserExtensionName.Yoroi,
20-
Id: "poonlenmfdfbjfeeballhiibknlknepo",
17+
Id: "ffnbelfdoeiohenkjibnmadjiehjhajb",
2118
HomeUrl: "/main_window.html#",
2219
},
2320
{
2421
Name: BrowserExtensionName.Nufi,
2522
Id: "hbklpdnlgiadjhdadfnfmemmklbopbcm",
2623
HomeUrl: "/index.html#",
2724
},
25+
{
26+
Name: BrowserExtensionName.Vespr,
27+
Id: "bedogdpgdnifilpgeianmmdabklhfkcn",
28+
HomeUrl: "/index.html#",
29+
},
2830
];
2931
/* cspell: enable */
3032

31-
export const getBrowserExtension = (
32-
name: BrowserExtensionName
33-
): BrowserExtensionModel => {
34-
const extension = browserExtensions.find(
35-
(extension) => extension.Name === name
36-
);
33+
export const getBrowserExtension = (name: BrowserExtensionName): BrowserExtensionModel => {
34+
const extension = browserExtensions.find((extension) => extension.Name === name);
3735
if (!extension) {
3836
throw new Error(`Browser extension with name ${name} not found`);
3937
}

catalyst_voices/apps/voices/e2e_tests/data/walletConfigs.ts

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@ export const walletConfigs: WalletConfigModel[] = [
2525
],
2626
network: "preprod",
2727
username: "test123",
28-
password: "test12345678@",
28+
password: "Test12345678@!!",
2929
cipBridge: ["cip-95"],
3030
mainAddress:
3131
"addr_test1qq2fckuzdvxu074ngumdkwn68tuuse67yg55r8exmkwdnn2lc30fwlx8jy6e54em6dcql0ma3gz75rc4ywuzuny7p7csr9kx9g",
32-
stakeAddress:
33-
"stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
32+
stakeAddress: "stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
3433
},
3534
{
3635
name: "Eternl",
@@ -54,12 +53,11 @@ export const walletConfigs: WalletConfigModel[] = [
5453
],
5554
network: "preprod",
5655
username: "test123",
57-
password: "test12345678@!!",
56+
password: "Test12345678@!!",
5857
cipBridge: ["cip-30", "cip-95"],
5958
mainAddress:
6059
"addr_test1qq2fckuzdvxu074ngumdkwn68tuuse67yg55r8exmkwdnn2lc30fwlx8jy6e54em6dcql0ma3gz75rc4ywuzuny7p7csr9kx9g",
61-
stakeAddress:
62-
"stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
60+
stakeAddress: "stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
6361
},
6462
{
6563
name: "Yoroi",
@@ -83,12 +81,11 @@ export const walletConfigs: WalletConfigModel[] = [
8381
],
8482
network: "preprod",
8583
username: "test123",
86-
password: "test12345678@!!",
84+
password: "Test12345678@!!",
8785
cipBridge: ["cip-95"],
8886
mainAddress:
8987
"addr_test1qq2fckuzdvxu074ngumdkwn68tuuse67yg55r8exmkwdnn2lc30fwlx8jy6e54em6dcql0ma3gz75rc4ywuzuny7p7csr9kx9g",
90-
stakeAddress:
91-
"stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
88+
stakeAddress: "stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
9289
},
9390
{
9491
name: "Nufi",
@@ -112,12 +109,39 @@ export const walletConfigs: WalletConfigModel[] = [
112109
],
113110
network: "preprod",
114111
username: "test123",
115-
password: "test12345678@!!",
112+
password: "Test12345678@!!",
116113
cipBridge: ["cip-95"],
117114
mainAddress:
118115
"addr_test1qq2fckuzdvxu074ngumdkwn68tuuse67yg55r8exmkwdnn2lc30fwlx8jy6e54em6dcql0ma3gz75rc4ywuzuny7p7csr9kx9g",
119-
stakeAddress:
120-
"stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
116+
stakeAddress: "stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
117+
},
118+
{
119+
name: "Vespr",
120+
extension: getBrowserExtension(BrowserExtensionName.Vespr),
121+
seed: [
122+
"stomach",
123+
"horn",
124+
"rail",
125+
"afraid",
126+
"flip",
127+
"also",
128+
"abandon",
129+
"speed",
130+
"chaos",
131+
"daring",
132+
"soon",
133+
"soft",
134+
"okay",
135+
"online",
136+
"benefit",
137+
],
138+
network: "preprod",
139+
username: "test123",
140+
password: "Test12345678@!!",
141+
cipBridge: ["cip-95"],
142+
mainAddress:
143+
"addr_test1qq2fckuzdvxu074ngumdkwn68tuuse67yg55r8exmkwdnn2lc30fwlx8jy6e54em6dcql0ma3gz75rc4ywuzuny7p7csr9kx9g",
144+
stakeAddress: "stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
121145
},
122146
];
123147
// cspell: enable
@@ -128,9 +152,7 @@ export const walletConfigs: WalletConfigModel[] = [
128152
* @returns The wallet config
129153
*/
130154
export const getWalletConfigByName = (name: string): WalletConfigModel => {
131-
const walletConfig = walletConfigs.find(
132-
(walletConfig) => walletConfig.name === name
133-
);
155+
const walletConfig = walletConfigs.find((walletConfig) => walletConfig.name === name);
134156
if (!walletConfig) {
135157
throw new Error(`Wallet config with name ${name} not found`);
136158
}
@@ -142,12 +164,8 @@ export const getWalletConfigByName = (name: string): WalletConfigModel => {
142164
* @param name - The name of the extension
143165
* @returns The wallet config
144166
*/
145-
export const getWalletConfigByExtensionName = (
146-
name: BrowserExtensionName
147-
): WalletConfigModel => {
148-
const walletConfig = walletConfigs.find(
149-
(walletConfig) => walletConfig.extension.Name === name
150-
);
167+
export const getWalletConfigByExtensionName = (name: BrowserExtensionName): WalletConfigModel => {
168+
const walletConfig = walletConfigs.find((walletConfig) => walletConfig.extension.Name === name);
151169
if (!walletConfig) {
152170
throw new Error(`Wallet config with extension name ${name} not found`);
153171
}

catalyst_voices/apps/voices/e2e_tests/page-objects/onboarding/create-flow/step-9-input-seedphrase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class InputSeedPhrasePanel extends OnboardingBasePage {
2727

2828
async inputSeedPhraseWords() {
2929
for (const word of this.testModel.accountModel.seedPhrase) {
30-
await this.page.getByRole("button", { name: word, exact: true }).click();
30+
await this.page.getByRole("button", { name: word, exact: true }).first().click();
3131
await this.page.waitForTimeout(100);
3232
}
3333
}

catalyst_voices/apps/voices/e2e_tests/tests/onboarding.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { test } from "../fixtures";
22
import { expect } from "@playwright/test";
3-
import { getOneOfEachExtensions, getWalletConfigByExtensionName } from "../data/walletConfigs";
3+
import { getOneOfEachExtensions, getWalletConfigByExtensionName, walletConfigs } from "../data/walletConfigs";
44
import { WalletListPanel } from "../page-objects/onboarding/create-flow/step-15-wallet-list";
55
import { createWalletActions } from "../utils/wallets/wallet-actions-factory";
66
import { WalletConnectedPanel } from "../page-objects/onboarding/create-flow/step-16-wallet-connected";
77
import { TestModel } from "../models/testModel";
88
import { getAccountModel } from "../data/accountConfigs";
99
import { BrowserExtensionName } from "../models/browserExtensionModel";
1010

11-
for (const walletConfig of [getWalletConfigByExtensionName(BrowserExtensionName.Lace)]) {
11+
for (const walletConfig of walletConfigs) {
1212
test.describe(`Onboarding ${walletConfig.extension.Name}`, () => {
1313
test.use({
1414
testModel: new TestModel(getAccountModel("DummyForTesting"), walletConfig),

catalyst_voices/apps/voices/e2e_tests/utils/wallets/eternl-actions.ts

Lines changed: 61 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,41 @@ export class EternlActions implements WalletActions {
1212
}
1313

1414
async restoreWallet(): Promise<void> {
15-
await this.page.locator('//button[aria-label="Start setup"]').click();
16-
await this.page.locator('#modalSetupSettingsFooter button').click();
17-
18-
await this.page.locator('button:has-text("Add Wallet")').click();
15+
/* cspell: disable */
16+
await this.page.locator('//button[@aria-label="Start setup"]').click();
17+
await this.page.locator("#modalSetupSettingsFooter button").click();
18+
await this.selectNetwork(this.walletConfig.network);
1919

20-
// Click Restore wallet
21-
await this.page.locator('button:has-text("Restore wallet")').click();
22-
23-
// Select 15 words
24-
await this.page.locator('button:has-text("15 words")').click();
25-
26-
// Click next
27-
await this.page.locator('button.cc-btn-primary:has-text("next")').click();
28-
29-
// Enter seed phrase
3020
await this.page
31-
.locator("#wordInput")
32-
.fill(this.walletConfig.seed.join(" "));
21+
.locator("//div[@id='eternl-modal']//button[@id='modelSetupSettingsBtnNext']")
22+
.click();
23+
await this.page.locator("#passwordInput").fill(this.walletConfig.password);
24+
await this.page.locator("#btnNext").click();
25+
await this.page.locator("#passwordInput").fill(this.walletConfig.password);
26+
await this.page.locator("#modelSetupSettingsBtnNext").click();
3327

34-
// Continue
35-
await this.page.locator('button:has-text("continue")').click();
28+
// Click Restore wallet
29+
await this.page.locator('button:has-text("Enter a Seed-phrase")').click();
3630

37-
// Set wallet name
3831
await this.page
39-
.locator("#inputWalletName")
40-
.fill(this.walletConfig.username);
32+
.locator(`button:has-text("${this.walletConfig.seed.length}-word phrase")`)
33+
.click();
4134

42-
// Set password
43-
await this.page.locator("#password").fill(this.walletConfig.password);
44-
await this.page.locator("#repeatPassword").fill(this.walletConfig.password);
35+
await this.writeDownSeedPhraseWords();
36+
await this.page.locator('button#modelRestoreWalletBtnNext:has-text("Next")').click();
37+
await this.page.locator('button#modelRestoreWalletBtnNext:has-text("Next")').click();
4538

46-
// Save wallet
47-
await this.page.locator('button:has-text("save")').click();
48-
await this.page.locator('button:has-text("save")').click();
39+
await this.page.locator("#walletName").fill(this.walletConfig.name);
40+
await this.page.locator('button#modelRestoreWalletBtnNext:has-text("Next")').click();
4941

50-
// Click on the light theme area to complete setup
42+
// Continue
43+
await this.page.locator("#password").fill(this.walletConfig.password);
44+
await this.page.locator("#passwordConfirm").pressSequentially(this.walletConfig.password);
45+
await this.page.locator("span:has-text('Set your spending password')").click();
46+
await this.page.locator('button:has-text("Next")').click();
5147
await this.page
52-
.locator(
53-
"div.flex.flex-row.justify-center.items-center.cursor-pointer.cc-area-light-1"
54-
)
55-
.click();
48+
.locator('.p-card-footer-compact:has-text("Up to date")')
49+
.waitFor({ state: "visible" });
5650
}
5751

5852
async connectWallet(): Promise<void> {
@@ -67,4 +61,39 @@ export class EternlActions implements WalletActions {
6761
// Sign the transaction
6862
await this.page.locator('//button[.//span[text()="sign"]]').click();
6963
}
64+
65+
private async writeDownSeedPhraseWords(): Promise<void> {
66+
for (let i = 0; i < this.walletConfig.seed.length; i++) {
67+
await this.page
68+
.locator(`//div[@class='p-inputgroup' and .//span[text()='${i + 1}']]//input`)
69+
.fill(this.walletConfig.seed[i]);
70+
await this.page
71+
.locator(
72+
`//div[@class='p-autocomplete-overlay p-component']//li[text()='${this.walletConfig.seed[i]}']`
73+
)
74+
.click();
75+
}
76+
}
77+
78+
private async selectNetwork(network: string): Promise<void> {
79+
switch (network) {
80+
case "preprod":
81+
await this.page
82+
.locator(
83+
"//div[@id='modal-network-select']//button[.//div[contains(text(), 'Pre-Production')]]"
84+
)
85+
.click();
86+
break;
87+
case "mainnet":
88+
await this.page
89+
.locator(
90+
"//div[@id='modal-network-select']//button[.//div[contains(text(), 'Cardano mainnet')]]"
91+
)
92+
.click();
93+
break;
94+
default:
95+
throw new Error(`Invalid network: ${network}`);
96+
}
97+
/* cspell: enable */
98+
}
7099
}

catalyst_voices/apps/voices/e2e_tests/utils/wallets/nufi-actions.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export class NufiActions implements WalletActions {
1313

1414
async restoreWallet(): Promise<void> {
1515
// Click restore page icon
16-
await this.page.locator("//*[@data-testid='RestorePageIcon']").click();
16+
await this.page
17+
.locator("//div[contains(@class,'MuiPaper-root') and .//p[text()='Restore Wallet']]")
18+
.click();
1719

1820
// Enter seed phrase
1921
const seedPhrase = this.walletConfig.seed;
@@ -24,9 +26,7 @@ export class NufiActions implements WalletActions {
2426
}
2527

2628
// Accept terms and conditions
27-
await this.page
28-
.locator("//span[@data-test-id='terms-and-conditions-checkbox']/input")
29-
.check();
29+
await this.page.locator("//span[@data-test-id='terms-and-conditions-checkbox']/input").check();
3030

3131
// Continue
3232
await this.page.locator("button:has-text('Continue')").click();
@@ -38,31 +38,27 @@ export class NufiActions implements WalletActions {
3838

3939
// Set password (using specific field IDs)
4040
await this.page
41-
.locator("//input[@id=':rg:']")
41+
.locator("//div[@data-test-id='wallet-password-field']//input")
4242
.fill(this.walletConfig.password);
4343
await this.page
44-
.locator("//input[@id=':rh:']")
44+
.locator("//div[@data-test-id='wallet-password-confirm-field']//input")
4545
.fill(this.walletConfig.password);
4646

47-
// Continue
48-
await this.page.locator("button:has-text('Continue')").click();
49-
5047
// Recover wallet
51-
await this.page.locator("button:has-text('Recover')").click();
48+
await this.page.locator("//button[text()='Recover']").click();
5249

5350
// Go to wallet
5451
await this.page.locator("button:has-text('Go to Wallet')").click();
52+
await this.page.locator("//*[@data-test-id='close-news-button']").click();
53+
await this.page
54+
.locator(
55+
"(//div[contains(@class, 'MuiPaper-root')]//div[contains(@class, 'MuiBox-root') and text()='Send'])[1]"
56+
)
57+
.waitFor({ state: "visible" });
5558
}
5659

5760
async connectWallet(): Promise<void> {
58-
// First, enter password if required
59-
await this.page
60-
.locator("//input[@type='password']")
61-
.fill(this.walletConfig.password);
62-
63-
// Click connect button (there are typically two)
64-
await this.page.locator("button:has-text('Connect')").click();
65-
await this.page.locator("button:has-text('Connect')").click();
61+
await this.page.locator("//button[text()='Connect']").click();
6662
}
6763

6864
async approveTransaction(): Promise<void> {

0 commit comments

Comments
 (0)