Skip to content

Commit 21ebd32

Browse files
committed
tests: add GapLimits e2e test.
1 parent ac863e2 commit 21ebd32

File tree

4 files changed

+93
-3
lines changed

4 files changed

+93
-3
lines changed

.github/workflows/playwright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
run: make webe2etest
9696

9797
- name: Upload Playwright artifacts
98-
if: failure()
98+
if: always()
9999
uses: actions/upload-artifact@v4
100100
with:
101101
name: playwright-artifacts

frontends/web/package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontends/web/playwright.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ export default defineConfig({
2222
use: {
2323
baseURL: `http://${HOST}:${FRONTEND_PORT}`,
2424
headless: true,
25-
video: 'retain-on-failure',
25+
video: 'on',
2626
screenshot: 'only-on-failure',
27-
trace: 'retain-on-failure',
27+
trace: 'on',
2828
launchOptions: {
2929
// By default, tests are not run in slow motion.
3030
// Can be enabled by setting the PLAYWRIGHT_SLOW_MO environment variable to a value > 0.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/**
2+
* Copyright 2025 Shift Crypto AG
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
18+
19+
import { test } from './helpers/fixtures';
20+
import { ServeWallet } from './helpers/servewallet';
21+
import { expect } from '@playwright/test';
22+
import { clickButtonWithText } from './helpers/dom';
23+
import { deleteAccountsFile } from './helpers/fs';
24+
25+
let servewallet: ServeWallet;
26+
27+
test('Gap limits are correctly saved', async ({ page, host, frontendPort, servewalletPort }) => {
28+
29+
await test.step('Start servewallet', async () => {
30+
servewallet = new ServeWallet(page, servewalletPort, frontendPort, host);
31+
await servewallet.start();
32+
});
33+
34+
35+
await test.step('Navigate to the app', async () => {
36+
await page.goto(`http://${host}:${frontendPort}`);
37+
const body = page.locator('body');
38+
await expect(body).toContainText('Please connect your BitBox and tap the side to continue.');
39+
});
40+
41+
await test.step('Type into gap limit inputs', async () => {
42+
await page.getByRole('link', { name: 'Settings' }).click();
43+
await page.getByRole('link', { name: 'Advanced settings' }).click();
44+
await page.getByRole('button', { name: 'Custom gap limit settings' }).click();
45+
46+
const recvInput = page.locator('#gapLimitReceive');
47+
await recvInput.clear();
48+
await recvInput.click();
49+
await page.keyboard.press('5');
50+
await expect(page.locator('label[for="gapLimitReceive"]')).toHaveText(
51+
'Gap limit for receive addresses:The gap limit must be at least 20.'
52+
);
53+
await page.waitForTimeout(1000);
54+
await expect(recvInput).toBeFocused();
55+
await page.keyboard.press('0');
56+
await expect(recvInput).toBeFocused();
57+
58+
59+
const changeInput = page.locator('#gapLimitChange');
60+
await changeInput.clear();
61+
await changeInput.click();
62+
await page.keyboard.press('1');
63+
await expect(page.locator('label[for="gapLimitChange"]')).toHaveText(
64+
'Gap limit for change addresses:The gap limit must be at least 6.'
65+
);
66+
await page.waitForTimeout(1000);
67+
await expect(changeInput).toBeFocused();
68+
await page.keyboard.press('0');
69+
await expect(changeInput).toBeFocused();
70+
71+
await clickButtonWithText(page, 'Confirm');
72+
});
73+
74+
await test.step('Verify gap limit inputs are correctly saved', async () => {
75+
await page.getByRole('button', { name: 'Custom gap limit settings' }).click();
76+
const recvInput = page.locator('#gapLimitReceive');
77+
await expect(recvInput).toHaveValue('50');
78+
const changeInput = page.locator('#gapLimitChange');
79+
await expect(changeInput).toHaveValue('10');
80+
});
81+
});
82+
83+
test.beforeEach(() => {
84+
deleteAccountsFile();
85+
});
86+
87+
test.afterAll(() => {
88+
servewallet.stop();
89+
});

0 commit comments

Comments
 (0)