Skip to content

Commit

Permalink
fix: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DDDDDanica committed Jun 18, 2024
1 parent cdf2ab0 commit dd58323
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 24 deletions.
9 changes: 8 additions & 1 deletion test/e2e/accounts/account-custom-name.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '../helpers';
import FixtureBuilder from '../fixture-builder';
import { Driver } from '../webdriver/driver';
import { Ganache } from '../seeder/ganache';

const newAccountLabel = 'Custom name';
const anotherAccountLabel = '2nd custom name';
Expand All @@ -18,7 +19,13 @@ describe('Account Custom Name Persistence', function (this: Suite) {
fixtures: new FixtureBuilder().build(),
title: this.test?.fullTitle(),
},
async ({ driver }: { driver: Driver, ganacheServer }) => {
async ({
driver,
ganacheServer,
}: {
driver: Driver;
ganacheServer: Ganache;
}) => {
await unlockWallet(driver);

// Change account label for existing account
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ const TEST_SEED_PHRASE =
const TEST_SEED_PHRASE_TWO =
'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent';

// Usually happens when onboarded to make sure the state is retrieved from metamaskState properly, or a success login, or after txn is made
// Usually happens when onboarded to make sure the state is retrieved from metamaskState properly, or after txn is made
const locateAccountBalanceDOM = async (driver, ganacheServer) => {
const balance = await ganacheServer.getBalance();

Expand Down
20 changes: 12 additions & 8 deletions test/e2e/tests/metrics/dapp-viewed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const {
getEventPayloads,
openDapp,
logInWithBalanceValidation,
locateAccountBalanceDOM,
WINDOW_TITLES,
defaultGanacheOptions,
} = require('../../helpers');
const FixtureBuilder = require('../../fixture-builder');
const {
Expand Down Expand Up @@ -40,8 +40,7 @@ async function mockPermissionApprovedEndpoint(mockServer) {
});
}

async function createTwoAccounts(driver, ganacheServer) {
await locateAccountBalanceDOM(driver, ganacheServer);
async function createTwoAccounts(driver) {
await driver.clickElement('[data-testid="account-menu-icon"]');
await driver.clickElement(
'[data-testid="multichain-account-menu-popover-action-button"]',
Expand Down Expand Up @@ -108,10 +107,10 @@ describe('Dapp viewed Event @no-mmi', function () {
.build(),
title: this.test.fullTitle(),
testSpecificMock: mockSegment,
ganacheOptions: defaultGanacheOptions,
},
async ({ driver, mockedEndpoint: mockedEndpoints }) => {
await unlockWallet(driver);

async ({ driver, mockedEndpoint: mockedEndpoints, ganacheServer }) => {
await logInWithBalanceValidation(driver, ganacheServer);
await connectToDapp(driver);
await waitForDappConnected(driver);
const events = await getEventPayloads(driver, mockedEndpoints);
Expand Down Expand Up @@ -143,6 +142,7 @@ describe('Dapp viewed Event @no-mmi', function () {
.build(),
title: this.test.fullTitle(),
testSpecificMock: mockSegment,
ganacheOptions: defaultGanacheOptions,
},
async ({ driver, mockedEndpoint: mockedEndpoints, ganacheServer }) => {
await logInWithBalanceValidation(driver, ganacheServer);
Expand Down Expand Up @@ -180,6 +180,7 @@ describe('Dapp viewed Event @no-mmi', function () {
.build(),
title: this.test.fullTitle(),
testSpecificMock: mockSegment,
ganacheOptions: defaultGanacheOptions,
},
async ({ driver, mockedEndpoint: mockedEndpoints, ganacheServer }) => {
await logInWithBalanceValidation(driver, ganacheServer);
Expand Down Expand Up @@ -222,6 +223,7 @@ describe('Dapp viewed Event @no-mmi', function () {
.build(),
title: this.test.fullTitle(),
testSpecificMock: mockSegment,
ganacheOptions: defaultGanacheOptions,
},
async ({ driver, mockedEndpoint: mockedEndpoints, ganacheServer }) => {
await logInWithBalanceValidation(driver, ganacheServer);
Expand Down Expand Up @@ -257,12 +259,13 @@ describe('Dapp viewed Event @no-mmi', function () {
})
.build(),
title: this.test.fullTitle(),
ganacheOptions: defaultGanacheOptions,
testSpecificMock: mockSegment,
},
async ({ driver, mockedEndpoint: mockedEndpoints, ganacheServer }) => {
await unlockWallet(driver);
await logInWithBalanceValidation(driver, ganacheServer);
// create 2nd account
await createTwoAccounts(driver, ganacheServer);
await createTwoAccounts(driver);
// Connect to dapp with two accounts
await openDapp(driver);
await driver.clickElement({
Expand Down Expand Up @@ -312,6 +315,7 @@ describe('Dapp viewed Event @no-mmi', function () {
.build(),
title: this.test.fullTitle(),
testSpecificMock: mockSegment,
ganacheOptions: defaultGanacheOptions,
},
async ({ driver, mockedEndpoint: mockedEndpoints, ganacheServer }) => {
await logInWithBalanceValidation(driver, ganacheServer);
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/metrics/unlock-wallet.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Unlock wallet', function () {
title: this.test.fullTitle(),
testSpecificMock: mockSegment,
},
async ({ driver, mockedEndpoint, ganacheServer}) => {
async ({ driver, mockedEndpoint, ganacheServer }) => {
await logInWithBalanceValidation(driver, ganacheServer);
const events = await getEventPayloads(driver, mockedEndpoint);
assert.equal(events.length, 3);
Expand Down
1 change: 0 additions & 1 deletion test/e2e/tests/multichain/connection-page.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { strict: assert } = require('assert');
const {
withFixtures,
unlockWallet,
WINDOW_TITLES,
connectToDapp,
logInWithBalanceValidation,
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/tests/multichain/permission-page.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const { strict: assert } = require('assert');
const {
withFixtures,
unlockWallet,
WINDOW_TITLES,
connectToDapp,
logInWithBalanceValidation,
defaultGanacheOptions,
} = require('../../helpers');
const FixtureBuilder = require('../../fixture-builder');

Expand All @@ -15,6 +15,7 @@ describe('Permissions Page', function () {
dapp: true,
fixtures: new FixtureBuilder().build(),
title: this.test.fullTitle(),
ganacheOptions: defaultGanacheOptions,
},
async ({ driver, ganacheServer }) => {
await logInWithBalanceValidation(driver, ganacheServer);
Expand Down Expand Up @@ -50,6 +51,7 @@ describe('Permissions Page', function () {
dapp: true,
fixtures: new FixtureBuilder().build(),
title: this.test.fullTitle(),
ganacheOptions: defaultGanacheOptions,
},
async ({ driver, ganacheServer }) => {
await logInWithBalanceValidation(driver, ganacheServer);
Expand Down
5 changes: 2 additions & 3 deletions test/e2e/tests/swap-send/swap-send-erc20.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
openActionMenuAndStartSendFlow,
logInWithBalanceValidation,
} from '../../helpers';
import { Driver } from '../../webdriver/driver';
import type { Ganache } from '../../seeder/ganache';
import {
NATIVE_TOKEN_SYMBOL,
Expand All @@ -27,9 +28,7 @@ describe('Swap-Send ERC20', function () {
driver,
ganacheServer,
}: {
// TODO: Replace `any` with type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
driver: any;
driver: Driver;
ganacheServer: Ganache;
}) => {
const swapSendPage = new SwapSendPage(driver);
Expand Down
14 changes: 6 additions & 8 deletions test/e2e/tests/tokens/nft/import-nft.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('Import NFT', function () {
);
});

it('should continue to display an imported NFT after importing, adding a new account, and switching back', async function () {
it.only('should continue to display an imported NFT after importing, adding a new account, and switching back', async function () {
await withFixtures(
{
dapp: true,
Expand Down Expand Up @@ -109,24 +109,22 @@ describe('Import NFT', function () {
);
await driver.clickElement({ text: 'Add a new account', tag: 'button' });

// set account name
await driver.fill('[placeholder="Account 2"]', '2nd account');
await driver.delay(400);
// By clicking creating button without filling in the account name
// the default name would be set as Account 2
await driver.clickElement({ text: 'Create', tag: 'button' });

await driver.isElementPresent({
tag: 'span',
text: '2nd account',
text: 'Account 2',
});

const accountOneSelector = await findAnotherAccountFromAccountList(
driver,
1,
'Account 1',
);
await locateAccountBalanceDOM(driver, ganacheServer);
await driver.clickElement(accountOneSelector);

await driver.clickElement(accountOneSelector);
await locateAccountBalanceDOM(driver, ganacheServer);
const nftIsStillDisplayed = await driver.isElementPresentAndVisible({
css: 'h5',
text: 'TestDappNFTs',
Expand Down

0 comments on commit dd58323

Please sign in to comment.