Commit 79871afe authored by isstuev's avatar isstuev

fixes

parent 1e3183d4
...@@ -22,6 +22,11 @@ For local development please follow next steps: ...@@ -22,6 +22,11 @@ For local development please follow next steps:
- create local env file `.env.local` according to `.env.example` snapshot (see list of used environment variables [below](#environment-variables)) - create local env file `.env.local` according to `.env.example` snapshot (see list of used environment variables [below](#environment-variables))
- run `yarn dev` to spin up local dev server and navigate to the host from logs output - run `yarn dev` to spin up local dev server and navigate to the host from logs output
## Components visual testing
We use [playwright experimental components testing](https://playwright.dev/docs/test-components) for visual (screenshots) CI check. Test renders a single component in headless browser in docker, generates screenshots and then compares this screenshot with a reference one.
To perform testing locally you need to install docker and run `yarn test-docker`
## Environment variables ## Environment variables
### Variables list ### Variables list
The app instance could be customized by passing following variables to NodeJS environment. The app instance could be customized by passing following variables to NodeJS environment.
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
"prepare": "husky install", "prepare": "husky install",
"format-svg": "./node_modules/.bin/svgo -r ./icons", "format-svg": "./node_modules/.bin/svgo -r ./icons",
"test-ct": "playwright test -c playwright-ct.config.ts", "test-ct": "playwright test -c playwright-ct.config.ts",
"test-docker": " docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.26.0-focal yarn test-ct" "test-docker": "docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.26.0-focal ./run-tests.sh"
}, },
"dependencies": { "dependencies": {
"@chakra-ui/react": "2.3.1", "@chakra-ui/react": "2.3.1",
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
"next": "12.2.5", "next": "12.2.5",
"next-react-svg": "1.1.3", "next-react-svg": "1.1.3",
"node-fetch": "^3.2.9", "node-fetch": "^3.2.9",
"playwright": "^1.26.1",
"react": "18.1.0", "react": "18.1.0",
"react-dom": "18.1.0", "react-dom": "18.1.0",
"react-hook-form": "^7.33.1", "react-hook-form": "^7.33.1",
...@@ -56,6 +55,7 @@ ...@@ -56,6 +55,7 @@
"eslint-plugin-regexp": "^1.7.0", "eslint-plugin-regexp": "^1.7.0",
"husky": "^8.0.0", "husky": "^8.0.0",
"lint-staged": ">=10", "lint-staged": ">=10",
"playwright": "^1.26.1",
"svgo": "^2.8.0", "svgo": "^2.8.0",
"typescript": "4.7.2" "typescript": "4.7.2"
}, },
......
...@@ -2,7 +2,7 @@ import { ChakraProvider } from '@chakra-ui/react'; ...@@ -2,7 +2,7 @@ import { ChakraProvider } from '@chakra-ui/react';
import type { ColorMode } from '@chakra-ui/react'; import type { ColorMode } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import theme from '../../theme'; import theme from '../theme';
type Props = { type Props = {
children: React.ReactNode; children: React.ReactNode;
......
#!/bin/sh
yarn install
yarn test-ct
\ No newline at end of file
import { test, expect } from '@playwright/experimental-ct-react'; import { test, expect } from '@playwright/experimental-ct-react';
import React from 'react'; import React from 'react';
import RenderWithChakra from '../test-helpers/RenderWithChakra'; import RenderWithChakra from '../../playwright/RenderWithChakra';
import Utilization from './Utilization'; import Utilization from './Utilization';
test.use({ viewport: { width: 100, height: 50 } }); test.use({ viewport: { width: 100, height: 50 } });
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment