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: Remove testHelpers file #13044

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/components/UI/CollectibleContracts/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import * as allSelectors from '../../../../app/reducers/collectibles/index.js';
import { cleanup, waitFor } from '@testing-library/react-native';
import Engine from '../../../core/Engine';

import TestHelpers from '../../../../e2e/helpers';
import { createMockAccountsControllerState } from '../../../util/test/accountsControllerTestUtils';
import { RootState } from '../../../reducers';
import { mockNetworkState } from '../../../util/test/network';
import { CHAIN_IDS } from '@metamask/transaction-controller';
import Utilities from '../../../../e2e/utils/Utilities';

jest.mock('@react-navigation/native', () => {
const actualReactNavigation = jest.requireActual('@react-navigation/native');
Expand Down Expand Up @@ -482,8 +482,7 @@ describe('CollectibleContracts', () => {
await act(async () => {
await refreshControl.props.onRefresh();
});

await TestHelpers.delay(1000);
await Utilities.delay(1000);

expect(spyOnUpdateNftMetadata).toHaveBeenCalledTimes(0);
expect(spyOnDetectNfts).toHaveBeenCalledTimes(1);
Expand Down
8 changes: 4 additions & 4 deletions e2e/api-specs/ConfirmationsRejectionRule.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { device } from 'detox';
import { addToQueue } from './helpers';
import paramsToObj from '@open-rpc/test-coverage/build/utils/params-to-obj';
import TestHelpers from '../helpers';
import Matchers from '../utils/Matchers';
import Gestures from '../utils/Gestures';
import ConnectBottomSheet from '../pages/Browser/ConnectBottomSheet';
Expand All @@ -13,6 +12,7 @@ import fs from 'fs';

import Assertions from '../utils/Assertions';
import PermissionSummaryBottomSheet from '../pages/Browser/PermissionSummaryBottomSheet';
import Utilities from '../utils/Utilities';

const getBase64FromPath = async (path) => {
const data = await fs.promises.readFile(path);
Expand Down Expand Up @@ -67,7 +67,7 @@ export default class ConfirmationsRejectRule {
await Assertions.checkIfNotVisible(
PermissionSummaryBottomSheet.container,
);
await TestHelpers.delay(3000);
await Utilities.delay(3000);

try {
await Assertions.checkIfVisible(SpamFilterModal.title);
Expand Down Expand Up @@ -138,7 +138,7 @@ export default class ConfirmationsRejectRule {
resolve,
reject,
task: async () => {
await TestHelpers.delay(3000);
await Utilities.delay(3000);
const imagePath = await device.takeScreenshot(
`afterRequest-${this.getTitle()}`,
);
Expand All @@ -150,7 +150,7 @@ export default class ConfirmationsRejectRule {
type: 'image',
});
let cancelButton;
await TestHelpers.delay(3000);
await Utilities.delay(3000);
if (this.allCapsCancel.includes(call.methodName)) {
await AssetWatchBottomSheet.tapCancelButton();
} else {
Expand Down
4 changes: 2 additions & 2 deletions e2e/api-specs/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TestHelpers from '../helpers';
import { v4 as uuid } from 'uuid';
import Utilities from '../utils/Utilities';

export const taskQueue = [];
let isProcessing = false;
Expand Down Expand Up @@ -32,7 +32,7 @@ const pollResult = async (driver, generatedKey) => {
addToQueue({
name: 'pollResult',
task: async () => {
await TestHelpers.delay(500);
await Utilities.delay(500);
const text = await driver.runScript(
(el, g) => window[g],
[generatedKey],
Expand Down
10 changes: 7 additions & 3 deletions e2e/fixtures/fixture-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import GanacheSeeder from '../../app/util/test/ganache-seeder';
import axios from 'axios';
import path from 'path';
import createStaticServer from '../create-static-server';
import { DEFAULT_MOCKSERVER_PORT, getFixturesServerPort, getLocalTestDappPort, getMockServerPort } from './utils';
import {
DEFAULT_MOCKSERVER_PORT,
getFixturesServerPort,
getLocalTestDappPort,
getMockServerPort,
} from './utils';
import Utilities from '../utils/Utilities';
import { device } from 'detox';
import TestHelpers from '../helpers';
import { startMockServer, stopMockServer } from '../api-mocking/mock-server';

export const DEFAULT_DAPP_SERVER_PORT = 8085;
Expand Down Expand Up @@ -170,7 +174,7 @@ export async function withFixtures(options, testSuite) {
// Due to the fact that the app was already launched on `init.js`, it is necessary to
// launch into a fresh installation of the app to apply the new fixture loaded perviously.
if (restartDevice) {
await TestHelpers.launchApp({
await Utilities.launchApp({
delete: true,
launchArgs: {
fixtureServerPort: `${getFixturesServerPort()}`,
Expand Down
Loading
Loading