Skip to content

Commit

Permalink
⚡️ e2e: disable storage on test env
Browse files Browse the repository at this point in the history
  • Loading branch information
jgalat committed Sep 19, 2023
1 parent f8d6504 commit d46615b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 1 addition & 3 deletions e2e/common/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ import { CommonTest } from './types';

export default function ({ page }: CommonTest) {
const reload = async () => {
await new Promise((r) => setTimeout(r, 15_000));
await page.reload({ waitUntil: 'domcontentloaded' });
await new Promise((r) => setTimeout(r, 30_000));
await page.waitForFunction(
() => {
return document.querySelectorAll('.MuiSkeleton-root').length === 0;
},
null,
{
timeout: 15_000,
timeout: 30_000,
polling: 1_000,
},
);
Expand Down
3 changes: 1 addition & 2 deletions e2e/components/navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ export default function (page: Page) {
const goTo = async (path: Path) => {
await page.getByTestId(`navbar-link-${path}`).click();
await page.waitForURL(`**/${path}`, { timeout: 15_000 });
await new Promise((resolve) => setTimeout(resolve, 30_000));
await page.waitForFunction(
() => {
return document.querySelectorAll('.MuiSkeleton-root').length === 0;
},
null,
{
timeout: 15_000,
timeout: 30_000,
polling: 1_000,
},
);
Expand Down
9 changes: 8 additions & 1 deletion utils/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EthereumClient, w3mConnectors, w3mProvider } from '@web3modal/ethereum';
import { createConfig, configureChains, ChainProviderFn, Chain } from 'wagmi';
import { createConfig, configureChains, ChainProviderFn, Chain, createStorage } from 'wagmi';
import { InjectedConnector } from 'wagmi/connectors/injected';
import * as wagmiChains from 'wagmi/chains';
import { jsonRpcProvider } from 'wagmi/providers/jsonRpc';
Expand Down Expand Up @@ -43,13 +43,20 @@ const providers: ChainProviderFn<Chain>[] = isE2E

const { chains, publicClient } = configureChains<Chain>(sortedChains, providers);

const noopStorage = {
getItem: () => '',
setItem: () => null,
removeItem: () => null,
};

export const wagmi = createConfig({
connectors: [
...(isE2E
? [new InjectedConnector({ chains, options: { name: 'E2E', shimDisconnect: false } })]
: [...w3mConnectors({ projectId: walletConnectId, chains }), new SafeConnector({ chains })]),
],
publicClient,
...(isE2E ? { storage: createStorage({ storage: noopStorage }) } : {}),
});

export const web3modal = new EthereumClient(wagmi, chains);

0 comments on commit d46615b

Please sign in to comment.