Skip to content

Commit

Permalink
fix: format
Browse files Browse the repository at this point in the history
  • Loading branch information
matstyler committed May 3, 2024
1 parent e378082 commit 566edc7
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 28 deletions.
2 changes: 1 addition & 1 deletion examples/new-dawn/test/synpress.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { metaMaskFixtures, testWithSynpress } from '@synthetixio/synpress'
import connectedSetup from './wallet-setup/connected.setup'
import { testWithSynpress, metaMaskFixtures } from '@synthetixio/synpress'

export default testWithSynpress(metaMaskFixtures(connectedSetup))
4 changes: 2 additions & 2 deletions packages/core/src/cli/cliEntrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export const cliEntrypoint = async () => {
const flags: CliFlags = program.opts()

if (flags.headless) {
process.env['HEADLESS'] = true
process.env.HEADLESS = true
}

if (flags.debug) {
console.log('[DEBUG] Running with the following options:')
console.log({ cacheDir: walletSetupDir, ...flags, headless: Boolean(process.env['HEADLESS']) ?? false }, '\n')
console.log({ cacheDir: walletSetupDir, ...flags, headless: Boolean(process.env.HEADLESS) ?? false }, '\n')
}

if (os.platform() === 'win32') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function createCacheForWalletSetupFunction(
// TODO: Extract & Make a constant.
const browserArgs = [`--disable-extensions-except=${extensionPath}`, `--load-extension=${extensionPath}`]

if (process.env['HEADLESS']) {
if (process.env.HEADLESS) {
browserArgs.push('--headless=new')
}

Expand Down
2 changes: 1 addition & 1 deletion packages/test/src/testWithSynpress.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Fixtures, TestType } from '@playwright/test'
import { test as base, mergeTests } from '@playwright/test'
import { mergeTests, test as base } from '@playwright/test'

export default function testWithSynpress<CustomFixtures extends Fixtures>(
customFixtures: TestType<CustomFixtures, object>
Expand Down
2 changes: 1 addition & 1 deletion packages/tsconfig/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noPropertyAccessFromIndexSignature": false,

"esModuleInterop": true,
"skipLibCheck": true,
Expand Down
4 changes: 2 additions & 2 deletions release/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EthereumWalletMock, ethereumWalletMockFixtures } from '@synthetixio/ethereum-wallet-mock'
import { defineWalletSetup } from '@synthetixio/synpress-core'
import { testWithSynpress } from '@synthetixio/synpress-test'
import { MetaMask, getExtensionId, metaMaskFixtures } from '@synthetixio/synpress-metamask'
import { EthereumWalletMock, ethereumWalletMockFixtures } from '@synthetixio/ethereum-wallet-mock'
import { testWithSynpress } from '@synthetixio/synpress-test'

export {
// Framework fixtures
Expand Down
7 changes: 1 addition & 6 deletions wallets/ethereum-wallet-mock/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ export default defineConfig({
// Concise 'dot' for CI, default 'html' when running locally.
// See https://playwright.dev/docs/test-reporters.
reporter: process.env.CI
? [
[
'html',
{ open: 'never', outputFolder: `playwright-report-${process.env['HEADLESS'] ? 'headless' : 'headful'}` }
]
]
? [['html', { open: 'never', outputFolder: `playwright-report-${process.env.HEADLESS ? 'headless' : 'headful'}` }]]
: 'html',

// Shared settings for all the projects below.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readFileSync } from 'fs'
import { createRequire } from 'node:module'
import { test as base } from '@playwright/test'
import { EthereumWalletMock } from '../EthereumWalletMock'
import { mockEthereum, SEED_PHRASE } from '../utils'
import { SEED_PHRASE, mockEthereum } from '../utils'

export const ANVIL_CHAIN_ID = 31337
export const ANVIL_URL_URL = 'http://anvil:5000'
Expand Down
7 changes: 1 addition & 6 deletions wallets/metamask/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ export default defineConfig({
// Concise 'dot' for CI, default 'html' when running locally.
// See https://playwright.dev/docs/test-reporters.
reporter: process.env.CI
? [
[
'html',
{ open: 'never', outputFolder: `playwright-report-${process.env['HEADLESS'] ? 'headless' : 'headful'}` }
]
]
? [['html', { open: 'never', outputFolder: `playwright-report-${process.env.HEADLESS ? 'headless' : 'headful'}` }]]
: 'html',

// Shared settings for all the projects below.
Expand Down
12 changes: 6 additions & 6 deletions wallets/metamask/src/fixtures/metaMaskFixtures.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { MetaMask, unlockForFixture, getExtensionId, prepareExtension } from '../../src'
import { MetaMask, getExtensionId, prepareExtension, unlockForFixture } from '../../src'

import { chromium, type Page } from '@playwright/test'
import path from 'node:path'
import { type Page, chromium } from '@playwright/test'
import { test as base } from '@playwright/test'
import {
CACHE_DIR_NAME,
createTempContextDir,
defineWalletSetup,
removeTempContextDir
} from '@synthetixio/synpress-core'
import path from 'node:path'
import fs from 'fs-extra'
import { type Anvil, type CreateAnvilOptions, createPool } from '@viem/anvil'
import fs from 'fs-extra'

type MetaMaskFixtures = {
_contextPath: string
Expand Down Expand Up @@ -52,7 +52,7 @@ export const metaMaskFixtures = (walletSetup: ReturnType<typeof defineWalletSetu
// We don't need the `--load-extension` arg since the extension is already loaded in the cache.
const browserArgs = [`--disable-extensions-except=${metamaskPath}`]

if (process.env['HEADLESS']) {
if (process.env.HEADLESS) {
browserArgs.push('--headless=new')

if (slowMo > 0) {
Expand All @@ -63,7 +63,7 @@ export const metaMaskFixtures = (walletSetup: ReturnType<typeof defineWalletSetu
const context = await chromium.launchPersistentContext(_contextPath, {
headless: false,
args: browserArgs,
slowMo: process.env['HEADLESS'] ? 0 : slowMo
slowMo: process.env.HEADLESS ? 0 : slowMo
})

// TODO: This should be stored in a store to speed up the tests.
Expand Down
2 changes: 1 addition & 1 deletion wallets/metamask/test/e2e/importWallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const test = base.extend<{
`--load-extension=${metamaskPath}`
]

if (process.env['HEADLESS']) {
if (process.env.HEADLESS) {
browserArgs.push('--headless=new')
}

Expand Down

0 comments on commit 566edc7

Please sign in to comment.