Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add e2e to swap with snap account #25558

Merged
merged 12 commits into from
Jul 2, 2024
47 changes: 47 additions & 0 deletions test/e2e/accounts/snap-account-eth-swap.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports */
import { withFixtures, defaultGanacheOptions, WINDOW_TITLES } from '../helpers';
import { Driver } from '../webdriver/driver';
import { installSnapSimpleKeyring } from './common';

const FixtureBuilder = require('../fixture-builder');
const {
buildQuote,
reviewQuote,
waitForTransactionToComplete,
checkActivityTransaction,
} = require('../tests/swaps/shared');

describe('Snap account swap', function () {
plasmacorral marked this conversation as resolved.
Show resolved Hide resolved
it('exchanges native token (ETH) for DAI', async function () {
plasmacorral marked this conversation as resolved.
Show resolved Hide resolved
await withFixtures(
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
title: this.test?.fullTitle(),
},
async ({ driver }: { driver: Driver }) => {
await installSnapSimpleKeyring(driver, false);
await driver.switchToWindowWithTitle(
WINDOW_TITLES.ExtensionInFullScreenView,
);
await buildQuote(driver, {
amount: 0.001,
swapTo: 'DAI',
});
await reviewQuote(driver, {
amount: 0.001,
swapFrom: 'TESTETH',
swapTo: 'DAI',
});
await driver.clickElement({ text: 'Swap', tag: 'button' });
await waitForTransactionToComplete(driver, { tokenName: 'DAI' });
await checkActivityTransaction(driver, {
index: 0,
amount: '0.001',
swapFrom: 'TESTETH',
swapTo: 'DAI',
});
},
);
});
});