diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..779808a7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI Checks +on: + push: + branches: [main] + pull_request: + branches: [main] +jobs: + code_checks: + 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: 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 + 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 diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml deleted file mode 100644 index e18764d9..00000000 --- a/.github/workflows/playwright.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Playwright Tests -on: - push: - branches: [ main ] - pull_request: - 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 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<INotifyApp> = [ { 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() +})