From 4ee6b47c0d1871f498f8a07bc701e7e28f1931fa Mon Sep 17 00:00:00 2001 From: Ben Kremer Date: Fri, 12 Jan 2024 15:08:29 +0100 Subject: [PATCH 1/3] style: prettier auto format --- .github/workflows/playwright.yml | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index e18764d9..6b8a4e52 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -1,29 +1,29 @@ name: Playwright Tests on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: test: timeout-minutes: 10 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install dependencies - run: yarn - - name: Install Playwright Browsers - run: yarn playwright:install - - name: Run Playwright tests - run: yarn playwright:test - env: - VITE_PROJECT_ID: ${{ secrets.VITE_DEV_PROJECT_ID }} - - uses: actions/upload-artifact@v3 - if: always() - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install dependencies + run: yarn + - name: Install Playwright Browsers + run: yarn playwright:install + - name: Run Playwright tests + run: yarn playwright:test + env: + VITE_PROJECT_ID: ${{ secrets.VITE_DEV_PROJECT_ID }} + - uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 From f2893a5bd719206fd852033fe1983c378070abbb Mon Sep 17 00:00:00 2001 From: Ben Kremer Date: Fri, 12 Jan 2024 15:14:18 +0100 Subject: [PATCH 2/3] ci: expand checks to include prettier and eslint --- .github/workflows/{playwright.yml => ci.yml} | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) rename .github/workflows/{playwright.yml => ci.yml} (78%) diff --git a/.github/workflows/playwright.yml b/.github/workflows/ci.yml similarity index 78% rename from .github/workflows/playwright.yml rename to .github/workflows/ci.yml index 6b8a4e52..779808a7 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,11 @@ -name: Playwright Tests +name: CI Checks on: push: branches: [main] pull_request: branches: [main] jobs: - test: + code_checks: timeout-minutes: 10 runs-on: ubuntu-latest steps: @@ -13,9 +13,17 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 + - name: Install dependencies run: yarn - - name: Install Playwright Browsers + + - name: Prettier + run: npm run prettier + + - name: ESLint + run: npm run lint + + - name: Install Playwright browsers run: yarn playwright:install - name: Run Playwright tests run: yarn playwright:test From 630290ea0f147241b5f1aa5beb383b7cca5c96ea Mon Sep 17 00:00:00 2001 From: Ben Kremer Date: Fri, 12 Jan 2024 15:18:03 +0100 Subject: [PATCH 3/3] chore: apply all prettier fixes --- playwright.config.ts | 20 ++++++++++---------- src/constants/projects.ts | 3 ++- src/contexts/W3iContext/hooks/notifyHooks.ts | 12 ++++++------ tests/home.spec.ts | 14 +++++++------- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/playwright.config.ts b/playwright.config.ts index bf777b37..121b6501 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,4 +1,4 @@ -import { defineConfig, devices } from '@playwright/test'; +import { defineConfig, devices } from '@playwright/test' /** * Read environment variables from file. @@ -6,7 +6,7 @@ import { defineConfig, devices } from '@playwright/test'; */ // require('dotenv').config(); -const baseURL = 'http://localhost:5173'; +const baseURL = 'http://localhost:5173' /** * See https://playwright.dev/docs/test-configuration. @@ -31,25 +31,25 @@ export default defineConfig({ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', - screenshot: 'only-on-failure', + screenshot: 'only-on-failure' }, /* Configure projects for major browsers */ projects: [ { name: 'chromium', - use: { ...devices['Desktop Chrome'] }, + use: { ...devices['Desktop Chrome'] } }, { name: 'firefox', - use: { ...devices['Desktop Firefox'] }, + use: { ...devices['Desktop Firefox'] } }, { name: 'webkit', - use: { ...devices['Desktop Safari'] }, - }, + use: { ...devices['Desktop Safari'] } + } /* Test against mobile viewports. */ // { @@ -76,6 +76,6 @@ export default defineConfig({ webServer: { command: 'yarn dev', url: baseURL, - reuseExistingServer: !process.env.CI, - }, -}); + reuseExistingServer: !process.env.CI + } +}) diff --git a/src/constants/projects.ts b/src/constants/projects.ts index 6d5a95bf..6d8f2dd7 100644 --- a/src/constants/projects.ts +++ b/src/constants/projects.ts @@ -35,7 +35,8 @@ export const COMING_SOON_PROJECTS: Array = [ { id: 'chainspot', name: 'Chainspot', - description: 'Bridge&swap across 27 chains at the best rates and research data about 100+ Web3 products.', + description: + 'Bridge&swap across 27 chains at the best rates and research data about 100+ Web3 products.', url: 'https://app.chainspot.io/', isComingSoon: true, isVerified: false, diff --git a/src/contexts/W3iContext/hooks/notifyHooks.ts b/src/contexts/W3iContext/hooks/notifyHooks.ts index 18f6656e..eef682f5 100644 --- a/src/contexts/W3iContext/hooks/notifyHooks.ts +++ b/src/contexts/W3iContext/hooks/notifyHooks.ts @@ -51,15 +51,15 @@ export const useNotifyState = (w3iProxy: Web3InboxProxy, proxyReady: boolean) => * load in progress state using interval until it is */ useEffect(() => { - if(watchSubscriptionsComplete) { - return noop; + if (watchSubscriptionsComplete) { + return noop } // Account for sync init const intervalId = setInterval(() => { - if (notifyClient?.hasFinishedInitialLoad()) { - setWatchSubscriptionsComplete(true) - return noop; - } + if (notifyClient?.hasFinishedInitialLoad()) { + setWatchSubscriptionsComplete(true) + return noop + } refreshNotifyState() }, 100) diff --git a/tests/home.spec.ts b/tests/home.spec.ts index cd7d9cee..417eef13 100644 --- a/tests/home.spec.ts +++ b/tests/home.spec.ts @@ -1,11 +1,11 @@ -import { test, expect } from '@playwright/test'; +import { expect, test } from '@playwright/test' test('has title', async ({ page }) => { - await page.goto("/"); - await expect(page).toHaveTitle(/Web3Inbox/); -}); + await page.goto('/') + await expect(page).toHaveTitle(/Web3Inbox/) +}) test('welcome message', async ({ page }) => { - await page.goto("/"); - await expect(page.getByText("Welcome to Web3Inbox")).toBeVisible(); -}); + await page.goto('/') + await expect(page.getByText('Welcome to Web3Inbox')).toBeVisible() +})