diff --git a/scripts/harb-evaluator/helpers/swap.ts b/scripts/harb-evaluator/helpers/swap.ts index 83b93e1..86e27a8 100644 --- a/scripts/harb-evaluator/helpers/swap.ts +++ b/scripts/harb-evaluator/helpers/swap.ts @@ -97,7 +97,7 @@ export async function buyKrk(page: Page, ethAmount: string): Promise { 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 diff --git a/tests/e2e/01-acquire-and-stake.spec.ts b/tests/e2e/01-acquire-and-stake.spec.ts index 7e5d10c..9ed1643 100644 --- a/tests/e2e/01-acquire-and-stake.spec.ts +++ b/tests/e2e/01-acquire-and-stake.spec.ts @@ -184,7 +184,7 @@ test.describe('Acquire & Stake', () => { try { await page.getByRole('button', { name: /Submitting/i }).waitFor({ state: 'visible', timeout: 5_000 }); console.log('[TEST] Swap initiated, waiting for completion...'); - 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('[TEST] Swap completed!'); } catch (e) { console.log('[TEST] No "Submitting" state detected, swap may have completed instantly'); diff --git a/tests/e2e/02-max-stake-all-tax-rates.spec.ts b/tests/e2e/02-max-stake-all-tax-rates.spec.ts index 6c58d3c..9848b31 100644 --- a/tests/e2e/02-max-stake-all-tax-rates.spec.ts +++ b/tests/e2e/02-max-stake-all-tax-rates.spec.ts @@ -193,7 +193,7 @@ test.describe('Max Stake All Tax Rates', () => { console.log('[TEST] Waiting for swap to process...'); try { await page.getByRole('button', { name: /Submitting/i }).waitFor({ state: 'visible', timeout: 5_000 }); - 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('[TEST] Swap completed!'); } catch (e) { console.log('[TEST] Swap may have completed instantly');