Skip to content

ci: expand checks to include prettier and eslint #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
29 changes: 0 additions & 29 deletions .github/workflows/playwright.yml

This file was deleted.

20 changes: 10 additions & 10 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { defineConfig, devices } from '@playwright/test';
import { defineConfig, devices } from '@playwright/test'

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

const baseURL = 'http://localhost:5173';
const baseURL = 'http://localhost:5173'

/**
* See https://playwright.dev/docs/test-configuration.
Expand All @@ -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. */
// {
Expand All @@ -76,6 +76,6 @@ export default defineConfig({
webServer: {
command: 'yarn dev',
url: baseURL,
reuseExistingServer: !process.env.CI,
},
});
reuseExistingServer: !process.env.CI
}
})
3 changes: 2 additions & 1 deletion src/constants/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions src/contexts/W3iContext/hooks/notifyHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
14 changes: 7 additions & 7 deletions tests/home.spec.ts
Original file line number Diff line number Diff line change
@@ -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()
})