Skip to content

Commit

Permalink
♻️ test(metamask): Remove top-level describes (#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
duckception authored Nov 11, 2023
1 parent 7897535 commit b3e5b31
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 65 deletions.
34 changes: 16 additions & 18 deletions wallets/metamask/test/e2e/metamask/confirmSignature.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,27 @@ import connectedSetup from '../wallet-setup/connected.setup'

const test = testWithSynpress(connectedSetup, unlockForFixture)

const { describe, expect } = test
const { expect } = test

describe('MetaMask.confirmSignature', () => {
test('should confirm `personal_sign`', async ({ context, metamaskPage, page, extensionId }) => {
const metamask = new MetaMask(context, metamaskPage, connectedSetup.walletPassword, extensionId)
test('should confirm `personal_sign`', async ({ context, metamaskPage, page, extensionId }) => {
const metamask = new MetaMask(context, metamaskPage, connectedSetup.walletPassword, extensionId)

await page.goto('https://metamask.github.io/test-dapp/')
await page.goto('https://metamask.github.io/test-dapp/')

await page.locator('#personalSign').click()
await page.locator('#personalSign').click()

await metamask.confirmSignature()
await metamask.confirmSignature()

await expect(page.locator('#personalSignResult')).toHaveText(
'0xf95b3efc808585303e20573e960993cde30c7f5a0f1c25cfab0379d5a14311d17898199814c8ebe66ec80b2b11690f840bde539f862ff4f04468d2a40f15178a1b'
)
await expect(page.locator('#personalSignResult')).toHaveText(
'0xf95b3efc808585303e20573e960993cde30c7f5a0f1c25cfab0379d5a14311d17898199814c8ebe66ec80b2b11690f840bde539f862ff4f04468d2a40f15178a1b'
)

await page.locator('#personalSignVerify').click()
await page.locator('#personalSignVerify').click()

await expect(page.locator('#personalSignVerifySigUtilResult')).toHaveText(
'0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
)
await expect(page.locator('#personalSignVerifyECRecoverResult')).toHaveText(
'0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
)
})
await expect(page.locator('#personalSignVerifySigUtilResult')).toHaveText(
'0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
)
await expect(page.locator('#personalSignVerifyECRecoverResult')).toHaveText(
'0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
)
})
16 changes: 7 additions & 9 deletions wallets/metamask/test/e2e/metamask/connectToDapp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@ import basicSetup from '../wallet-setup/basic.setup'

const test = testWithSynpress(basicSetup, unlockForFixture)

const { describe, expect } = test
const { expect } = test

describe('MetaMask.connectToDapp', () => {
test('should connect wallet to dapp', async ({ context, page, extensionId }) => {
const metamask = new MetaMask(context, page, basicSetup.walletPassword, extensionId)
test('should connect wallet to dapp', async ({ context, page, extensionId }) => {
const metamask = new MetaMask(context, page, basicSetup.walletPassword, extensionId)

await page.goto('https://metamask.github.io/test-dapp/')
await page.goto('https://metamask.github.io/test-dapp/')

await page.locator('#connectButton').click()
await page.locator('#connectButton').click()

await metamask.connectToDapp()
await metamask.connectToDapp()

await expect(page.locator('#accounts')).toHaveText('0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266')
})
await expect(page.locator('#accounts')).toHaveText('0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266')
})
17 changes: 6 additions & 11 deletions wallets/metamask/test/e2e/metamask/importWallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,13 @@ const test = base.extend<{
}
})

const { describe, expect } = test
const { expect } = test

describe('MetaMask.importWallet', () => {
test('should go through the onboarding flow and import wallet from seed phrase', async ({
context,
metamaskPage
}) => {
const metamask = new MetaMask(context, metamaskPage, PASSWORD)
test('should go through the onboarding flow and import wallet from seed phrase', async ({ context, metamaskPage }) => {
const metamask = new MetaMask(context, metamaskPage, PASSWORD)

await metamask.importWallet(SEED_PHRASE)
await metamask.importWallet(SEED_PHRASE)

await expect(metamaskPage.getByText('Account 1')).toBeVisible()
await expect(metamaskPage.getByText('0xf39...2266')).toBeVisible()
})
await expect(metamaskPage.getByText('Account 1')).toBeVisible()
await expect(metamaskPage.getByText('0xf39...2266')).toBeVisible()
})
12 changes: 5 additions & 7 deletions wallets/metamask/test/e2e/metamask/lock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import basicSetup from '../wallet-setup/basic.setup'

const test = testWithSynpress(basicSetup, unlockForFixture)

const { describe, expect } = test
const { expect } = test

describe('MetaMask.lock', () => {
test('should lock the wallet', async ({ context, metamaskPage }) => {
const metamask = new MetaMask(context, metamaskPage, basicSetup.walletPassword)
test('should lock the wallet', async ({ context, metamaskPage }) => {
const metamask = new MetaMask(context, metamaskPage, basicSetup.walletPassword)

await metamask.lock()
await metamask.lock()

await expect(metamaskPage.locator(metamask.lockPage.selectors.submitButton)).toBeVisible()
})
await expect(metamaskPage.locator(metamask.lockPage.selectors.submitButton)).toBeVisible()
})
22 changes: 10 additions & 12 deletions wallets/metamask/test/e2e/metamask/rejectSignature.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ import connectedSetup from '../wallet-setup/connected.setup'

const test = testWithSynpress(connectedSetup, unlockForFixture)

const { describe, expect } = test
const { expect } = test

describe('MetaMask.rejectSignature', () => {
test('should reject `personal_sign`', async ({ context, metamaskPage, page, extensionId }) => {
const metamask = new MetaMask(context, metamaskPage, connectedSetup.walletPassword, extensionId)
test('should reject `personal_sign`', async ({ context, metamaskPage, page, extensionId }) => {
const metamask = new MetaMask(context, metamaskPage, connectedSetup.walletPassword, extensionId)

await page.goto('https://metamask.github.io/test-dapp/')
await page.goto('https://metamask.github.io/test-dapp/')

await page.locator('#personalSign').click()
await page.locator('#personalSign').click()

await metamask.rejectSignature()
await metamask.rejectSignature()

await expect(page.locator('#personalSign')).toHaveText(
'Error: MetaMask Message Signature: User denied message signature.'
)
await expect(page.locator('#personalSignResult')).toHaveText('')
})
await expect(page.locator('#personalSign')).toHaveText(
'Error: MetaMask Message Signature: User denied message signature.'
)
await expect(page.locator('#personalSignResult')).toHaveText('')
})
14 changes: 6 additions & 8 deletions wallets/metamask/test/e2e/metamask/unlock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ import basicSetup from '../wallet-setup/basic.setup'

const test = testWithSynpress(basicSetup, unlockForFixture)

const { describe, expect } = test
const { expect } = test

describe('MetaMask.unlock', () => {
test('should unlock the wallet', async ({ context, metamaskPage }) => {
const metamask = new MetaMask(context, metamaskPage, basicSetup.walletPassword)
test('should unlock the wallet', async ({ context, metamaskPage }) => {
const metamask = new MetaMask(context, metamaskPage, basicSetup.walletPassword)

await metamask.lock()
await metamask.lock()

await metamask.unlock()
await metamask.unlock()

await expect(metamaskPage.locator(metamask.homePage.selectors.logo)).toBeVisible()
})
await expect(metamaskPage.locator(metamask.homePage.selectors.logo)).toBeVisible()
})

0 comments on commit b3e5b31

Please sign in to comment.