fix: Dozens of bare waitForTimeout() calls remain throughout e2e tests (#418)
Add eslint-disable-next-line no-restricted-syntax comments with justification to the 10 bare waitForTimeout() calls in tests/e2e/usertest/helpers.ts. All waitForTimeout calls in the spec files (01–06 and all usertest specs) were already properly documented after PR #417. helpers.ts was the only remaining file with bare calls: - 6 in connectWallet(): wallet connector panel animation and connection handshake have no observable DOM event to await - 4 in attemptStake(): Ponder indexing lag, debounced form handlers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
524a6a66d9
commit
92fa38e328
1 changed files with 15 additions and 5 deletions
|
|
@ -147,9 +147,11 @@ export async function connectWallet(page: Page): Promise<void> {
|
|||
await page.evaluate(() => {
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
});
|
||||
// eslint-disable-next-line no-restricted-syntax -- waitForTimeout: no event source exists for Vue's useMobile composable to recalculate after a resize event in E2E tests. See AGENTS.md #Engineering Principles.
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
|
||||
// Give time for wallet connectors to initialize
|
||||
// eslint-disable-next-line no-restricted-syntax -- waitForTimeout: no event source exists for wallet connector initialization; connectors load asynchronously with no observable DOM event. See AGENTS.md #Engineering Principles.
|
||||
await page.waitForTimeout(2_000);
|
||||
|
||||
// Try desktop Connect button first
|
||||
|
|
@ -158,13 +160,15 @@ export async function connectWallet(page: Page): Promise<void> {
|
|||
if (await connectButton.isVisible({ timeout: 5_000 })) {
|
||||
console.log('[HELPER] Found desktop Connect button');
|
||||
await connectButton.click();
|
||||
// eslint-disable-next-line no-restricted-syntax -- waitForTimeout: no event source exists for the wallet connector slideout panel animation to settle. See AGENTS.md #Engineering Principles.
|
||||
await page.waitForTimeout(1_000);
|
||||
|
||||
|
||||
// Click the first wallet connector
|
||||
const injectedConnector = page.locator('.connectors-element').first();
|
||||
if (await injectedConnector.isVisible({ timeout: 5_000 })) {
|
||||
console.log('[HELPER] Clicking wallet connector...');
|
||||
await injectedConnector.click();
|
||||
// eslint-disable-next-line no-restricted-syntax -- waitForTimeout: no event source exists for the injected wallet provider to complete connection handshake. See AGENTS.md #Engineering Principles.
|
||||
await page.waitForTimeout(2_000);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -173,11 +177,13 @@ export async function connectWallet(page: Page): Promise<void> {
|
|||
if (await mobileLoginIcon.isVisible({ timeout: 2_000 })) {
|
||||
console.log('[HELPER] Using mobile login icon');
|
||||
await mobileLoginIcon.click();
|
||||
// eslint-disable-next-line no-restricted-syntax -- waitForTimeout: no event source exists for the wallet connector slideout panel animation to settle. See AGENTS.md #Engineering Principles.
|
||||
await page.waitForTimeout(1_000);
|
||||
|
||||
|
||||
const injectedConnector = page.locator('.connectors-element').first();
|
||||
if (await injectedConnector.isVisible({ timeout: 5_000 })) {
|
||||
await injectedConnector.click();
|
||||
// eslint-disable-next-line no-restricted-syntax -- waitForTimeout: no event source exists for the injected wallet provider to complete connection handshake. See AGENTS.md #Engineering Principles.
|
||||
await page.waitForTimeout(2_000);
|
||||
}
|
||||
}
|
||||
|
|
@ -513,8 +519,9 @@ export async function attemptStake(
|
|||
|
||||
const baseUrl = page.url().split('#')[0];
|
||||
await page.goto(`${baseUrl}stake`);
|
||||
|
||||
|
||||
// Wait longer for page to load and stats to initialize
|
||||
// eslint-disable-next-line no-restricted-syntax -- waitForTimeout: no event source exists for Ponder indexing lag and UI re-renders after on-chain transactions in E2E tests. See AGENTS.md #Engineering Principles.
|
||||
await page.waitForTimeout(3_000);
|
||||
|
||||
try {
|
||||
|
|
@ -542,11 +549,13 @@ export async function attemptStake(
|
|||
const stakeAmountInput = page.getByLabel('Staking Amount');
|
||||
await stakeAmountInput.waitFor({ state: 'visible', timeout: 10_000 });
|
||||
await stakeAmountInput.fill(amount);
|
||||
// eslint-disable-next-line no-restricted-syntax -- waitForTimeout: no event source exists for debounced input handlers to settle after programmatic fill. See AGENTS.md #Engineering Principles.
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
|
||||
// Select tax rate
|
||||
const taxSelect = page.getByRole('combobox', { name: 'Tax' });
|
||||
await taxSelect.selectOption({ value: taxRateIndex });
|
||||
// eslint-disable-next-line no-restricted-syntax -- waitForTimeout: no event source exists for debounced form state to update after select option change. See AGENTS.md #Engineering Principles.
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Take screenshot before attempting to click
|
||||
|
|
@ -612,6 +621,7 @@ export async function attemptStake(
|
|||
// May complete instantly
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax -- waitForTimeout: no event source exists for Ponder indexing lag and UI re-renders after on-chain transactions in E2E tests. See AGENTS.md #Engineering Principles.
|
||||
await page.waitForTimeout(3_000);
|
||||
recordAction(`Stake ${amount} KRK at ${taxRateIndex}% tax`, true, undefined, report);
|
||||
console.log(`[${personaName}] Stake successful`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue