Skip to content
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

ci: expand checks to include prettier and eslint #389

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();

Check failure on line 7 in playwright.config.ts

View workflow job for this annotation

GitHub Actions / code_checks

Comments should not begin with a lowercase character

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

/**
* See https://playwright.dev/docs/test-configuration.
Expand All @@ -16,7 +16,7 @@
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,

Check failure on line 19 in playwright.config.ts

View workflow job for this annotation

GitHub Actions / code_checks

use `Boolean(process.env.CI)` instead
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
Expand All @@ -31,40 +31,40 @@
/* 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. */
// {

Check failure on line 55 in playwright.config.ts

View workflow job for this annotation

GitHub Actions / code_checks

Expected a block comment instead of consecutive line comments
// name: 'Mobile Chrome',

Check failure on line 56 in playwright.config.ts

View workflow job for this annotation

GitHub Actions / code_checks

Comments should not begin with a lowercase character
// use: { ...devices['Pixel 5'] },

Check failure on line 57 in playwright.config.ts

View workflow job for this annotation

GitHub Actions / code_checks

Comments should not begin with a lowercase character
// },
// {
// name: 'Mobile Safari',

Check failure on line 60 in playwright.config.ts

View workflow job for this annotation

GitHub Actions / code_checks

Comments should not begin with a lowercase character
// use: { ...devices['iPhone 12'] },

Check failure on line 61 in playwright.config.ts

View workflow job for this annotation

GitHub Actions / code_checks

Comments should not begin with a lowercase character
// },

/* Test against branded browsers. */
// {

Check failure on line 65 in playwright.config.ts

View workflow job for this annotation

GitHub Actions / code_checks

Expected a block comment instead of consecutive line comments
// name: 'Microsoft Edge',

Check failure on line 66 in playwright.config.ts

View workflow job for this annotation

GitHub Actions / code_checks

Comments should not begin with a lowercase character
// use: { ...devices['Desktop Edge'], channel: 'msedge' },

Check failure on line 67 in playwright.config.ts

View workflow job for this annotation

GitHub Actions / code_checks

Comments should not begin with a lowercase character
// },
// {
// name: 'Google Chrome',
Expand All @@ -76,6 +76,6 @@
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()
})
Loading