Skip to content

Commit

Permalink
Prepare workflow to run on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
gnapse committed Dec 29, 2022
1 parent c7ef7dc commit 32dd32f
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
playwright-ct.config.ts
playwright/

lint-staged.config.js
jest.config.js
babel.config.js

coverage/
dist/
docs/
Expand Down
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
{
"files": ["*.spec.*"],
"rules": {
"import/no-unresolved": "off",
"jest/no-standalone-expect": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off"
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/visual-regression-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Visual Regression Tests

on: pull_request

jobs:
visual-regression-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker Compose Action
uses: isbang/compose-action@v1.4.1
with:
up-flags: "--exit-code-from playwright --abort-on-container-exit"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ RUN apt-get update && apt-get -y install libnss3 libatk-bridge2.0-0 libdrm-dev l

WORKDIR /app
COPY package.json .
RUN npm install
RUN npm install --quiet
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
collectCoverageFrom: [
'src/**/*.{ts,tsx,js,jsx}',
'!**/*.spec.{js,jsx,ts,tsx}',
'!**/*.stories.{js,jsx,ts,tsx}',
'!**/*storybook*.{js,jsx,ts,tsx}',
],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"scripts": {
"postinstall": "patch-package",
"setup": "npm install && npm run validate",
"validate": "npm run lint && npm run type-check && npm run test",
"validate": "npm run lint && npm run type-check && npm run test && npm run visual-tests",
"start": "tsdx watch --onSuccess \"./scripts/organize-styles.sh\"",
"build-all": "npm run build && npm run build:storybook",
"build": "scripts/build.sh",
Expand All @@ -41,7 +41,7 @@
"storybook": "start-storybook -p 6006",
"prettify": "prettier --write \"./**/*.{js,jsx,ts,tsx,json,css,scss,less,md,mdx}\"",
"test-ct": "playwright test -c playwright-ct.config.ts",
"visual-tests": "docker compose up"
"visual-tests": "docker compose up --exit-code-from playwright"
},
"peerDependencies": {
"classnames": "^2.2.5",
Expand Down
22 changes: 18 additions & 4 deletions playwright-ct.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { PlaywrightTestConfig } from '@playwright/experimental-ct-react'
import { devices } from '@playwright/experimental-ct-react'

import type { PlaywrightTestConfig } from '@playwright/experimental-ct-react'

/**
* See https://playwright.dev/docs/test-configuration.
*/
Expand Down Expand Up @@ -32,9 +33,22 @@ const config: PlaywrightTestConfig = {

/* Configure projects for major browsers */
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
{ name: 'webkit', use: { ...devices['Desktop Safari'] } },
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},

//
// Firefox tests are disabled, hopefully temporarily. For some reason they only work when
// running tests locally on macOS, but they get stuck without failing or passing when
// running locally on Windows, or when tests are run on CI.
//
// { name: 'firefox', use: { ...devices['Desktop Firefox'] } },
],
}

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"extends": "@doist/tsconfig",
"include": ["src", "types", "*.config.ts", "playwright"],
"include": ["src", "types"],
"compilerOptions": {
"allowJs": true,
"module": "esnext",
"lib": ["dom", "esnext"],
"importHelpers": true,
"declaration": true,
"sourceMap": true,
"rootDir": "./",
"rootDir": "src",
"noUnusedLocals": true,
"noUnusedParameters": true,
"moduleResolution": "node",
Expand Down

0 comments on commit 32dd32f

Please sign in to comment.