fix: use toHaveText to correctly await swap completion after testId migration

getByTestId('swap-buy-button').waitFor({ state: 'visible' }) resolved
immediately because the button is always rendered; only its text changes.
Replace with expect(...).toHaveText('Buy KRK', { timeout: 60_000 }) to
correctly gate on the button returning to its idle state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-02 23:47:53 +00:00
parent 68601c255a
commit ed5db3b000
3 changed files with 3 additions and 3 deletions

View file

@ -97,7 +97,7 @@ export async function buyKrk(page: Page, ethAmount: string): Promise<void> {
try {
await page.getByRole('button', { name: /Submitting/i }).waitFor({ state: 'visible', timeout: 5_000 });
console.log('[swap] Swap in progress...');
await page.getByTestId('swap-buy-button').waitFor({ state: 'visible', timeout: 60_000 });
await expect(page.getByTestId('swap-buy-button')).toHaveText('Buy KRK', { timeout: 60_000 });
console.log('[swap] Swap completed');
} catch {
// Swap completed before the Submitting state could be observed