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:
parent
68601c255a
commit
ed5db3b000
3 changed files with 3 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue