Skip to content

Commit

Permalink
Merge pull request #175 from palladians/chore/replace-eslint-with-biome
Browse files Browse the repository at this point in the history
chore(dx): replace eslint and prettier with biome
  • Loading branch information
mrcnk authored Apr 26, 2024
2 parents be99b4f + 7bdf23c commit 13374b0
Show file tree
Hide file tree
Showing 532 changed files with 5,947 additions and 6,768 deletions.
20 changes: 5 additions & 15 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"files": [
"README.md"
],
"files": ["README.md"],
"imageSize": 100,
"commit": false,
"commitType": "docs",
Expand All @@ -12,36 +10,28 @@
"name": "Tomek Marciniak",
"avatar_url": "https://avatars.githubusercontent.com/u/16132011?v=4",
"profile": "https://github.com/mrcnk",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "teddyjfpender",
"name": "Teddy Pender",
"avatar_url": "https://avatars.githubusercontent.com/u/92999717?v=4",
"profile": "https://github.com/teddyjfpender",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "rago4",
"name": "Rafał Goławski",
"avatar_url": "https://avatars.githubusercontent.com/u/19167236?v=4",
"profile": "https://dev.to/rgolawski",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "mich3lang3lo",
"name": "Mariusz",
"avatar_url": "https://avatars.githubusercontent.com/u/164676295?v=4",
"profile": "https://github.com/mich3lang3lo",
"contributions": [
"code"
]
"contributions": ["code"]
}
],
"contributorsPerLine": 7,
Expand Down
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

19 changes: 0 additions & 19 deletions .eslintrc.json

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc

This file was deleted.

26 changes: 13 additions & 13 deletions apps/extension/e2e/address-book.spec.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { expect, test } from './extension'
import { OnboardingPom } from './pom/onboarding'
import { expect, test } from "./extension"
import { OnboardingPom } from "./pom/onboarding"

const PUBLIC_KEY = 'B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS'
const PUBLIC_KEY = "B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS"

test('creates and deletes contact', async ({ page, extensionId }) => {
test("creates and deletes contact", async ({ page, extensionId }) => {
const onboardingPom = new OnboardingPom({ page, extensionId })
await onboardingPom.restoreTestWallet()
await page.getByTestId('bottomNavigation__addressBook').click()
await page.getByTestId('addressBook__addAddressButton').click()
await page.getByTestId('newAddress__nameInput').fill('New Contact')
await page.getByTestId('newAddress__addressInput').fill(PUBLIC_KEY)
await page.getByTestId('newAddress__createButton').click()
await page.getByTestId('bottomNavigation__addressBook').click()
await page.getByTestId("bottomNavigation__addressBook").click()
await page.getByTestId("addressBook__addAddressButton").click()
await page.getByTestId("newAddress__nameInput").fill("New Contact")
await page.getByTestId("newAddress__addressInput").fill(PUBLIC_KEY)
await page.getByTestId("newAddress__createButton").click()
await page.getByTestId("bottomNavigation__addressBook").click()
const contactsAfterCreation = await page
.getByTestId('addressBook__contact')
.getByTestId("addressBook__contact")
.all()
// 2 including donate Pallad option.
expect(contactsAfterCreation.length).toEqual(2)
await page.getByTestId('addressBook__removeAddress').click()
await page.getByTestId("addressBook__removeAddress").click()
const contactsAfterDeletion = await page
.getByTestId('addressBook__contact')
.getByTestId("addressBook__contact")
.all()
// Just donate Pallad.
expect(contactsAfterDeletion.length).toEqual(1)
Expand Down
20 changes: 10 additions & 10 deletions apps/extension/e2e/create-wallet.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect, test } from './extension'
import { devnetWallet } from './fixtures'
import { OnboardingPom } from './pom/onboarding'
import { expect, test } from "./extension"
import { devnetWallet } from "./fixtures"
import { OnboardingPom } from "./pom/onboarding"

test('create new wallet', async ({ page, extensionId }) => {
test("create new wallet", async ({ page, extensionId }) => {
const onboardingPom = new OnboardingPom({ page, extensionId })
await onboardingPom.goto()
await onboardingPom.startCreating()
Expand All @@ -17,29 +17,29 @@ test('create new wallet', async ({ page, extensionId }) => {
const confirmationIndex = await onboardingPom.getMnemonicConfirmationIndex()
await onboardingPom.fillMnemonicConfirmation(mnemonicWords[confirmationIndex])
await onboardingPom.goNext()
const pageTitle = page.getByText('Stay Connected')
const pageTitle = page.getByText("Stay Connected")
await pageTitle.waitFor()
await onboardingPom.goNext()
expect(await onboardingPom.getMinaBalance()).toContain('MINA')
expect(await onboardingPom.getMinaBalance()).toContain("MINA")
})

test('validates create wallet data', async ({ page, extensionId }) => {
test("validates create wallet data", async ({ page, extensionId }) => {
const onboardingPom = new OnboardingPom({ page, extensionId })
await onboardingPom.goto()
await onboardingPom.startCreating()
await onboardingPom.assertNextDisabled()
await onboardingPom.fillWalletName(devnetWallet.walletName)
await onboardingPom.fillSpendingPassword('ASD')
await onboardingPom.fillSpendingPassword("ASD")
await onboardingPom.toggleTos()
await onboardingPom.goNext()
const errors = await page.getByTestId('form__error').all()
const errors = await page.getByTestId("form__error").all()
expect(errors.length).toEqual(1)
await onboardingPom.fillSpendingPassword(devnetWallet.spendingPassword)
await onboardingPom.goNext()
await onboardingPom.confirmAlone()
await onboardingPom.assertNextDisabled()
await onboardingPom.toggleMnemonicWritten()
await onboardingPom.goNext()
await onboardingPom.fillMnemonicConfirmation('boots')
await onboardingPom.fillMnemonicConfirmation("boots")
await onboardingPom.assertNextDisabled()
})
22 changes: 11 additions & 11 deletions apps/extension/e2e/extension.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import { type BrowserContext, chromium, test as base } from '@playwright/test'
import path from 'path'
import { fileURLToPath } from 'url'
import path from "node:path"
import { fileURLToPath } from "node:url"
import { type BrowserContext, test as base, chromium } from "@playwright/test"
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

export const test = base.extend<{
context: BrowserContext
extensionId: string
}>({
/* eslint-disable */
// biome-ignore lint: won't fix
context: async ({}, use) => {
const pathToExtension = path.join(__dirname, '../dist')
const context = await chromium.launchPersistentContext('', {
const pathToExtension = path.join(__dirname, "../dist")
const context = await chromium.launchPersistentContext("", {
headless: false,
args: [
`--disable-extensions-except=${pathToExtension}`,
`--load-extension=${pathToExtension}`
]
`--load-extension=${pathToExtension}`,
],
})
await use(context)
await context.close()
},
extensionId: async ({ context }, use) => {
let [background] = context.serviceWorkers()
if (!background) background = await context.waitForEvent('serviceworker')
if (!background) background = await context.waitForEvent("serviceworker")

const extensionId = background.url().split('/')[2]
const extensionId = background.url().split("/")[2]
await use(extensionId)
}
},
})
export const expect = test.expect
30 changes: 15 additions & 15 deletions apps/extension/e2e/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
export const devnetWallet = {
walletName: 'Devnet Wallet',
spendingPassword: 'SuperSecure777',
walletName: "Devnet Wallet",
spendingPassword: "SuperSecure777",
mnemonic: [
'habit',
'hope',
'tip',
'crystal',
'because',
'grunt',
'nation',
'idea',
'electric',
'witness',
'alert',
'like'
"habit",
"hope",
"tip",
"crystal",
"because",
"grunt",
"nation",
"idea",
"electric",
"witness",
"alert",
"like",
],
addressTruncated: 'B62qjsV6...ZEumXzxb'
addressTruncated: "B62qjsV6...ZEumXzxb",
}
2 changes: 1 addition & 1 deletion apps/extension/e2e/pom/base.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// https://playwright.dev/docs/pom
import { Page } from '@playwright/test'
import type { Page } from "@playwright/test"

export class BasePom {
readonly page: Page
Expand Down
52 changes: 26 additions & 26 deletions apps/extension/e2e/pom/onboarding.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { expect } from '../extension'
import { devnetWallet } from '../fixtures'
import { BasePom } from './base'
import { expect } from "../extension"
import { devnetWallet } from "../fixtures"
import { BasePom } from "./base"

const TestId = {
RESTORE_WALLET_BUTTON: 'onboarding__restoreWalletButton',
CREATE_WALLET_BUTTON: 'onboarding__createWalletButton',
WALLET_NAME_INPUT: 'onboarding__walletNameInput',
SPENDING_PASSWORD_INPUT: 'onboarding__spendingPasswordInput',
TOS_CHECKBOX: 'onboarding__tosCheckbox',
NEXT_BUTTON: 'onboarding__nextButton',
BACK_BUTTON: 'onboarding__backButton',
CONFIRM_ALONE: 'onboarding__confirmAlone',
MNEMONIC_FIELD: 'onboarding__mnemonicField',
ADDRESS_TRUNCATED: 'dashboard__addressTruncated',
MINA_BALANCE: 'dashboard__minaBalance',
MNEMONIC_WORD: 'onboarding__mnemonicWord',
MNEMONIC_WRITTEN_CHECKBOX: 'onboarding__mnemonicWrittenCheckbox',
MNEMONIC_WRITEDOWN_INDEX: 'onboarding__writedownIndex',
MNEMONIC_CONFIRMATION_INPUT: 'onboarding__mnemonicConfirmationInput'
RESTORE_WALLET_BUTTON: "onboarding__restoreWalletButton",
CREATE_WALLET_BUTTON: "onboarding__createWalletButton",
WALLET_NAME_INPUT: "onboarding__walletNameInput",
SPENDING_PASSWORD_INPUT: "onboarding__spendingPasswordInput",
TOS_CHECKBOX: "onboarding__tosCheckbox",
NEXT_BUTTON: "onboarding__nextButton",
BACK_BUTTON: "onboarding__backButton",
CONFIRM_ALONE: "onboarding__confirmAlone",
MNEMONIC_FIELD: "onboarding__mnemonicField",
ADDRESS_TRUNCATED: "dashboard__addressTruncated",
MINA_BALANCE: "dashboard__minaBalance",
MNEMONIC_WORD: "onboarding__mnemonicWord",
MNEMONIC_WRITTEN_CHECKBOX: "onboarding__mnemonicWrittenCheckbox",
MNEMONIC_WRITEDOWN_INDEX: "onboarding__writedownIndex",
MNEMONIC_CONFIRMATION_INPUT: "onboarding__mnemonicConfirmationInput",
} as const

export class OnboardingPom extends BasePom {
Expand All @@ -26,13 +26,13 @@ export class OnboardingPom extends BasePom {
}
startRestoring() {
const restoreWalletButton = this.page.getByTestId(
TestId.RESTORE_WALLET_BUTTON
TestId.RESTORE_WALLET_BUTTON,
)
return restoreWalletButton.click()
}
startCreating() {
const createWalletButton = this.page.getByTestId(
TestId.CREATE_WALLET_BUTTON
TestId.CREATE_WALLET_BUTTON,
)
return createWalletButton.click()
}
Expand All @@ -42,7 +42,7 @@ export class OnboardingPom extends BasePom {
}
fillSpendingPassword(spendingPassword: string) {
const spendingPasswordInput = this.page.getByTestId(
TestId.SPENDING_PASSWORD_INPUT
TestId.SPENDING_PASSWORD_INPUT,
)
return spendingPasswordInput.fill(spendingPassword)
}
Expand Down Expand Up @@ -84,20 +84,20 @@ export class OnboardingPom extends BasePom {
}
toggleMnemonicWritten() {
const mnemonicWritten = this.page.getByTestId(
TestId.MNEMONIC_WRITTEN_CHECKBOX
TestId.MNEMONIC_WRITTEN_CHECKBOX,
)
return mnemonicWritten.click()
}
async getMnemonicConfirmationIndex() {
const inputLabel = await this.page
.getByTestId(TestId.MNEMONIC_WRITEDOWN_INDEX)
.innerText()
const [, confirmationIndex] = inputLabel.split('#')
return parseInt(confirmationIndex) - 1
const [, confirmationIndex] = inputLabel.split("#")
return Number.parseInt(confirmationIndex) - 1
}
fillMnemonicConfirmation(specificWord: string) {
const mnemonicConfirmationInput = this.page.getByTestId(
TestId.MNEMONIC_CONFIRMATION_INPUT
TestId.MNEMONIC_CONFIRMATION_INPUT,
)
return mnemonicConfirmationInput.fill(specificWord)
}
Expand All @@ -116,7 +116,7 @@ export class OnboardingPom extends BasePom {
await this.confirmAlone()
await this.fillMnemonic(devnetWallet.mnemonic)
await this.goNext()
const pageTitle = this.page.getByText('Stay Connected')
const pageTitle = this.page.getByText("Stay Connected")
await pageTitle.waitFor()
await this.goNext()
}
Expand Down
Loading

0 comments on commit 13374b0

Please sign in to comment.