Skip to content

Commit ffe0a78

Browse files
committed
test(cat-voices): debugging with Janusz
1 parent 915ce8b commit ffe0a78

File tree

11 files changed

+71
-29
lines changed

11 files changed

+71
-29
lines changed

.github/workflows/voices-tests.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
permissions:
88
id-token: write
9-
contents: read
9+
contents: write
1010

1111
concurrency:
1212
group: voices-tests-${{ github.head_ref || github.ref }}
@@ -62,24 +62,25 @@ jobs:
6262
- name: Wait for cat-gateway to become healthy
6363
id: gateway-healthy
6464
run: |
65-
echo "Waiting for cat-gateway container to be healthy..."
66-
for i in {1..100}; do
67-
STATUS=$(docker inspect --format='{{.State.Health.Status}}' cat-gateway 2>/dev/null || echo "not_found")
68-
echo "Attempt $i: Health status: $STATUS"
65+
echo "Waiting for container to be healthy..."
66+
for i in {1..500}; do
67+
STATUS=$(docker inspect --format='{{.State.Health.Status}}' cat-gateway)
68+
echo "Health status: $STATUS"
6969
if [ "$STATUS" == "healthy" ]; then
7070
echo "Container is healthy!"
71-
exit 0
71+
break
7272
fi
7373
if [ "$STATUS" == "unhealthy" ]; then
7474
echo "Container became unhealthy."
75-
docker logs cat-gateway
76-
exit 1
75+
break
7776
fi
7877
sleep 5
7978
done
80-
echo "Timeout waiting for cat-gateway to become healthy"
81-
docker logs cat-gateway
82-
exit 1
79+
80+
if [ "$STATUS" != "healthy" ]; then
81+
docker compose -f catalyst-gateway/tests/docker-compose.yml logs cat-gateway
82+
exit 1
83+
fi
8384
8485
- name: Run E2E tests
8586
id: run-tests

catalyst_voices/apps/voices/e2e_tests/docker-compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ services:
1515
- DB_SUPERUSER_PASSWORD=postgres
1616
- DB_USER=catalyst-event-dev
1717
- DB_USER_PASSWORD=CHANGE_ME
18-
1918
- INIT_AND_DROP_DB=true
2019
- WITH_MIGRATIONS=true
2120
ports:
@@ -49,9 +48,9 @@ services:
4948
healthcheck:
5049
test: "curl -s -i localhost:3030/api/v1/health/ready | head -n 1 | grep 204"
5150
start_period: 30s
52-
interval: 20s
51+
interval: 30s
5352
timeout: 30s
54-
retries: 45
53+
retries: 50
5554
environment:
5655
- EVENT_DB_URL=postgres://catalyst-event-dev:CHANGE_ME@event-db/CatalystEventDev
5756
- CASSANDRA_PERSISTENT_URL=index-db:9042

catalyst_voices/apps/voices/e2e_tests/fixtures/browser-fixtures.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export const test = base.extend<BrowserFixtures>({
6767
"--disable-gpu",
6868
],
6969
});
70+
await browser.grantPermissions(["clipboard-read", "clipboard-write"]);
7071
await use(browser);
7172
await browser.close();
7273
},

catalyst_voices/apps/voices/e2e_tests/models/accountModel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export class AccountModel {
66
public password: string,
77
public isProposer: boolean = false,
88
public seedPhrase: string[] = [],
9-
public isDummy: boolean = false
9+
public isDummy: boolean = false,
10+
public seedPhrasePath: string = ""
1011
) {}
1112
}

catalyst_voices/apps/voices/e2e_tests/page-objects/onboarding/create-flow/step-16-wallet-connected.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export class WalletConnectedPanel extends OnboardingBasePage {
3434
}
3535
async getWalletAddressValue() {
3636
await this.click(this.walletAddressClipboardIcon);
37-
const address = await this.page.evaluate(() =>
38-
navigator.clipboard.readText()
37+
const address = await this.page.evaluate(async () =>
38+
await navigator.clipboard.readText()
3939
);
4040
return address;
4141
}

catalyst_voices/apps/voices/e2e_tests/page-objects/onboarding/create-flow/step-7-writedown-seedphrase.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ export class WritedownSeedPhrasePanel extends OnboardingBasePage {
77
page: Page;
88
seedphraseStoredCheckbox: Locator;
99
downloadSeedPhraseButton: Locator;
10+
exportKeyButton: Locator;
1011

1112
constructor(page: Page, testModel: TestModel) {
1213
super(page, testModel);
1314
this.page = page;
1415
this.seedphraseStoredCheckbox = page.getByTestId("SeedPhraseStoredCheckbox_checkbox");
1516
this.downloadSeedPhraseButton = page.getByTestId("DownloadSeedPhraseButton");
17+
this.exportKeyButton = page.locator("//flt-semantics[text()='Export Key']");
1618
}
1719
async goto() {
1820
await new CreateKeychainSuccessPanel(this.page, this.testModel).goto();
@@ -21,6 +23,15 @@ export class WritedownSeedPhrasePanel extends OnboardingBasePage {
2123
async seedphraseStoredCheckboxClick() {
2224
await this.click(this.seedphraseStoredCheckbox);
2325
}
26+
27+
async downloadSeedPhrase(): Promise<string> {
28+
await this.downloadSeedPhraseClick();
29+
const downloadPromise = this.page.waitForEvent("download");
30+
await this.exportKeyButton.click();
31+
const download = await downloadPromise;
32+
const path = await download.path();
33+
return path;
34+
}
2435
async downloadSeedPhraseClick() {
2536
await this.click(this.downloadSeedPhraseButton);
2637
}

catalyst_voices/apps/voices/e2e_tests/page-objects/onboarding/create-flow/step-8-writedown-seedphrase-info.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ export class WritedownSeedPhraseInfoPanel extends OnboardingBasePage {
1212
}
1313
async goto() {
1414
await new WritedownSeedPhrasePanel(this.page, this.testModel).goto();
15-
this.testModel.accountModel.seedPhrase = await new WritedownSeedPhrasePanel(this.page, this.testModel).getSeedPhraseWords();
15+
this.testModel.accountModel.seedPhrase = await new WritedownSeedPhrasePanel(
16+
this.page,
17+
this.testModel
18+
).getSeedPhraseWords();
1619
await new WritedownSeedPhrasePanel(this.page, this.testModel).seedphraseStoredCheckboxClick();
1720
await new OnboardingBasePage(this.page, this.testModel).nextButtonClick();
1821
}

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,34 @@ export class InputSeedPhrasePanel extends OnboardingBasePage {
77
page: Page;
88
uploadKeyButton: Locator;
99
resetButton: Locator;
10+
switchToUploadButton: Locator;
11+
dropKeyButton: Locator;
1012

1113
constructor(page: Page, testModel: TestModel) {
1214
super(page, testModel);
1315
this.page = page;
1416
this.uploadKeyButton = page.getByTestId("UploadKeyButton");
1517
this.resetButton = page.getByTestId("ResetButton");
18+
this.switchToUploadButton = page.locator(
19+
"//flt-semantics[text()='Yes, switch to Catalyst key upload']"
20+
);
21+
this.dropKeyButton = page.locator("//flt-semantics[contains(text(),'Drop your key here')]");
1622
}
1723
async goto() {
1824
await new WritedownSeedPhraseInfoPanel(this.page, this.testModel).goto();
1925
await new OnboardingBasePage(this.page, this.testModel).nextButtonClick();
2026
}
27+
28+
async uploadSeedPhrase(): Promise<void> {
29+
await this.uploadKeyButtonClick();
30+
await this.switchToUploadButton.click();
31+
32+
const fileChooserPromise = this.page.waitForEvent("filechooser");
33+
await this.dropKeyButton.click();
34+
const fileChooser = await fileChooserPromise;
35+
await fileChooser.setFiles(this.testModel.accountModel.seedPhrasePath);
36+
}
37+
2138
async uploadKeyButtonClick() {
2239
await this.click(this.uploadKeyButton);
2340
}
@@ -28,9 +45,11 @@ export class InputSeedPhrasePanel extends OnboardingBasePage {
2845
}
2946

3047
async inputSeedPhraseWords() {
31-
for (const word of this.testModel.accountModel.seedPhrase) {
32-
await this.page.getByRole("button", { name: word, exact: true }).first().click();
33-
await this.page.waitForTimeout(100);
48+
for (let i = 0; i < this.testModel.accountModel.seedPhrase.length; i++) {
49+
const word = this.testModel.accountModel.seedPhrase[i];
50+
const button = this.page.getByRole("button", { name: word, exact: true }).first();
51+
await button.evaluate((el: HTMLElement) => el.click());
52+
await this.page.waitForTimeout(500);
3453
}
3554
}
3655
}

catalyst_voices/apps/voices/e2e_tests/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default defineConfig({
99
retries: process.env.CI ? 2 : 0,
1010
workers: process.env.CI ? 1 : undefined,
1111
reporter: "html",
12-
timeout: 120 * 1000,
12+
timeout: 1200 * 1000,
1313
use: {
1414
baseURL: `https://app.${process.env.ENVIRONMENT}.projectcatalyst.io/`,
1515
trace: "on-first-retry",

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export class LaceActions implements WalletActions {
1717

1818
// Handle the next page (sometimes shows "Choose recovery method")
1919
await this.handleNextPage();
20+
await this.page.locator('[data-testid="wallet-setup-step-btn-next"]').click();
21+
await this.handleNextPage();
2022

2123
// Select 15-word recovery phrase
2224
await this.page.locator('//span[@data-testid="recovery-phrase-15"]').click();

0 commit comments

Comments
 (0)