diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f97943e91..760eefd2d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,3 +40,29 @@ jobs: - name: Unit Tests run: npm run test + test_component: + name: Test component + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: npm + - name: Install Packages + run: npm ci + - name: Install Playwright browsers + run: npm run playwright:install + - name: Run Playwright tests + run: npm run test:component + env: + CI: 'true' + - name: Upload Playwright playwright report to GitHub Actions Artifacts + if: always() + uses: actions/upload-artifact@v3 + with: + name: playwright-reports + path: playwright-report/index.html + retention-days: 1 diff --git a/.gitignore b/.gitignore index 041b12c0fe..bac27765e3 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ node_modules /build /styles/**/*.css /coverage +/test-component/playwright/.cache +/playwright-report \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5f06b581c4..d4fcf95586 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,6 +37,8 @@ "@gravity-ui/prettier-config": "^1.0.1", "@gravity-ui/stylelint-config": "^2.0.0", "@gravity-ui/tsconfig": "^1.0.0", + "@playwright/experimental-ct-react": "^1.38.1", + "@playwright/test": "^1.38.1", "@storybook/addon-essentials": "^7.3.2", "@storybook/cli": "^7.3.2", "@storybook/preset-scss": "^1.0.3", @@ -54,6 +56,7 @@ "@types/react-transition-group": "^4.4.6", "@types/react-virtualized-auto-sizer": "^1.0.1", "@types/react-window": "^1.8.5", + "@vitejs/plugin-react": "^4.1.0", "chroma-js": "^2.4.2", "cross-env": "^7.0.3", "eslint": "^8.47.0", @@ -127,12 +130,12 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.10.tgz", - "integrity": "sha512-/KKIMG4UEL35WmI9OlvMhurwtytjvXoFcGNrOvyG9zIzA8YmPjVtIZUf7b05+TPO7G7/GEmLHDaoCgACHl9hhA==", + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", "dev": true, "dependencies": { - "@babel/highlight": "^7.22.10", + "@babel/highlight": "^7.22.13", "chalk": "^2.4.2" }, "engines": { @@ -197,12 +200,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.10.tgz", - "integrity": "sha512-79KIf7YiWjjdZ81JnLujDRApWtl7BxTqWD88+FFdQEIOG8LJ0etDOM7CXuIgGJa55sGOwZVwuEsaLEm0PJ5/+A==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "dev": true, "dependencies": { - "@babel/types": "^7.22.10", + "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -236,13 +239,13 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.10.tgz", - "integrity": "sha512-JMSwHD4J7SLod0idLq5PKgI+6g/hLD/iuWBq08ZX49xE14VpVEojJ5rHWptpirV2j020MvypRLAXAO50igCJ5Q==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz", + "integrity": "sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==", "dev": true, "dependencies": { "@babel/compat-data": "^7.22.9", - "@babel/helper-validator-option": "^7.22.5", + "@babel/helper-validator-option": "^7.22.15", "browserslist": "^4.21.9", "lru-cache": "^5.1.1", "semver": "^6.3.1" @@ -251,15 +254,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/helper-compilation-targets/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/@babel/helper-create-class-features-plugin": { "version": "7.22.10", "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.10.tgz", @@ -283,15 +277,6 @@ "@babel/core": "^7.0.0" } }, - "node_modules/@babel/helper-create-class-features-plugin/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/@babel/helper-create-regexp-features-plugin": { "version": "7.22.9", "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.22.9.tgz", @@ -309,15 +294,6 @@ "@babel/core": "^7.0.0" } }, - "node_modules/@babel/helper-create-regexp-features-plugin/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/@babel/helper-define-polyfill-provider": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.2.tgz", @@ -335,22 +311,22 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz", - "integrity": "sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-function-name": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz", - "integrity": "sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "dependencies": { - "@babel/template": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" @@ -381,28 +357,28 @@ } }, "node_modules/@babel/helper-module-imports": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.5.tgz", - "integrity": "sha512-8Dl6+HD/cKifutF5qGd/8ZJi84QeAKh+CEe1sBzz8UayBBGg1dAIJrdHOcOM5b2MpzWL2yuotJTtGjETq0qjXg==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", + "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", "dev": true, "dependencies": { - "@babel/types": "^7.22.5" + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.22.9", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.9.tgz", - "integrity": "sha512-t+WA2Xn5K+rTeGtC8jCsdAH52bjggG5TKRuRrAGNM/mjIbO4GxvlLMFOEz9wXY5I2XQ60PMFsAG2WIcG82dQMQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.0.tgz", + "integrity": "sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==", "dev": true, "dependencies": { - "@babel/helper-environment-visitor": "^7.22.5", - "@babel/helper-module-imports": "^7.22.5", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-module-imports": "^7.22.15", "@babel/helper-simple-access": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/helper-validator-identifier": "^7.22.5" + "@babel/helper-validator-identifier": "^7.22.20" }, "engines": { "node": ">=6.9.0" @@ -512,18 +488,18 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", - "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz", - "integrity": "sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz", + "integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==", "dev": true, "engines": { "node": ">=6.9.0" @@ -544,26 +520,26 @@ } }, "node_modules/@babel/helpers": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.10.tgz", - "integrity": "sha512-a41J4NW8HyZa1I1vAndrraTlPZ/eZoga2ZgS7fEr0tZJGVU4xqdE80CEm0CcNjha5EZ8fTBYLKHF0kqDUuAwQw==", + "version": "7.23.1", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.1.tgz", + "integrity": "sha512-chNpneuK18yW5Oxsr+t553UZzzAs3aZnFm4bxhebsNTeshrC95yA7l5yl7GBAG+JG1rF0F7zzD2EixK9mWSDoA==", "dev": true, "dependencies": { - "@babel/template": "^7.22.5", - "@babel/traverse": "^7.22.10", - "@babel/types": "^7.22.10" + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.0", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.10.tgz", - "integrity": "sha512-78aUtVcT7MUscr0K5mIEnkwxPE0MaxkR5RxRwuHaQ+JuU5AmTPhY+do2mdzVTnIJJpyBglql2pehuBIWHug+WQ==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, @@ -572,9 +548,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.10.tgz", - "integrity": "sha512-lNbdGsQb9ekfsnjFGhEiF4hfFqGgfOP3H3d27re3n+CGhNuTSUEQdfWk556sTLNTloczcdM5TYF2LhzmDQKyvQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -1635,6 +1611,36 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.22.5.tgz", + "integrity": "sha512-nTh2ogNUtxbiSbxaT4Ds6aXnXEipHweN9YRgOX/oNXdf0cCrGn/+2LozFa3lnPV5D90MkjhgckCPBrsoSc1a7g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.22.5.tgz", + "integrity": "sha512-yIiRO6yobeEIaI0RTbIr8iAK9FcBHLtZq0S89ZPjDLQXBA4xvghaKqI0etp/tF3htTM0sazJKKLz9oEiGRtu7w==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-transform-react-pure-annotations": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.22.5.tgz", @@ -1933,15 +1939,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/preset-env/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/@babel/preset-flow": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/preset-flow/-/preset-flow-7.22.5.tgz", @@ -2186,33 +2183,33 @@ } }, "node_modules/@babel/template": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.5.tgz", - "integrity": "sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.22.5", - "@babel/parser": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.10.tgz", - "integrity": "sha512-Q/urqV4pRByiNNpb/f5OSv28ZlGJiFiiTh+GAHktbIrkPhPbl90+uW6SmpoLyZqutrg9AEaEf3Q/ZBRHBXgxig==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.0.tgz", + "integrity": "sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.22.10", - "@babel/generator": "^7.22.10", - "@babel/helper-environment-visitor": "^7.22.5", - "@babel/helper-function-name": "^7.22.5", + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.22.10", - "@babel/types": "^7.22.10", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -2221,13 +2218,13 @@ } }, "node_modules/@babel/types": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.10.tgz", - "integrity": "sha512-obaoigiLrlDZ7TUQln/8m4mSqIW2QFeOrCQc9r+xsaHGNoplVNYlRVpsfE8Vj35GEm2ZH4ZhrNYogs/3fj85kg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": { @@ -4372,6 +4369,54 @@ "node": ">=14" } }, + "node_modules/@playwright/experimental-ct-core": { + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/@playwright/experimental-ct-core/-/experimental-ct-core-1.38.1.tgz", + "integrity": "sha512-2EzqzwBJty08elQonIXrQxUd8HKL7dHLJ2T/dJTmgVFwGsnJYsnU03EUlKlatUfajMYVC7xGT+Bqhur2hJPC3A==", + "dev": true, + "dependencies": { + "playwright": "1.38.1", + "playwright-core": "1.38.1", + "vite": "^4.3.9" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@playwright/experimental-ct-react": { + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/@playwright/experimental-ct-react/-/experimental-ct-react-1.38.1.tgz", + "integrity": "sha512-V5Eu28jrF8Vd3/dvweJaewa49MrnAOQdR3U24j3gu8oj7SNS6lWv09pioZVTI8cBj3yKCSX1Bcq8Vd2bSGYtOg==", + "dev": true, + "dependencies": { + "@playwright/experimental-ct-core": "1.38.1", + "@vitejs/plugin-react": "^4.0.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@playwright/test": { + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.38.1.tgz", + "integrity": "sha512-NqRp8XMwj3AK+zKLbZShl0r/9wKgzqI/527bkptKXomtuo+dOjU9NdMASQ8DNC9z9zLOMbG53T4eihYr3XR+BQ==", + "dev": true, + "dependencies": { + "playwright": "1.38.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/@pmmmwh/react-refresh-webpack-plugin": { "version": "0.5.11", "resolved": "https://registry.npmjs.org/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.5.11.tgz", @@ -5953,15 +5998,6 @@ "url": "https://opencollective.com/babel" } }, - "node_modules/@storybook/codemod/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/@storybook/components": { "version": "7.3.2", "resolved": "https://registry.npmjs.org/@storybook/components/-/components-7.3.2.tgz", @@ -7281,9 +7317,9 @@ "dev": true }, "node_modules/@types/babel__core": { - "version": "7.20.1", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz", - "integrity": "sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.2.tgz", + "integrity": "sha512-pNpr1T1xLUc2l3xJKuPtsEky3ybxN3m4fJkknfIpTCTfIZCDW57oAg+EfCgIIp2rvCe0Wn++/FfodDS4YXxBwA==", "dev": true, "dependencies": { "@babel/parser": "^7.20.7", @@ -8076,6 +8112,70 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@vitejs/plugin-react": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.1.0.tgz", + "integrity": "sha512-rM0SqazU9iqPUraQ2JlIvReeaxOoRj6n+PzB1C0cBzIbd8qP336nC39/R9yPi3wVcah7E7j/kdU1uCUqMEU4OQ==", + "dev": true, + "dependencies": { + "@babel/core": "^7.22.20", + "@babel/plugin-transform-react-jsx-self": "^7.22.5", + "@babel/plugin-transform-react-jsx-source": "^7.22.5", + "@types/babel__core": "^7.20.2", + "react-refresh": "^0.14.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "vite": "^4.2.0" + } + }, + "node_modules/@vitejs/plugin-react/node_modules/@babel/core": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.0.tgz", + "integrity": "sha512-97z/ju/Jy1rZmDxybphrBuI+jtJjFVoz7Mr9yUQVVVi+DNZE333uFQeMOqcCIy1x3WYBIbWftUSLmbNXNT7qFQ==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-compilation-targets": "^7.22.15", + "@babel/helper-module-transforms": "^7.23.0", + "@babel/helpers": "^7.23.0", + "@babel/parser": "^7.23.0", + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.0", + "@babel/types": "^7.23.0", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@vitejs/plugin-react/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, + "node_modules/@vitejs/plugin-react/node_modules/react-refresh": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.0.tgz", + "integrity": "sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@webassemblyjs/ast": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", @@ -9313,15 +9413,6 @@ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, - "node_modules/babel-plugin-polyfill-corejs2/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/babel-plugin-polyfill-corejs3": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.3.tgz", @@ -21159,6 +21250,36 @@ "node": ">=10" } }, + "node_modules/playwright": { + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.38.1.tgz", + "integrity": "sha512-oRMSJmZrOu1FP5iu3UrCx8JEFRIMxLDM0c/3o4bpzU5Tz97BypefWf7TuTNPWeCe279TPal5RtPPZ+9lW/Qkow==", + "dev": true, + "dependencies": { + "playwright-core": "1.38.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.38.1.tgz", + "integrity": "sha512-tQqNFUKa3OfMf4b2jQ7aGLB8o9bS3bOY0yMEtldtC2+spf8QXG9zvXLTXUeRsoNuxEYMgLYR+NXfAa1rjKRcrg==", + "dev": true, + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/plugin-error": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz", @@ -22791,6 +22912,22 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rollup": { + "version": "3.29.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", + "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=14.18.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -22965,9 +23102,9 @@ "dev": true }, "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -25969,6 +26106,61 @@ "source-map": "^0.5.1" } }, + "node_modules/vite": { + "version": "4.4.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.11.tgz", + "integrity": "sha512-ksNZJlkcU9b0lBwAGZGGaZHCMqHsc8OpgtoYhsQ4/I2v5cnpmmmqe5pM4nv/4Hn6G/2GhTdj0DhZh2e+Er1q5A==", + "dev": true, + "dependencies": { + "esbuild": "^0.18.10", + "postcss": "^8.4.27", + "rollup": "^3.27.1" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "@types/node": ">= 14", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, "node_modules/w3c-xmlserializer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", diff --git a/package.json b/package.json index fc9cbad641..2dec2e7adf 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,10 @@ "lint:prettier:fix": "prettier --write '**/*.md'", "lint": "run-p lint:*", "typecheck": "tsc --noEmit", - "prepublishOnly": "npm run build" + "prepublishOnly": "npm run build", + "playwright:install": "playwright install --with-deps", + "test:component": "playwright test --config=test-component/playwright.config.ts", + "test:component:update": "npm run test:component -- -u" }, "dependencies": { "@bem-react/classname": "^1.6.0", @@ -103,6 +106,8 @@ "@gravity-ui/prettier-config": "^1.0.1", "@gravity-ui/stylelint-config": "^2.0.0", "@gravity-ui/tsconfig": "^1.0.0", + "@playwright/experimental-ct-react": "^1.38.1", + "@playwright/test": "^1.38.1", "@storybook/addon-essentials": "^7.3.2", "@storybook/cli": "^7.3.2", "@storybook/preset-scss": "^1.0.3", @@ -120,6 +125,7 @@ "@types/react-transition-group": "^4.4.6", "@types/react-virtualized-auto-sizer": "^1.0.1", "@types/react-window": "^1.8.5", + "@vitejs/plugin-react": "^4.1.0", "chroma-js": "^2.4.2", "cross-env": "^7.0.3", "eslint": "^8.47.0", @@ -162,4 +168,4 @@ "prettier --write" ] } -} +} \ No newline at end of file diff --git a/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx new file mode 100644 index 0000000000..112068464b --- /dev/null +++ b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx @@ -0,0 +1,37 @@ +import React from 'react'; + +import {expect, test} from '@playwright/experimental-ct-react'; + +import {ArrowToggle} from '../ArrowToggle'; + +test.describe('ArrowToggle', () => { + test('render ArrowToggle by default', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('render ArrowToggle by direction top ', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('render ArrowToggle by direction left ', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('render ArrowToggle by direction bottom ', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('render ArrowToggle by direction right ', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); +}); diff --git a/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-default-1-chromium-darwin.png b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-default-1-chromium-darwin.png new file mode 100644 index 0000000000..886fda8efc Binary files /dev/null and b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-default-1-chromium-darwin.png differ diff --git a/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-default-1-webkit-darwin.png b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-default-1-webkit-darwin.png new file mode 100644 index 0000000000..e93f95b003 Binary files /dev/null and b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-default-1-webkit-darwin.png differ diff --git a/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-bottom-1-chromium-darwin.png b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-bottom-1-chromium-darwin.png new file mode 100644 index 0000000000..886fda8efc Binary files /dev/null and b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-bottom-1-chromium-darwin.png differ diff --git a/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-bottom-1-webkit-darwin.png b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-bottom-1-webkit-darwin.png new file mode 100644 index 0000000000..e93f95b003 Binary files /dev/null and b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-bottom-1-webkit-darwin.png differ diff --git a/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-left-1-chromium-darwin.png b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-left-1-chromium-darwin.png new file mode 100644 index 0000000000..c3fcc5945b Binary files /dev/null and b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-left-1-chromium-darwin.png differ diff --git a/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-left-1-webkit-darwin.png b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-left-1-webkit-darwin.png new file mode 100644 index 0000000000..d58377b266 Binary files /dev/null and b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-left-1-webkit-darwin.png differ diff --git a/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-right-1-chromium-darwin.png b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-right-1-chromium-darwin.png new file mode 100644 index 0000000000..c5d468ba66 Binary files /dev/null and b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-right-1-chromium-darwin.png differ diff --git a/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-right-1-webkit-darwin.png b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-right-1-webkit-darwin.png new file mode 100644 index 0000000000..86d1b2e70f Binary files /dev/null and b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-right-1-webkit-darwin.png differ diff --git a/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-top-1-chromium-darwin.png b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-top-1-chromium-darwin.png new file mode 100644 index 0000000000..5b024ff4cd Binary files /dev/null and b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-top-1-chromium-darwin.png differ diff --git a/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-top-1-webkit-darwin.png b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-top-1-webkit-darwin.png new file mode 100644 index 0000000000..dcd766e587 Binary files /dev/null and b/src/components/ArrowToggle/__component__/ArrowToggle.spec.tsx-snapshots/ArrowToggle-render-ArrowToggle-by-direction-top-1-webkit-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx b/src/components/Button/__component__/Button.spec.tsx new file mode 100644 index 0000000000..a785b782c9 --- /dev/null +++ b/src/components/Button/__component__/Button.spec.tsx @@ -0,0 +1,104 @@ +import React from 'react'; + +import {Gear} from '@gravity-ui/icons'; +import {expect, test} from '@playwright/experimental-ct-react'; + +import {Button} from '../Button'; + +import {ButtonIcon, ButtonWitchIcon} from './ButtonHelpers'; + +test.describe('Button', () => { + test('render buttom by default', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('should render icon', async ({mount}) => { + const component = await mount( + , + ); + + await expect(component).toHaveScreenshot(); + }); + + test('should render icon in Button.Icon', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('selected when selected=true prop is given', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('loading when loading=true prop is given', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('should render tag', async ({mount}) => { + const href = 'https://yandex.ru'; + const target = '_blank'; + + const component = await mount( + , + ); + + await expect(component).toHaveScreenshot(); + }); + + test('render with given submit type', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('render with given reset type', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('show given content', async ({mount}) => { + const content = 'Some content'; + + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('show given children', async ({mount}) => { + const childrenText = 'Children content'; + + const component = await mount( + , + ); + + await expect(component).toHaveScreenshot(); + }); + + test('add style', async ({mount}) => { + const style = {color: 'red'}; + + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('should render Icon component', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); +}); diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-add-style-1-chromium-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-add-style-1-chromium-darwin.png new file mode 100644 index 0000000000..220498becb Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-add-style-1-chromium-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-add-style-1-webkit-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-add-style-1-webkit-darwin.png new file mode 100644 index 0000000000..7974bb0035 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-add-style-1-webkit-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-loading-when-loading-true-prop-is-given-1-chromium-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-loading-when-loading-true-prop-is-given-1-chromium-darwin.png new file mode 100644 index 0000000000..8257f1bdf4 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-loading-when-loading-true-prop-is-given-1-chromium-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-loading-when-loading-true-prop-is-given-1-webkit-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-loading-when-loading-true-prop-is-given-1-webkit-darwin.png new file mode 100644 index 0000000000..6947dbe3ba Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-loading-when-loading-true-prop-is-given-1-webkit-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-buttom-by-default-1-chromium-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-buttom-by-default-1-chromium-darwin.png new file mode 100644 index 0000000000..6848e00fc5 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-buttom-by-default-1-chromium-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-buttom-by-default-1-webkit-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-buttom-by-default-1-webkit-darwin.png new file mode 100644 index 0000000000..e6825c7897 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-buttom-by-default-1-webkit-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-with-given-reset-type-1-chromium-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-with-given-reset-type-1-chromium-darwin.png new file mode 100644 index 0000000000..6848e00fc5 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-with-given-reset-type-1-chromium-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-with-given-reset-type-1-webkit-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-with-given-reset-type-1-webkit-darwin.png new file mode 100644 index 0000000000..e6825c7897 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-with-given-reset-type-1-webkit-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-with-given-submit-type-1-chromium-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-with-given-submit-type-1-chromium-darwin.png new file mode 100644 index 0000000000..6848e00fc5 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-with-given-submit-type-1-chromium-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-with-given-submit-type-1-webkit-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-with-given-submit-type-1-webkit-darwin.png new file mode 100644 index 0000000000..e6825c7897 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-render-with-given-submit-type-1-webkit-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-selected-when-selected-true-prop-is-given-1-chromium-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-selected-when-selected-true-prop-is-given-1-chromium-darwin.png new file mode 100644 index 0000000000..6cc3b4d4b4 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-selected-when-selected-true-prop-is-given-1-chromium-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-selected-when-selected-true-prop-is-given-1-webkit-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-selected-when-selected-true-prop-is-given-1-webkit-darwin.png new file mode 100644 index 0000000000..52e6ef79dd Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-selected-when-selected-true-prop-is-given-1-webkit-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-Icon-component-1-chromium-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-Icon-component-1-chromium-darwin.png new file mode 100644 index 0000000000..12ebbd6c9c Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-Icon-component-1-chromium-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-Icon-component-1-webkit-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-Icon-component-1-webkit-darwin.png new file mode 100644 index 0000000000..4861b20010 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-Icon-component-1-webkit-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-a-tag-1-chromium-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-a-tag-1-chromium-darwin.png new file mode 100644 index 0000000000..6848e00fc5 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-a-tag-1-chromium-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-a-tag-1-webkit-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-a-tag-1-webkit-darwin.png new file mode 100644 index 0000000000..e6825c7897 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-a-tag-1-webkit-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-icon-1-chromium-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-icon-1-chromium-darwin.png new file mode 100644 index 0000000000..536d990255 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-icon-1-chromium-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-icon-1-webkit-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-icon-1-webkit-darwin.png new file mode 100644 index 0000000000..8712d33c77 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-icon-1-webkit-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-icon-in-Button-Icon-1-chromium-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-icon-in-Button-Icon-1-chromium-darwin.png new file mode 100644 index 0000000000..e4a1ca4aa5 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-icon-in-Button-Icon-1-chromium-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-icon-in-Button-Icon-1-webkit-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-icon-in-Button-Icon-1-webkit-darwin.png new file mode 100644 index 0000000000..af7c1431d9 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-should-render-icon-in-Button-Icon-1-webkit-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-show-given-children-1-chromium-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-show-given-children-1-chromium-darwin.png new file mode 100644 index 0000000000..f20a904ee3 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-show-given-children-1-chromium-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-show-given-children-1-webkit-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-show-given-children-1-webkit-darwin.png new file mode 100644 index 0000000000..09b808742a Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-show-given-children-1-webkit-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-show-given-content-1-chromium-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-show-given-content-1-chromium-darwin.png new file mode 100644 index 0000000000..51736f8de1 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-show-given-content-1-chromium-darwin.png differ diff --git a/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-show-given-content-1-webkit-darwin.png b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-show-given-content-1-webkit-darwin.png new file mode 100644 index 0000000000..0f96150cd2 Binary files /dev/null and b/src/components/Button/__component__/Button.spec.tsx-snapshots/Button-show-given-content-1-webkit-darwin.png differ diff --git a/src/components/Button/__component__/ButtonHelpers.tsx b/src/components/Button/__component__/ButtonHelpers.tsx new file mode 100644 index 0000000000..6999483c1e --- /dev/null +++ b/src/components/Button/__component__/ButtonHelpers.tsx @@ -0,0 +1,26 @@ +import React from 'react'; + +import {Gear} from '@gravity-ui/icons'; + +import {Icon} from '../../Icon'; +import {Button} from '../Button'; + +export const ButtonWitchIcon = () => { + return ( + + ); +}; + +export const ButtonIcon = () => { + return ( + + ); +}; diff --git a/src/components/Card/__component__/Card.spec.tsx b/src/components/Card/__component__/Card.spec.tsx new file mode 100644 index 0000000000..8d12a54a77 --- /dev/null +++ b/src/components/Card/__component__/Card.spec.tsx @@ -0,0 +1,115 @@ +import React from 'react'; + +import {expect, test} from '@playwright/experimental-ct-react'; + +import {WrapperCard} from './WrapperCard'; + +test.describe('Card test component', () => { + test('render card by default', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test.describe('render with different themes', () => { + test('danger', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('info', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('normal', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('success', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('positive', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('warning', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + }); + + test.describe('render with different size', () => { + test('m', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('l', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + }); + + test.describe('render with different view', () => { + test('outlined', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('clear', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('filled', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('raised', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + }); + + test('selected when selected=true prop is given', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('not selected when selected=false prop is given', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('disabled when disabled=true prop is given', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('not disabled when disabled=false prop is given', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); +}); diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-disabled-when-disabled-true-prop-is-given-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-disabled-when-disabled-true-prop-is-given-1-chromium-darwin.png new file mode 100644 index 0000000000..be397585d3 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-disabled-when-disabled-true-prop-is-given-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-disabled-when-disabled-true-prop-is-given-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-disabled-when-disabled-true-prop-is-given-1-webkit-darwin.png new file mode 100644 index 0000000000..48cdcb3ee2 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-disabled-when-disabled-true-prop-is-given-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-not-disabled-when-disabled-false-prop-is-given-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-not-disabled-when-disabled-false-prop-is-given-1-chromium-darwin.png new file mode 100644 index 0000000000..be397585d3 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-not-disabled-when-disabled-false-prop-is-given-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-not-disabled-when-disabled-false-prop-is-given-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-not-disabled-when-disabled-false-prop-is-given-1-webkit-darwin.png new file mode 100644 index 0000000000..48cdcb3ee2 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-not-disabled-when-disabled-false-prop-is-given-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-not-selected-when-selected-false-prop-is-given-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-not-selected-when-selected-false-prop-is-given-1-chromium-darwin.png new file mode 100644 index 0000000000..be397585d3 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-not-selected-when-selected-false-prop-is-given-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-not-selected-when-selected-false-prop-is-given-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-not-selected-when-selected-false-prop-is-given-1-webkit-darwin.png new file mode 100644 index 0000000000..48cdcb3ee2 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-not-selected-when-selected-false-prop-is-given-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-card-by-default-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-card-by-default-1-chromium-darwin.png new file mode 100644 index 0000000000..be397585d3 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-card-by-default-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-card-by-default-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-card-by-default-1-webkit-darwin.png new file mode 100644 index 0000000000..48cdcb3ee2 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-card-by-default-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-size-l-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-size-l-1-chromium-darwin.png new file mode 100644 index 0000000000..e9b497c351 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-size-l-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-size-l-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-size-l-1-webkit-darwin.png new file mode 100644 index 0000000000..412b33f96d Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-size-l-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-size-m-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-size-m-1-chromium-darwin.png new file mode 100644 index 0000000000..be397585d3 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-size-m-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-size-m-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-size-m-1-webkit-darwin.png new file mode 100644 index 0000000000..48cdcb3ee2 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-size-m-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-danger-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-danger-1-chromium-darwin.png new file mode 100644 index 0000000000..714cf4f6c3 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-danger-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-danger-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-danger-1-webkit-darwin.png new file mode 100644 index 0000000000..db496285de Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-danger-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-info-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-info-1-chromium-darwin.png new file mode 100644 index 0000000000..c72122b832 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-info-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-info-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-info-1-webkit-darwin.png new file mode 100644 index 0000000000..bb32eb9310 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-info-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-normal-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-normal-1-chromium-darwin.png new file mode 100644 index 0000000000..be397585d3 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-normal-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-normal-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-normal-1-webkit-darwin.png new file mode 100644 index 0000000000..48cdcb3ee2 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-normal-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-positive-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-positive-1-chromium-darwin.png new file mode 100644 index 0000000000..a88c505df5 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-positive-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-positive-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-positive-1-webkit-darwin.png new file mode 100644 index 0000000000..79fbcc9ca1 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-positive-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-success-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-success-1-chromium-darwin.png new file mode 100644 index 0000000000..a88c505df5 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-success-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-success-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-success-1-webkit-darwin.png new file mode 100644 index 0000000000..79fbcc9ca1 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-success-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-warning-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-warning-1-chromium-darwin.png new file mode 100644 index 0000000000..b60ec0fa82 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-warning-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-warning-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-warning-1-webkit-darwin.png new file mode 100644 index 0000000000..7bc4171aa1 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-themes-warning-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-clear-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-clear-1-chromium-darwin.png new file mode 100644 index 0000000000..b41b5c6870 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-clear-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-clear-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-clear-1-webkit-darwin.png new file mode 100644 index 0000000000..7f8bca29c8 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-clear-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-filled-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-filled-1-chromium-darwin.png new file mode 100644 index 0000000000..1383d6580e Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-filled-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-filled-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-filled-1-webkit-darwin.png new file mode 100644 index 0000000000..c976aa5db8 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-filled-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-outlined-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-outlined-1-chromium-darwin.png new file mode 100644 index 0000000000..be397585d3 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-outlined-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-outlined-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-outlined-1-webkit-darwin.png new file mode 100644 index 0000000000..48cdcb3ee2 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-outlined-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-raised-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-raised-1-chromium-darwin.png new file mode 100644 index 0000000000..17eabec18b Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-raised-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-raised-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-raised-1-webkit-darwin.png new file mode 100644 index 0000000000..623005cdcd Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-render-with-different-view-raised-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-selected-when-selected-true-prop-is-given-1-chromium-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-selected-when-selected-true-prop-is-given-1-chromium-darwin.png new file mode 100644 index 0000000000..be397585d3 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-selected-when-selected-true-prop-is-given-1-chromium-darwin.png differ diff --git a/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-selected-when-selected-true-prop-is-given-1-webkit-darwin.png b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-selected-when-selected-true-prop-is-given-1-webkit-darwin.png new file mode 100644 index 0000000000..48cdcb3ee2 Binary files /dev/null and b/src/components/Card/__component__/Card.spec.tsx-snapshots/Card-test-component-selected-when-selected-true-prop-is-given-1-webkit-darwin.png differ diff --git a/src/components/Card/__component__/WrapperCard.tsx b/src/components/Card/__component__/WrapperCard.tsx new file mode 100644 index 0000000000..3cd8f88730 --- /dev/null +++ b/src/components/Card/__component__/WrapperCard.tsx @@ -0,0 +1,16 @@ +import React from 'react'; + +import {Card, CardProps} from '../Card'; + +const qaId = 'card-component'; +const cardText = 'Some text'; + +export const WrapperCard = (props: Omit) => { + return ( +
+ + {cardText} + +
+ ); +}; diff --git a/src/components/Table/__component__/Table.spec.tsx b/src/components/Table/__component__/Table.spec.tsx new file mode 100644 index 0000000000..bbe1b59f71 --- /dev/null +++ b/src/components/Table/__component__/Table.spec.tsx @@ -0,0 +1,36 @@ +import React from 'react'; + +import {expect, test} from '@playwright/experimental-ct-react'; + +import {Table} from '../Table'; + +import {columns, data} from './utils'; + +test.describe('Table', () => { + test('render table by default', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('render table by empty data', async ({mount}) => { + const component = await mount(
); + + await expect(component).toHaveScreenshot(); + }); + + test('render table with edge padding', async ({mount}) => { + const component = await mount(
); + + await expect(component).toHaveScreenshot(); + }); + + test('render table with no data (custom)', async ({mount}) => { + const emptyText = 'Custom no data message'; + const component = await mount( +
, + ); + + await expect(component).toHaveScreenshot(); + }); +}); diff --git a/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-by-default-1-chromium-darwin.png b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-by-default-1-chromium-darwin.png new file mode 100644 index 0000000000..f9f9af2e0b Binary files /dev/null and b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-by-default-1-chromium-darwin.png differ diff --git a/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-by-default-1-webkit-darwin.png b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-by-default-1-webkit-darwin.png new file mode 100644 index 0000000000..ea138b5c2b Binary files /dev/null and b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-by-default-1-webkit-darwin.png differ diff --git a/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-by-empty-data-1-chromium-darwin.png b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-by-empty-data-1-chromium-darwin.png new file mode 100644 index 0000000000..1d5f1e914d Binary files /dev/null and b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-by-empty-data-1-chromium-darwin.png differ diff --git a/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-by-empty-data-1-webkit-darwin.png b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-by-empty-data-1-webkit-darwin.png new file mode 100644 index 0000000000..c2a3c4774d Binary files /dev/null and b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-by-empty-data-1-webkit-darwin.png differ diff --git a/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-with-edge-padding-1-chromium-darwin.png b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-with-edge-padding-1-chromium-darwin.png new file mode 100644 index 0000000000..f9f9af2e0b Binary files /dev/null and b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-with-edge-padding-1-chromium-darwin.png differ diff --git a/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-with-edge-padding-1-webkit-darwin.png b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-with-edge-padding-1-webkit-darwin.png new file mode 100644 index 0000000000..ea138b5c2b Binary files /dev/null and b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-with-edge-padding-1-webkit-darwin.png differ diff --git a/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-with-no-data-custom-1-chromium-darwin.png b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-with-no-data-custom-1-chromium-darwin.png new file mode 100644 index 0000000000..ad27248a9b Binary files /dev/null and b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-with-no-data-custom-1-chromium-darwin.png differ diff --git a/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-with-no-data-custom-1-webkit-darwin.png b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-with-no-data-custom-1-webkit-darwin.png new file mode 100644 index 0000000000..f14cb43071 Binary files /dev/null and b/src/components/Table/__component__/Table.spec.tsx-snapshots/Table-render-table-with-no-data-custom-1-webkit-darwin.png differ diff --git a/src/components/Table/__component__/utils.ts b/src/components/Table/__component__/utils.ts new file mode 100644 index 0000000000..b81b3ca3ef --- /dev/null +++ b/src/components/Table/__component__/utils.ts @@ -0,0 +1,72 @@ +import type {TableColumnConfig} from '../Table'; + +export interface DataItem { + name: string; + city?: string; + phone: string; + count: number; + date: string; + disabled?: boolean; +} + +export const data: DataItem[] = [ + { + name: 'Nomlanga Compton', + city: 'Erli', + phone: '+7 (923) 737-89-72', + count: 82, + date: '2019-03-15', + }, + { + name: 'Paul Hatfield', + city: 'Campitello di Fassa', + phone: '+7 (900) 333-82-02', + count: 51, + date: '2019-11-23', + }, + { + name: 'Phelan Daniel', + city: 'Meugliano', + phone: '+7 (925) 549-50-23', + count: 10, + date: '2019-05-14', + }, + { + name: 'Hiram Mayer', + city: '', + phone: '+7 (950) 372-56-84', + count: 54, + date: '2019-03-29', + }, + { + name: 'Madeline Puckett', + phone: '+7 (908) 582-05-91', + count: 75, + date: '2019-02-01', + disabled: true, + }, +]; + +export const columns: TableColumnConfig[] = [ + { + id: 'name', + name: 'Name', + }, + { + id: 'city', + name: 'City', + }, + { + id: 'phone', + name: 'Phone', + }, + { + id: 'count', + name: 'Count', + align: 'right', + }, + { + id: 'date', + name: 'Date created', + }, +]; diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx b/src/components/controls/TextInput/__component__/TextInput.spec.tsx new file mode 100644 index 0000000000..2165ed81f1 --- /dev/null +++ b/src/components/controls/TextInput/__component__/TextInput.spec.tsx @@ -0,0 +1,142 @@ +import React from 'react'; + +import {expect, test} from '@playwright/experimental-ct-react'; + +import {TextInputNote, TextInputWrapper} from './TextInputHelper'; + +test.describe('TextInput', () => { + test.describe('without label prop', () => { + test.describe('basic', () => { + test('render input by default', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + }); + + test('render error message with error prop', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('render note container with note prop', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('check clear button visibility with hasClear prop', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + + // eslint-disable-next-line testing-library/prefer-screen-queries + await component.getByRole('textbox').fill('value'); + + await expect(component).toHaveScreenshot(); + + // eslint-disable-next-line testing-library/prefer-screen-queries + await component.getByRole('button').click(); + + await expect(component).toHaveScreenshot(); + }); + }); + + test.describe('error', () => { + test('render error message with error prop (if it is not an empty string)', async ({ + mount, + }) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('render error message with errorMessage prop (if it is not an empty string)', async ({ + mount, + }) => { + const component = await mount( + , + ); + + await expect(component).toHaveScreenshot(); + }); + + test('render error message with errorMessage prop and invalid state (if it is not an empty string)', async ({ + mount, + }) => { + const component = await mount( + , + ); + + await expect(component).toHaveScreenshot(); + }); + + test('render error icon if tooltip option is selected for errorPlacement prop', async ({ + mount, + }) => { + const component = await mount( + , + ); + + await expect(component).toHaveScreenshot(); + }); + + test('do not show error message if error prop value is an empty string', async ({ + mount, + }) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('do not show error message if errorMessage prop value is an empty string', async ({ + mount, + }) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('do not show error icon if error prop is an empty string', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('do not show error icon if errorMessage prop is an empty string', async ({mount}) => { + const component = await mount( + , + ); + + await expect(component).toHaveScreenshot(); + }); + }); + + test.describe('with label prop', () => { + test.describe('basic', () => { + test('render input with label', async ({mount}) => { + const component = await mount(); + + await expect(component).toHaveScreenshot(); + }); + + test('render described input with error message and note', async ({mount}) => { + const errorText = 'Some error text'; + const noteText = 'Note text'; + const component = await mount( + , + ); + + await expect(component).toHaveScreenshot(); + }); + }); + }); +}); diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-icon-if-error-prop-is-an-empty-string-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-icon-if-error-prop-is-an-empty-string-1-chromium-darwin.png new file mode 100644 index 0000000000..783cd2c22b Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-icon-if-error-prop-is-an-empty-string-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-icon-if-error-prop-is-an-empty-string-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-icon-if-error-prop-is-an-empty-string-1-webkit-darwin.png new file mode 100644 index 0000000000..0bab00b43f Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-icon-if-error-prop-is-an-empty-string-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-icon-if-errorMessage-prop-is-an-empty-string-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-icon-if-errorMessage-prop-is-an-empty-string-1-chromium-darwin.png new file mode 100644 index 0000000000..783cd2c22b Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-icon-if-errorMessage-prop-is-an-empty-string-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-icon-if-errorMessage-prop-is-an-empty-string-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-icon-if-errorMessage-prop-is-an-empty-string-1-webkit-darwin.png new file mode 100644 index 0000000000..0bab00b43f Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-icon-if-errorMessage-prop-is-an-empty-string-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-message-if-error-prop-value-is-an-empty-string-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-message-if-error-prop-value-is-an-empty-string-1-chromium-darwin.png new file mode 100644 index 0000000000..783cd2c22b Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-message-if-error-prop-value-is-an-empty-string-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-message-if-error-prop-value-is-an-empty-string-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-message-if-error-prop-value-is-an-empty-string-1-webkit-darwin.png new file mode 100644 index 0000000000..0bab00b43f Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-message-if-error-prop-value-is-an-empty-string-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-message-if-errorMessage-prop-value-is-an-empty-string-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-message-if-errorMessage-prop-value-is-an-empty-string-1-chromium-darwin.png new file mode 100644 index 0000000000..783cd2c22b Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-message-if-errorMessage-prop-value-is-an-empty-string-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-message-if-errorMessage-prop-value-is-an-empty-string-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-message-if-errorMessage-prop-value-is-an-empty-string-1-webkit-darwin.png new file mode 100644 index 0000000000..0bab00b43f Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-do-not-show-error-message-if-errorMessage-prop-value-is-an-empty-string-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-icon-if-tooltip-option-is-selected-for-errorPlacement-prop-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-icon-if-tooltip-option-is-selected-for-errorPlacement-prop-1-chromium-darwin.png new file mode 100644 index 0000000000..4663d8452e Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-icon-if-tooltip-option-is-selected-for-errorPlacement-prop-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-icon-if-tooltip-option-is-selected-for-errorPlacement-prop-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-icon-if-tooltip-option-is-selected-for-errorPlacement-prop-1-webkit-darwin.png new file mode 100644 index 0000000000..4a7aebbf48 Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-icon-if-tooltip-option-is-selected-for-errorPlacement-prop-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-erro-a4ab6--invalid-state-if-it-is-not-an-empty-string-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-erro-a4ab6--invalid-state-if-it-is-not-an-empty-string-1-chromium-darwin.png new file mode 100644 index 0000000000..a7910eeed5 Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-erro-a4ab6--invalid-state-if-it-is-not-an-empty-string-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-erro-a4ab6--invalid-state-if-it-is-not-an-empty-string-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-erro-a4ab6--invalid-state-if-it-is-not-an-empty-string-1-webkit-darwin.png new file mode 100644 index 0000000000..6c3ba3c38e Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-erro-a4ab6--invalid-state-if-it-is-not-an-empty-string-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-error-prop-if-it-is-not-an-empty-string-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-error-prop-if-it-is-not-an-empty-string-1-chromium-darwin.png new file mode 100644 index 0000000000..538fc827d1 Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-error-prop-if-it-is-not-an-empty-string-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-error-prop-if-it-is-not-an-empty-string-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-error-prop-if-it-is-not-an-empty-string-1-webkit-darwin.png new file mode 100644 index 0000000000..2f5cda04ee Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-error-prop-if-it-is-not-an-empty-string-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-errorMessage-prop-if-it-is-not-an-empty-string-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-errorMessage-prop-if-it-is-not-an-empty-string-1-chromium-darwin.png new file mode 100644 index 0000000000..783cd2c22b Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-errorMessage-prop-if-it-is-not-an-empty-string-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-errorMessage-prop-if-it-is-not-an-empty-string-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-errorMessage-prop-if-it-is-not-an-empty-string-1-webkit-darwin.png new file mode 100644 index 0000000000..0bab00b43f Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-error-render-error-message-with-errorMessage-prop-if-it-is-not-an-empty-string-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-with-label-prop-basic-render-described-input-with-error-message-and-note-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-with-label-prop-basic-render-described-input-with-error-message-and-note-1-chromium-darwin.png new file mode 100644 index 0000000000..60079bed66 Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-with-label-prop-basic-render-described-input-with-error-message-and-note-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-with-label-prop-basic-render-described-input-with-error-message-and-note-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-with-label-prop-basic-render-described-input-with-error-message-and-note-1-webkit-darwin.png new file mode 100644 index 0000000000..60b13509b0 Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-with-label-prop-basic-render-described-input-with-error-message-and-note-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-with-label-prop-basic-render-input-with-label-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-with-label-prop-basic-render-input-with-label-1-chromium-darwin.png new file mode 100644 index 0000000000..dad75a0c74 Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-with-label-prop-basic-render-input-with-label-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-with-label-prop-basic-render-input-with-label-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-with-label-prop-basic-render-input-with-label-1-webkit-darwin.png new file mode 100644 index 0000000000..eb5b14f172 Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-with-label-prop-basic-render-input-with-label-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-basic-render-input-by-default-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-basic-render-input-by-default-1-chromium-darwin.png new file mode 100644 index 0000000000..783cd2c22b Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-basic-render-input-by-default-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-basic-render-input-by-default-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-basic-render-input-by-default-1-webkit-darwin.png new file mode 100644 index 0000000000..0bab00b43f Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-basic-render-input-by-default-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-1-chromium-darwin.png new file mode 100644 index 0000000000..783cd2c22b Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-1-webkit-darwin.png new file mode 100644 index 0000000000..0bab00b43f Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-2-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-2-chromium-darwin.png new file mode 100644 index 0000000000..522ff4fe24 Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-2-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-2-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-2-webkit-darwin.png new file mode 100644 index 0000000000..9c7762a97c Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-2-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-3-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-3-chromium-darwin.png new file mode 100644 index 0000000000..e62ddebb19 Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-3-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-3-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-3-webkit-darwin.png new file mode 100644 index 0000000000..9ca6ddc8e2 Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-check-clear-button-visibility-with-hasClear-prop-3-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-render-error-message-with-error-prop-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-render-error-message-with-error-prop-1-chromium-darwin.png new file mode 100644 index 0000000000..538fc827d1 Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-render-error-message-with-error-prop-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-render-error-message-with-error-prop-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-render-error-message-with-error-prop-1-webkit-darwin.png new file mode 100644 index 0000000000..2f5cda04ee Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-render-error-message-with-error-prop-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-render-note-container-with-note-prop-1-chromium-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-render-note-container-with-note-prop-1-chromium-darwin.png new file mode 100644 index 0000000000..ce875f1728 Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-render-note-container-with-note-prop-1-chromium-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-render-note-container-with-note-prop-1-webkit-darwin.png b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-render-note-container-with-note-prop-1-webkit-darwin.png new file mode 100644 index 0000000000..2dd73c4a7d Binary files /dev/null and b/src/components/controls/TextInput/__component__/TextInput.spec.tsx-snapshots/TextInput-without-label-prop-render-note-container-with-note-prop-1-webkit-darwin.png differ diff --git a/src/components/controls/TextInput/__component__/TextInputHelper.tsx b/src/components/controls/TextInput/__component__/TextInputHelper.tsx new file mode 100644 index 0000000000..ff7d765b86 --- /dev/null +++ b/src/components/controls/TextInput/__component__/TextInputHelper.tsx @@ -0,0 +1,15 @@ +import React from 'react'; + +import {TextInput, TextInputProps} from '../TextInput'; + +export const TextInputWrapper = (props: TextInputProps) => { + return ( +
+ +
+ ); +}; + +export const TextInputNote = () => { + return Additional} />; +}; diff --git a/test-component/README.md b/test-component/README.md new file mode 100644 index 0000000000..5667a9e834 --- /dev/null +++ b/test-component/README.md @@ -0,0 +1,87 @@ +# Test Component + +## How to write a test + +1. You need to select the component for which you want to write tests +2. In the component folder, create a folder `__component__` +3. Create a file in it `component name.spec.tsx` +4. In the file to make imports: + + ```ts + import React from 'react'; + + import {expect, test} from '@playwright/experimental-ct-react'; + + import {MyTestedComponent} from '../MyTestedComponent'; + ``` + +5. Writing a test: + + ```ts + test('Name test', async ({mount}) => { + //mounting a component + const component = await mount(); + + //screenshot + await expect(component).toHaveScreenshot(); + }); + ``` + + ```ts + test.describe('Name group tests', () => { + test('1', ...); + test('2', ...); + ... + test('10', ...) + }); + ``` + +6. Running the test: (you don't need to run storybook to test components) + + ```shell + npm run playwright:install + npm run test:component + ``` + + ! the npm run playwright:install command must be run for the first time + +7. In the folder `__component__`, in which the folder `component name.spec.tsx-snapshots` will appear, it will contain screenshots + +## Description of possible commands: + +1. [playwright-test-components](https://playwright.dev/docs/test-components) +2. [playwright-docs](https://playwright.dev/docs/api/class-test) + +## Pay attention + +It takes screenshots along the border of the component and if you see that any part of the component did not get into the screenshots, it is recommended to do the following: + +```ts +import React from 'react'; + +import {expect, test} from '@playwright/experimental-ct-react'; + +import {Component} from '../Component'; + +test('test Component ', async ({mount}) => { + const component = await mount( +
+ +
, + ); + + await expect(component).toHaveScreenshot(); +}); +``` + +## Test examples + +- [TextInput](../src/components/controls/TextInput/__component__/TextInput.spec.tsx) +- [Button](../src/components/Button/__component__/Button.spec.tsx) +- [Card](../src/components/Card/__component__/Card.spec.tsx) +- [Table](../src/components/Table/__component__/Table.spec.tsx) + +## Npm scripts + +- `npm run test:component` - run tests +- `npm run test:component:update` - update screenshots diff --git a/test-component/playwright.config.ts b/test-component/playwright.config.ts new file mode 100644 index 0000000000..f0468b4e11 --- /dev/null +++ b/test-component/playwright.config.ts @@ -0,0 +1,69 @@ +import {resolve} from 'path'; + +import type {PlaywrightTestConfig} from '@playwright/experimental-ct-react'; +import {defineConfig, devices} from '@playwright/experimental-ct-react'; +import react from '@vitejs/plugin-react'; + +function pathFromRoot(p: string) { + return resolve(__dirname, '../', p); +} + +const reporter: PlaywrightTestConfig['reporter'] = []; + +reporter.push( + ['list'], + [ + 'html', + { + open: !process.env.CI ? 'on-failure' : 'never', + outputFolder: resolve(process.cwd(), 'playwright-report'), + }, + ], +); + +/** + * See https://playwright.dev/docs/test-configuration. + */ +const config: PlaywrightTestConfig = { + testDir: pathFromRoot('src'), + testMatch: '*/__component__/*.spec.tsx', + updateSnapshots: process.env.UPDATE_REQUEST ? 'all' : 'missing', + /* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot and toHaveScreenshot. */ + /* Maximum time one test can run for. */ + timeout: 10 * 1000, + /* Run tests in files in parallel */ + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: Boolean(process.env.CI), + /* Retry on CI only */ + retries: process.env.CI ? 2 : 0, + /* Opt out of parallel tests on CI. */ + workers: process.env.CI ? 8 : undefined, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter, + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + testIdAttribute: 'data-qa', + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + headless: true, + /* Port to use for Playwright component endpoint. */ + ctPort: 3100, + screenshot: 'only-on-failure', + timezoneId: 'Europe/Belgrade', + ctViteConfig: {plugins: [react()]}, + }, + /* Configure projects for major browsers */ + projects: [ + { + name: 'chromium', + use: {...devices['Desktop Chrome']}, + }, + { + name: 'webkit', + use: {...devices['Desktop Safari']}, + }, + ], +}; + +export default defineConfig(config); diff --git a/test-component/playwright/index.html b/test-component/playwright/index.html new file mode 100644 index 0000000000..6572a36e5f --- /dev/null +++ b/test-component/playwright/index.html @@ -0,0 +1,12 @@ + + + + + + Test component page + + +
+ + + diff --git a/test-component/playwright/index.scss b/test-component/playwright/index.scss new file mode 100644 index 0000000000..7a17f9ab7f --- /dev/null +++ b/test-component/playwright/index.scss @@ -0,0 +1 @@ +@import '../../styles/styles.scss'; diff --git a/test-component/playwright/index.tsx b/test-component/playwright/index.tsx new file mode 100644 index 0000000000..67aac616fc --- /dev/null +++ b/test-component/playwright/index.tsx @@ -0,0 +1 @@ +import './index.scss';