Skip to content

Commit

Permalink
fix: disable swap test
Browse files Browse the repository at this point in the history
  • Loading branch information
fbwoolf committed May 1, 2024
1 parent 6b53a9a commit d0457fb
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions tests/specs/swap/swap.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test } from '../../fixtures/fixtures';

const hiroApiPostRoute = 'https://api.hiro.so/v2/transactions';
const hiroApiPostRoute = '*/**/v2/transactions';

test.describe('Swaps', () => {
test.beforeEach(async ({ extensionId, globalPage, homePage, onboardingPage, swapPage }) => {
Expand All @@ -14,16 +14,10 @@ test.describe('Swaps', () => {
test.expect(swapPage.page.getByText('STX')).toBeTruthy();
});

test('that it shows swap review details and broadcasts swap', async ({ swapPage }) => {
const requestPromise = swapPage.page.waitForRequest(hiroApiPostRoute);

await swapPage.page.route(hiroApiPostRoute, async route => {
await route.abort();
});

test('that it shows swap review details correctly', async ({ swapPage }) => {
await swapPage.inputSwapAmountBase();
await swapPage.selectAssetToReceive();
await swapPage.swapReviewBtn.click({ delay: 1000, force: true });
await swapPage.swapReviewBtn.click({ delay: 2000 });

const swapProtocol = await swapPage.swapDetailsProtocol.innerText();
test.expect(swapProtocol).toEqual('ALEX');
Expand All @@ -37,7 +31,23 @@ test.describe('Swaps', () => {
const swapAmounts = await swapPage.swapDetailsAmount.all();
const swapAmountBase = await swapAmounts[0].innerText();
test.expect(swapAmountBase).toEqual('1');
});

// This test isn't working bc there are multiple requests being made
// to the same endpoint. We need to know why this happening before
// enabling it again bc swaps keep occurring which create insufficient
// balance errors in our integration tests.
test.skip('that the swap is broadcast', async ({ swapPage }) => {
const requestPromise = swapPage.page.waitForRequest(hiroApiPostRoute);

await swapPage.page.route(hiroApiPostRoute, async route => {
await route.abort();
});

await swapPage.inputSwapAmountBase();
await swapPage.selectAssetToReceive();

await swapPage.swapReviewBtn.click({ delay: 2000 });
await swapPage.swapSubmitBtn.click();

const request = await requestPromise;
Expand Down

0 comments on commit d0457fb

Please sign in to comment.