Compare commits
22 Commits
feature/rt
...
v0.8.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fc5455c37 | ||
|
|
24779e2592 | ||
|
|
9111724519 | ||
|
|
c2511e0917 | ||
| b7d935f557 | |||
| fdc20e7464 | |||
| a616d3815b | |||
| 56f65fbd3a | |||
|
|
52fec13377 | ||
|
|
1d4b796a39 | ||
|
|
142067e9ce | ||
| 3c291baa0e | |||
|
|
3cdc47b91b | ||
|
|
901d8d78a1 | ||
|
|
7736592830 | ||
|
|
8d447c9461 | ||
| 6506b89dc7 | |||
| 89d432b360 | |||
| f6cc2efb86 | |||
| 859fa4f2e1 | |||
|
|
0ec9e146b9 | ||
|
|
1669f01879 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -131,3 +131,9 @@ dist
|
|||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
|
# Playwright
|
||||||
|
/test-results/
|
||||||
|
/playwright-report/
|
||||||
|
/blob-report/
|
||||||
|
/playwright/.cache/
|
||||||
|
|||||||
6
__mocks__/lottiefiles-mock.tsx
Normal file
6
__mocks__/lottiefiles-mock.tsx
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { jest } from '@jest/globals';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
jest.mock('@lottiefiles/react-lottie-player', () => ({
|
||||||
|
Player: jest.fn(() => <></>),
|
||||||
|
}));
|
||||||
9
__mocks__/react-i18next.ts
Normal file
9
__mocks__/react-i18next.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import localeRu from '../locales/ru.json';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
useTranslation: (_, { keyPrefix }) => {
|
||||||
|
return {
|
||||||
|
t: (key: string) => localeRu[`${keyPrefix}.${key}`],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -19,7 +19,7 @@ module.exports = {
|
|||||||
'dry-wash.arm': '/arm/*',
|
'dry-wash.arm': '/arm/*',
|
||||||
},
|
},
|
||||||
features: {
|
features: {
|
||||||
'dry-wash-pl': {
|
'dry-wash': {
|
||||||
// add your features here in the format [featureName]: { value: string }
|
// add your features here in the format [featureName]: { value: string }
|
||||||
'order-view-status-polling': { value: '3000' }
|
'order-view-status-polling': { value: '3000' }
|
||||||
},
|
},
|
||||||
|
|||||||
26
e2e/example.spec.ts
Normal file
26
e2e/example.spec.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { test, expect } from '@playwright/test';
|
||||||
|
|
||||||
|
test.beforeEach('check server is up', async ({ page }) => {
|
||||||
|
try {
|
||||||
|
await page.goto('http://localhost:8099/dry-wash');
|
||||||
|
const makeOrderText = page.getByText('Сделать заказ', { exact: true });
|
||||||
|
await expect(makeOrderText).toBeVisible();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('server not up', error);
|
||||||
|
test.skip();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('login', async ({ page }) => {
|
||||||
|
await page.goto('http://localhost:8099/dry-wash/arm');
|
||||||
|
await page.getByRole('textbox', { name: 'Username or email' }).click();
|
||||||
|
await page
|
||||||
|
.getByRole('textbox', { name: 'Username or email' })
|
||||||
|
.fill('237x237');
|
||||||
|
await page.getByRole('textbox', { name: 'Password' }).click();
|
||||||
|
await page.getByRole('textbox', { name: 'Password' }).fill('');
|
||||||
|
await page.getByRole('button', { name: 'Sign In' }).click();
|
||||||
|
await page.getByRole('heading', { name: 'Заказы' }).click();
|
||||||
|
await page.getByRole('link', { name: 'Мастера' }).click();
|
||||||
|
await page.getByRole('link', { name: 'Заказы' }).click();
|
||||||
|
});
|
||||||
@@ -9,9 +9,11 @@ module.exports = {
|
|||||||
clearMocks: true,
|
clearMocks: true,
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'\\.(svg|webp)$': '<rootDir>/__mocks__/file',
|
'\\.(svg|webp)$': '<rootDir>/__mocks__/file',
|
||||||
|
'react-i18next': '<rootDir>/__mocks__/react-i18next',
|
||||||
},
|
},
|
||||||
testEnvironmentOptions: {
|
testEnvironmentOptions: {
|
||||||
customExportConditions: [''],
|
customExportConditions: [''],
|
||||||
},
|
},
|
||||||
testEnvironment: 'jest-fixed-jsdom',
|
testEnvironment: 'jest-fixed-jsdom',
|
||||||
|
testPathIgnorePatterns: ['/node_modules/', '<rootDir>/e2e'],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
"dry-wash.order-create.car-body-select.options.sports-car" : "Sports-car",
|
"dry-wash.order-create.car-body-select.options.sports-car" : "Sports-car",
|
||||||
"dry-wash.order-create.car-body-select.options.other": "Other",
|
"dry-wash.order-create.car-body-select.options.other": "Other",
|
||||||
"dry-wash.order-create.form.submit-button.label": "Submit",
|
"dry-wash.order-create.form.submit-button.label": "Submit",
|
||||||
|
"dry-wash.order-create.order-creation-title": "Creating order ...",
|
||||||
"dry-wash.order-create.create-order-query.success.title": "The order is successfully created",
|
"dry-wash.order-create.create-order-query.success.title": "The order is successfully created",
|
||||||
"dry-wash.order-create.create-order-query.error.title": "Failed to create an order",
|
"dry-wash.order-create.create-order-query.error.title": "Failed to create an order",
|
||||||
"dry-wash.order-view.title": "Your order",
|
"dry-wash.order-view.title": "Your order",
|
||||||
|
|||||||
@@ -94,6 +94,7 @@
|
|||||||
"dry-wash.order-create.car-body-select.options.sports-car": "Спорткар",
|
"dry-wash.order-create.car-body-select.options.sports-car": "Спорткар",
|
||||||
"dry-wash.order-create.car-body-select.options.other": "Другой",
|
"dry-wash.order-create.car-body-select.options.other": "Другой",
|
||||||
"dry-wash.order-create.form.submit-button.label": "Отправить",
|
"dry-wash.order-create.form.submit-button.label": "Отправить",
|
||||||
|
"dry-wash.order-create.order-creation-title": "Создаем заказ ...",
|
||||||
"dry-wash.order-create.create-order-query.success.title": "Заказ успешно создан",
|
"dry-wash.order-create.create-order-query.success.title": "Заказ успешно создан",
|
||||||
"dry-wash.order-create.create-order-query.error.title": "Не удалось создать заказ",
|
"dry-wash.order-create.create-order-query.error.title": "Не удалось создать заказ",
|
||||||
"dry-wash.order-view.title": "Ваш заказ",
|
"dry-wash.order-view.title": "Ваш заказ",
|
||||||
|
|||||||
209
package-lock.json
generated
209
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "dry-wash",
|
"name": "dry-wash",
|
||||||
"version": "0.5.0",
|
"version": "0.8.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "dry-wash",
|
"name": "dry-wash",
|
||||||
"version": "0.5.0",
|
"version": "0.8.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.26.7",
|
"@babel/core": "^7.26.7",
|
||||||
@@ -48,7 +48,10 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.14.0",
|
"@eslint/js": "^9.14.0",
|
||||||
|
"@playwright/test": "^1.50.1",
|
||||||
"@stylistic/eslint-plugin": "^2.10.1",
|
"@stylistic/eslint-plugin": "^2.10.1",
|
||||||
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
|
"@types/node": "^22.13.1",
|
||||||
"@types/react-dom": "^18.3.1",
|
"@types/react-dom": "^18.3.1",
|
||||||
"eslint": "^9.14.0",
|
"eslint": "^9.14.0",
|
||||||
"eslint-plugin-import": "^2.31.0",
|
"eslint-plugin-import": "^2.31.0",
|
||||||
@@ -59,6 +62,12 @@
|
|||||||
"typescript-eslint": "^8.12.2"
|
"typescript-eslint": "^8.12.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@adobe/css-tools": {
|
||||||
|
"version": "4.4.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.2.tgz",
|
||||||
|
"integrity": "sha512-baYZExFpsdkBNuvGKTKWCwKH57HRZLVtycZS05WTQNVOiXVSeAki3nU35zlRbToeMW8aHlJfyS+1C4BOv27q0A==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/@ampproject/remapping": {
|
"node_modules/@ampproject/remapping": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
|
||||||
@@ -3619,6 +3628,21 @@
|
|||||||
"node": ">=14"
|
"node": ">=14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@playwright/test": {
|
||||||
|
"version": "1.50.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.50.1.tgz",
|
||||||
|
"integrity": "sha512-Jii3aBg+CEDpgnuDxEp/h7BimHcUTDlpEtce89xEumlJ5ef2hqepZ+PWp1DDpYC/VO9fmWVI1IlEaoI5fK9FXQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"playwright": "1.50.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"playwright": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@popperjs/core": {
|
"node_modules/@popperjs/core": {
|
||||||
"version": "2.11.8",
|
"version": "2.11.8",
|
||||||
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
|
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
|
||||||
@@ -3798,6 +3822,72 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@testing-library/jest-dom": {
|
||||||
|
"version": "6.6.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.6.3.tgz",
|
||||||
|
"integrity": "sha512-IteBhl4XqYNkM54f4ejhLRJiZNqcSCoXUOG2CPK7qbD322KjQozM4kHQOfkG2oln9b9HTYqs+Sae8vBATubxxA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@adobe/css-tools": "^4.4.0",
|
||||||
|
"aria-query": "^5.0.0",
|
||||||
|
"chalk": "^3.0.0",
|
||||||
|
"css.escape": "^1.5.1",
|
||||||
|
"dom-accessibility-api": "^0.6.3",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"redent": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14",
|
||||||
|
"npm": ">=6",
|
||||||
|
"yarn": ">=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@testing-library/jest-dom/node_modules/ansi-styles": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"color-convert": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@testing-library/jest-dom/node_modules/chalk": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-styles": "^4.1.0",
|
||||||
|
"supports-color": "^7.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@testing-library/jest-dom/node_modules/dom-accessibility-api": {
|
||||||
|
"version": "0.6.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz",
|
||||||
|
"integrity": "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/@testing-library/jest-dom/node_modules/supports-color": {
|
||||||
|
"version": "7.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||||
|
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"has-flag": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@testing-library/react": {
|
"node_modules/@testing-library/react": {
|
||||||
"version": "16.2.0",
|
"version": "16.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.2.0.tgz",
|
||||||
@@ -4003,12 +4093,11 @@
|
|||||||
"integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA=="
|
"integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "22.9.0",
|
"version": "22.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.1.tgz",
|
||||||
"integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==",
|
"integrity": "sha512-jK8uzQlrvXqEU91UxiK5J7pKHyzgnI1Qnl0QDHIgVGuolJhRb9EEl28Cj9b3rGR8B2lhFCtvIm5os8lFnO/1Ew==",
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~6.19.8"
|
"undici-types": "~6.20.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/parse-json": {
|
"node_modules/@types/parse-json": {
|
||||||
@@ -5929,6 +6018,12 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/css.escape": {
|
||||||
|
"version": "1.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz",
|
||||||
|
"integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/cssesc": {
|
"node_modules/cssesc": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
|
||||||
@@ -8658,6 +8753,15 @@
|
|||||||
"node": ">=0.8.19"
|
"node": ">=0.8.19"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/indent-string": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/inflight": {
|
"node_modules/inflight": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||||
@@ -11239,6 +11343,12 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/lodash": {
|
||||||
|
"version": "4.17.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
|
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/lodash.debounce": {
|
"node_modules/lodash.debounce": {
|
||||||
"version": "4.0.8",
|
"version": "4.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
|
||||||
@@ -11429,6 +11539,15 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/min-indent": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/minimatch": {
|
"node_modules/minimatch": {
|
||||||
"version": "9.0.5",
|
"version": "9.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
|
||||||
@@ -12110,6 +12229,50 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/playwright": {
|
||||||
|
"version": "1.50.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.50.1.tgz",
|
||||||
|
"integrity": "sha512-G8rwsOQJ63XG6BbKj2w5rHeavFjy5zynBA9zsJMMtBoe/Uf757oG12NXz6e6OirF7RCrTVAKFXbLmn1RbL7Qaw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"playwright-core": "1.50.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"playwright": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fsevents": "2.3.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/playwright-core": {
|
||||||
|
"version": "1.50.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.50.1.tgz",
|
||||||
|
"integrity": "sha512-ra9fsNWayuYumt+NiM069M6OkcRb1FZSK8bgi66AtpFoWkg2+y0bJSNmkFrWhMbEBbVKC/EruAHH3g0zmtwGmQ==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"playwright-core": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/playwright/node_modules/fsevents": {
|
||||||
|
"version": "2.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||||
|
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||||
|
"dev": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/popmotion": {
|
"node_modules/popmotion": {
|
||||||
"version": "11.0.3",
|
"version": "11.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/popmotion/-/popmotion-11.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/popmotion/-/popmotion-11.0.3.tgz",
|
||||||
@@ -12939,6 +13102,19 @@
|
|||||||
"recursive-watch": "bin.js"
|
"recursive-watch": "bin.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/redent": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"indent-string": "^4.0.0",
|
||||||
|
"strip-indent": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/redux": {
|
"node_modules/redux": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
|
||||||
@@ -13743,6 +13919,18 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/strip-indent": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"min-indent": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/strip-json-comments": {
|
"node_modules/strip-json-comments": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
|
||||||
@@ -14382,10 +14570,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici-types": {
|
"node_modules/undici-types": {
|
||||||
"version": "6.19.8",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
|
||||||
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
|
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="
|
||||||
"license": "MIT"
|
|
||||||
},
|
},
|
||||||
"node_modules/unicode-canonical-property-names-ecmascript": {
|
"node_modules/unicode-canonical-property-names-ecmascript": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dry-wash",
|
"name": "dry-wash",
|
||||||
"version": "0.5.0",
|
"version": "0.8.0",
|
||||||
"description": "<a id=\"readme-top\"></a>",
|
"description": "<a id=\"readme-top\"></a>",
|
||||||
"main": "./src/index.tsx",
|
"main": "./src/index.tsx",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -17,11 +17,11 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@brojs/cli": "^1.8.4",
|
|
||||||
"@babel/core": "^7.26.7",
|
"@babel/core": "^7.26.7",
|
||||||
"@babel/preset-env": "^7.26.7",
|
"@babel/preset-env": "^7.26.7",
|
||||||
"@babel/preset-react": "^7.26.3",
|
"@babel/preset-react": "^7.26.3",
|
||||||
"@babel/preset-typescript": "^7.26.0",
|
"@babel/preset-typescript": "^7.26.0",
|
||||||
|
"@brojs/cli": "^1.8.4",
|
||||||
"@chakra-ui/icons": "^2.2.4",
|
"@chakra-ui/icons": "^2.2.4",
|
||||||
"@chakra-ui/react": "^2.10.5",
|
"@chakra-ui/react": "^2.10.5",
|
||||||
"@emotion/react": "^11.4.1",
|
"@emotion/react": "^11.4.1",
|
||||||
@@ -56,7 +56,10 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.14.0",
|
"@eslint/js": "^9.14.0",
|
||||||
|
"@playwright/test": "^1.50.1",
|
||||||
"@stylistic/eslint-plugin": "^2.10.1",
|
"@stylistic/eslint-plugin": "^2.10.1",
|
||||||
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
|
"@types/node": "^22.13.1",
|
||||||
"@types/react-dom": "^18.3.1",
|
"@types/react-dom": "^18.3.1",
|
||||||
"eslint": "^9.14.0",
|
"eslint": "^9.14.0",
|
||||||
"eslint-plugin-import": "^2.31.0",
|
"eslint-plugin-import": "^2.31.0",
|
||||||
|
|||||||
79
playwright.config.ts
Normal file
79
playwright.config.ts
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
import { defineConfig, devices } from '@playwright/test';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read environment variables from file.
|
||||||
|
* https://github.com/motdotla/dotenv
|
||||||
|
*/
|
||||||
|
// import dotenv from 'dotenv';
|
||||||
|
// import path from 'path';
|
||||||
|
// dotenv.config({ path: path.resolve(__dirname, '.env') });
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See https://playwright.dev/docs/test-configuration.
|
||||||
|
*/
|
||||||
|
export default defineConfig({
|
||||||
|
testDir: './tests',
|
||||||
|
/* Run tests in files in parallel */
|
||||||
|
fullyParallel: true,
|
||||||
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||||
|
forbidOnly: !!process.env.CI,
|
||||||
|
/* Retry on CI only */
|
||||||
|
retries: process.env.CI ? 2 : 0,
|
||||||
|
/* Opt out of parallel tests on CI. */
|
||||||
|
workers: process.env.CI ? 1 : undefined,
|
||||||
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||||
|
reporter: 'html',
|
||||||
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||||
|
use: {
|
||||||
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||||
|
// baseURL: 'http://127.0.0.1:3000',
|
||||||
|
|
||||||
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Configure projects for major browsers */
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chromium',
|
||||||
|
use: { ...devices['Desktop Chrome'] },
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'firefox',
|
||||||
|
use: { ...devices['Desktop Firefox'] },
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'webkit',
|
||||||
|
use: { ...devices['Desktop Safari'] },
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Test against mobile viewports. */
|
||||||
|
// {
|
||||||
|
// name: 'Mobile Chrome',
|
||||||
|
// use: { ...devices['Pixel 5'] },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// name: 'Mobile Safari',
|
||||||
|
// use: { ...devices['iPhone 12'] },
|
||||||
|
// },
|
||||||
|
|
||||||
|
/* Test against branded browsers. */
|
||||||
|
// {
|
||||||
|
// name: 'Microsoft Edge',
|
||||||
|
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// name: 'Google Chrome',
|
||||||
|
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
|
||||||
|
/* Run your local dev server before starting the tests */
|
||||||
|
// webServer: {
|
||||||
|
// command: 'npm run start',
|
||||||
|
// url: 'http://127.0.0.1:3000',
|
||||||
|
// reuseExistingServer: !process.env.CI,
|
||||||
|
// },
|
||||||
|
});
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import { getFeatures } from "@brojs/cli";
|
import { getFeatures } from "@brojs/cli";
|
||||||
|
|
||||||
const features = getFeatures('dry-wash-pl');
|
const features = getFeatures('dry-wash');
|
||||||
|
|
||||||
export const FEATURE = {
|
export const FEATURE = {
|
||||||
orderViewStatusPolling: {
|
orderViewStatusPolling: {
|
||||||
isOn: Boolean(features['order-view-status-polling']),
|
isOn: Boolean(features?.['order-view-status-polling']),
|
||||||
getValue: () => {
|
getValue: () => {
|
||||||
const interval = parseInt(features['order-view-status-polling'].value);
|
const interval = parseInt(features?.['order-view-status-polling']?.value);
|
||||||
if (!Number.isNaN(interval)) {
|
if (!Number.isNaN(interval)) {
|
||||||
return interval;
|
return interval;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ type UpdateOrderProps = Required<Pick<OrderArm, 'id'>> &
|
|||||||
|
|
||||||
export const api = createApi({
|
export const api = createApi({
|
||||||
reducerPath: 'api',
|
reducerPath: 'api',
|
||||||
baseQuery: fetchBaseQuery({ baseUrl: getConfigValue('dry-wash.api') }),
|
baseQuery: fetchBaseQuery({
|
||||||
|
baseUrl: new URL(getConfigValue('dry-wash.api'), location.origin).href,
|
||||||
|
}),
|
||||||
tagTypes: ['Masters', 'Orders'],
|
tagTypes: ['Masters', 'Orders'],
|
||||||
endpoints: (builder) => ({
|
endpoints: (builder) => ({
|
||||||
getMasters: builder.query<Master[], void>({
|
getMasters: builder.query<Master[], void>({
|
||||||
|
|||||||
@@ -1,14 +1,23 @@
|
|||||||
import { GetOrder } from "../../models/api";
|
import { GetOrder, CreateOrder } from "../../models/api";
|
||||||
|
|
||||||
import { api } from "./api";
|
import { api } from "./api";
|
||||||
import { extractBodyFromResponse, extractErrorMessageFromResponse } from "./utils";
|
import { extractBodyFromResponse, extractErrorMessageFromResponse } from "./utils";
|
||||||
|
|
||||||
export const landingApi = api.injectEndpoints({
|
export const landingApi = api.injectEndpoints({
|
||||||
endpoints: ({ query }) => ({
|
endpoints: ({ mutation, query }) => ({
|
||||||
getOrder: query<GetOrder.Response, GetOrder.Params>({
|
getOrder: query<GetOrder.Response, GetOrder.Params>({
|
||||||
query: ({ orderId }) => `/order/${orderId}`,
|
query: ({ orderId }) => `/order/${orderId}`,
|
||||||
transformResponse: extractBodyFromResponse<GetOrder.Response>,
|
transformResponse: extractBodyFromResponse<GetOrder.Response>,
|
||||||
transformErrorResponse: extractErrorMessageFromResponse,
|
transformErrorResponse: extractErrorMessageFromResponse,
|
||||||
})
|
}),
|
||||||
|
createOrder: mutation<CreateOrder.Response, CreateOrder.Params>({
|
||||||
|
query: ({ body }) => ({
|
||||||
|
url: `/order/create`,
|
||||||
|
body,
|
||||||
|
method: 'POST'
|
||||||
|
}),
|
||||||
|
transformResponse: extractBodyFromResponse<CreateOrder.Response>,
|
||||||
|
transformErrorResponse: extractErrorMessageFromResponse,
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { FetchBaseQueryError } from "@reduxjs/toolkit/query";
|
import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
|
||||||
|
|
||||||
import { BaseResponse } from "../../models/api";
|
import { BaseResponse } from '../../models/api';
|
||||||
|
|
||||||
export const extractBodyFromResponse = <Body>(response: BaseResponse<Body>) => {
|
export const extractBodyFromResponse = <Body>(response: BaseResponse<Body>) => {
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@@ -8,8 +8,14 @@ export const extractBodyFromResponse = <Body>(response: BaseResponse<Body>) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const extractErrorMessageFromResponse = ({ data }: FetchBaseQueryError) => {
|
export const extractErrorMessageFromResponse = ({
|
||||||
if (typeof data === 'object' && 'message' in data && typeof data.message === 'string') {
|
data,
|
||||||
|
}: FetchBaseQueryError) => {
|
||||||
|
if (
|
||||||
|
typeof data === 'object' &&
|
||||||
|
'message' in data &&
|
||||||
|
typeof data.message === 'string'
|
||||||
|
) {
|
||||||
return data.message;
|
return data.message;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from './landing';
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
import { getConfigValue } from '@brojs/cli';
|
|
||||||
import { useState } from 'react';
|
|
||||||
|
|
||||||
import { CreateOrder } from '../models/api';
|
|
||||||
|
|
||||||
import { QueryState, Trigger } from './types';
|
|
||||||
|
|
||||||
enum LandingEndpoints {
|
|
||||||
ORDER_CREATE = '/order/create',
|
|
||||||
}
|
|
||||||
|
|
||||||
const endpoint = getConfigValue('dry-wash.api');
|
|
||||||
|
|
||||||
const useCreateOrderMutation = <D extends CreateOrder.Response>(): [
|
|
||||||
Trigger<CreateOrder.Params, QueryState<D>['data']>,
|
|
||||||
QueryState<D>,
|
|
||||||
] => {
|
|
||||||
const [isLoading, setIsLoading] = useState<QueryState<D>['isLoading']>(false);
|
|
||||||
const [isSuccess, setIsSuccess] = useState<QueryState<D>['isSuccess']>();
|
|
||||||
const [data, setData] = useState<QueryState<D>['data']>();
|
|
||||||
const [isError, setIsError] = useState<QueryState<D>['isError']>();
|
|
||||||
const [error, setError] = useState<QueryState<D>['error']>();
|
|
||||||
|
|
||||||
const createOrder = async ({ body }: CreateOrder.Params) => {
|
|
||||||
setIsLoading(true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch(
|
|
||||||
`${endpoint}${LandingEndpoints.ORDER_CREATE}`,
|
|
||||||
{
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
body: JSON.stringify(body),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
const errorResponseObject =
|
|
||||||
(await response.json()) as QueryState<D>['error'];
|
|
||||||
setIsError(true);
|
|
||||||
setError(errorResponseObject);
|
|
||||||
throw errorResponseObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
const dataResponseObject =
|
|
||||||
(await response.json()) as QueryState<D>['data'];
|
|
||||||
setIsSuccess(true);
|
|
||||||
setData(dataResponseObject);
|
|
||||||
|
|
||||||
return dataResponseObject;
|
|
||||||
} catch (error) {
|
|
||||||
setIsError(true);
|
|
||||||
setError(error);
|
|
||||||
throw error;
|
|
||||||
} finally {
|
|
||||||
setIsLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return [createOrder, { isLoading, isSuccess, data, isError, error }];
|
|
||||||
};
|
|
||||||
|
|
||||||
export { useCreateOrderMutation };
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
export type QueryData<D> = {
|
|
||||||
success: true;
|
|
||||||
body: D;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type QueryErrorData = {
|
|
||||||
success: false;
|
|
||||||
error: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type QueryState<D> = {
|
|
||||||
isLoading: boolean;
|
|
||||||
isSuccess: boolean;
|
|
||||||
data: QueryData<D>;
|
|
||||||
isError: boolean;
|
|
||||||
error: {
|
|
||||||
status: number;
|
|
||||||
data: QueryErrorData;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Trigger<P, D> = (params: P) => Promise<D>;
|
|
||||||
1
src/assets/animation/index.ts
Normal file
1
src/assets/animation/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default as OrderCreationAnimation } from './order-creation.json';
|
||||||
1
src/assets/animation/order-creation.json
Normal file
1
src/assets/animation/order-creation.json
Normal file
File diff suppressed because one or more lines are too long
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Box, Button, Text } from '@chakra-ui/react';
|
import { Box, Button, Text } from '@chakra-ui/react';
|
||||||
import { ArrowBackIcon, ArrowForwardIcon } from '@chakra-ui/icons';
|
import { ArrowBackIcon, ArrowForwardIcon } from '@chakra-ui/icons';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
interface DateNavigatorProps {
|
interface DateNavigatorProps {
|
||||||
currentDate: Date;
|
currentDate: Date;
|
||||||
@@ -19,7 +20,7 @@ const DateNavigator = ({
|
|||||||
<ArrowBackIcon />
|
<ArrowBackIcon />
|
||||||
</Button>
|
</Button>
|
||||||
<Text mx='4' fontSize='lg' fontWeight='bold'>
|
<Text mx='4' fontSize='lg' fontWeight='bold'>
|
||||||
{currentDate.toLocaleDateString()}
|
{dayjs(currentDate).format('DD.MM.YYYY')}
|
||||||
</Text>
|
</Text>
|
||||||
<Button onClick={onNextDate}>
|
<Button onClick={onNextDate}>
|
||||||
<ArrowForwardIcon />
|
<ArrowForwardIcon />
|
||||||
|
|||||||
@@ -28,27 +28,28 @@ class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|||||||
|
|
||||||
componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
|
componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
|
||||||
console.error('Error caught by ErrorBoundary:', error, errorInfo);
|
console.error('Error caught by ErrorBoundary:', error, errorInfo);
|
||||||
|
console.error('4545');
|
||||||
this.setState({ error, errorInfo });
|
this.setState({ error, errorInfo });
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { hasError } = this.state;
|
const { hasError } = this.state;
|
||||||
//TODO: добавить анимацию после залива 404 страницы
|
|
||||||
//TODO: может сделать обертку для хука, чтоб язык менялся без перезагрузки
|
|
||||||
if (hasError) {
|
if (hasError) {
|
||||||
return (
|
return (
|
||||||
<Center minH='100vh'>
|
<Center minH='100vh' data-testid='error-boundary'>
|
||||||
<VStack spacing={4} textAlign='center'>
|
<VStack spacing={4} textAlign='center'>
|
||||||
<Heading as='h1' size='2xl'>
|
<Heading as='h1' size='2xl' data-testid='error-title'>
|
||||||
{i18next.t('~:dry-wash.errorBoundary.title')}
|
{i18next.t('~:dry-wash.errorBoundary.title')}
|
||||||
</Heading>
|
</Heading>
|
||||||
<Text fontSize='lg'>
|
<Text fontSize='lg' data-testid='error-description'>
|
||||||
{i18next.t('~:dry-wash.errorBoundary.description')}
|
{i18next.t('~:dry-wash.errorBoundary.description')}
|
||||||
</Text>
|
</Text>
|
||||||
<Button
|
<Button
|
||||||
colorScheme='teal'
|
colorScheme='teal'
|
||||||
size='lg'
|
size='lg'
|
||||||
variant='outline'
|
variant='outline'
|
||||||
|
data-testid='error-reload-button'
|
||||||
onClick={() => window.location.reload()}
|
onClick={() => window.location.reload()}
|
||||||
>
|
>
|
||||||
{i18next.t('~:dry-wash.errorBoundary.button.reload')}
|
{i18next.t('~:dry-wash.errorBoundary.button.reload')}
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import { describe, expect, it, jest } from '@jest/globals';
|
||||||
|
import { render, screen, waitFor } from '@testing-library/react';
|
||||||
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
|
import { Provider } from 'react-redux';
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
|
import ErrorBoundary from '../ErrorBoundary';
|
||||||
|
import { store } from '../../../__data__/store';
|
||||||
|
|
||||||
|
const ProblematicComponent = () => {
|
||||||
|
useEffect(() => {
|
||||||
|
throw new Error('Test Error');
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return <div>Этот текст не должен появиться</div>;
|
||||||
|
};
|
||||||
|
jest.mock('@brojs/cli', () => {
|
||||||
|
return {
|
||||||
|
getNavigationValue: () => '/auth/login',
|
||||||
|
getConfigValue: () => '/api',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('ErrorBoundary', () => {
|
||||||
|
it('должен отобразить запасной UI при ошибке', async () => {
|
||||||
|
const { container } = render(
|
||||||
|
<Provider store={store}>
|
||||||
|
<ErrorBoundary>
|
||||||
|
<BrowserRouter>
|
||||||
|
<ProblematicComponent />
|
||||||
|
</BrowserRouter>
|
||||||
|
</ErrorBoundary>
|
||||||
|
</Provider>,
|
||||||
|
);
|
||||||
|
|
||||||
|
const button = await waitFor(() =>
|
||||||
|
screen.getByTestId('error-reload-button'),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(button).not.toBeNull();
|
||||||
|
|
||||||
|
expect(container).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`ErrorBoundary должен отобразить запасной UI при ошибке 1`] = `
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
class="css-1o0ed15"
|
||||||
|
data-testid="error-boundary"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-stack css-zefqyp"
|
||||||
|
>
|
||||||
|
<h1
|
||||||
|
class="chakra-heading css-0"
|
||||||
|
data-testid="error-title"
|
||||||
|
/>
|
||||||
|
<p
|
||||||
|
class="chakra-text css-1ezsviu"
|
||||||
|
data-testid="error-description"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
class="chakra-button css-4xx2wk"
|
||||||
|
data-testid="error-reload-button"
|
||||||
|
type="button"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
@@ -15,13 +15,13 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import OrderItem from '../OrderItem';
|
import OrderItem from '../OrderItem';
|
||||||
import { OrderProps } from '../OrderItem/OrderItem';
|
|
||||||
import DateNavigator from '../DateNavigator';
|
import DateNavigator from '../DateNavigator';
|
||||||
import {
|
import {
|
||||||
useGetMastersQuery,
|
useGetMastersQuery,
|
||||||
useGetOrdersQuery,
|
useGetOrdersQuery,
|
||||||
} from '../../__data__/service/api';
|
} from '../../__data__/service/api';
|
||||||
import useShowToast from '../../hooks/useShowToast';
|
import useShowToast from '../../hooks/useShowToast';
|
||||||
|
import { OrderArm } from '../../models/api';
|
||||||
|
|
||||||
const TABLE_HEADERS = [
|
const TABLE_HEADERS = [
|
||||||
'carNumber' as const,
|
'carNumber' as const,
|
||||||
@@ -70,7 +70,6 @@ const Orders = () => {
|
|||||||
<Heading size='lg' mb='5'>
|
<Heading size='lg' mb='5'>
|
||||||
{t('title')}
|
{t('title')}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
<DateNavigator
|
<DateNavigator
|
||||||
currentDate={currentDate}
|
currentDate={currentDate}
|
||||||
onPreviousDate={() =>
|
onPreviousDate={() =>
|
||||||
@@ -112,7 +111,7 @@ const Orders = () => {
|
|||||||
allMasters={masters}
|
allMasters={masters}
|
||||||
key={index}
|
key={index}
|
||||||
{...order}
|
{...order}
|
||||||
status={order.status as OrderProps['status']}
|
status={order.status as OrderArm['status']}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Tbody>
|
</Tbody>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export const PageSpinner: FC = () => {
|
|||||||
return (
|
return (
|
||||||
<Flex w='full' h='100vh' justifyContent='center' alignItems='center'>
|
<Flex w='full' h='100vh' justifyContent='center' alignItems='center'>
|
||||||
<Spinner
|
<Spinner
|
||||||
|
data-testid='spinner'
|
||||||
thickness='5px'
|
thickness='5px'
|
||||||
speed='0.65s'
|
speed='0.65s'
|
||||||
emptyColor='gray.200'
|
emptyColor='gray.200'
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ const Sidebar = () => {
|
|||||||
w='100%'
|
w='100%'
|
||||||
colorScheme={isActive(URLs.armMaster.url) ? 'green' : 'blue'}
|
colorScheme={isActive(URLs.armMaster.url) ? 'green' : 'blue'}
|
||||||
variant={isActive(URLs.armMaster.url) ? 'solid' : 'ghost'}
|
variant={isActive(URLs.armMaster.url) ? 'solid' : 'ghost'}
|
||||||
|
data-testid='master-button'
|
||||||
>
|
>
|
||||||
{t('master')}
|
{t('master')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ type SuccessResponse<Body> = {
|
|||||||
|
|
||||||
export type ErrorMessage = string;
|
export type ErrorMessage = string;
|
||||||
|
|
||||||
|
export const isErrorMessage = (error: unknown): error is ErrorMessage => typeof error === 'string';
|
||||||
|
|
||||||
type ErrorResponse = {
|
type ErrorResponse = {
|
||||||
success: false;
|
success: false;
|
||||||
message: ErrorMessage;
|
message: ErrorMessage;
|
||||||
|
|||||||
@@ -1,325 +0,0 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`Arm Page render 1`] = `
|
|
||||||
<div>
|
|
||||||
<div
|
|
||||||
class="css-1yeiifd"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="css-1fp6kaj"
|
|
||||||
>
|
|
||||||
<h2
|
|
||||||
class="chakra-heading css-9q1d0h"
|
|
||||||
>
|
|
||||||
title
|
|
||||||
</h2>
|
|
||||||
<div
|
|
||||||
class="chakra-stack css-1oen434"
|
|
||||||
>
|
|
||||||
<hr
|
|
||||||
aria-orientation="horizontal"
|
|
||||||
class="chakra-divider css-1upb9tn"
|
|
||||||
/>
|
|
||||||
<a
|
|
||||||
class="chakra-button css-uxt1e8"
|
|
||||||
href="/auth/login"
|
|
||||||
>
|
|
||||||
orders
|
|
||||||
</a>
|
|
||||||
<hr
|
|
||||||
aria-orientation="horizontal"
|
|
||||||
class="chakra-divider css-1upb9tn"
|
|
||||||
/>
|
|
||||||
<a
|
|
||||||
class="chakra-button css-uxt1e8"
|
|
||||||
href="/auth/login"
|
|
||||||
>
|
|
||||||
master
|
|
||||||
</a>
|
|
||||||
<hr
|
|
||||||
aria-orientation="horizontal"
|
|
||||||
class="chakra-divider css-1upb9tn"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="css-sy55x5"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="css-hpgf8j"
|
|
||||||
>
|
|
||||||
<h2
|
|
||||||
class="chakra-heading css-r7q7qr"
|
|
||||||
>
|
|
||||||
title
|
|
||||||
</h2>
|
|
||||||
<div
|
|
||||||
class="css-1me9tx"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
class="chakra-button css-4xx2wk"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
class="chakra-icon css-onkibi"
|
|
||||||
focusable="false"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"
|
|
||||||
fill="currentColor"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
<p
|
|
||||||
class="chakra-text css-1bntq7d"
|
|
||||||
>
|
|
||||||
2/2/2025
|
|
||||||
</p>
|
|
||||||
<button
|
|
||||||
class="chakra-button css-4xx2wk"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
class="chakra-icon css-onkibi"
|
|
||||||
focusable="false"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
|
|
||||||
fill="currentColor"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<table
|
|
||||||
class="chakra-table css-0"
|
|
||||||
>
|
|
||||||
<thead
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
<tr
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
<th
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
table.header.carNumber
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
table.header.orderDate
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
table.header.status
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
table.header.masters
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
table.header.telephone
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
table.header.location
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
<tr
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
<td
|
|
||||||
class="css-12rlgei"
|
|
||||||
colspan="6"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="chakra-spinner css-1y7joxr"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="css-8b45rq"
|
|
||||||
>
|
|
||||||
Loading...
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`Arm Page render 2`] = `
|
|
||||||
<div>
|
|
||||||
<div
|
|
||||||
class="css-1yeiifd"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="css-1fp6kaj"
|
|
||||||
>
|
|
||||||
<h2
|
|
||||||
class="chakra-heading css-9q1d0h"
|
|
||||||
>
|
|
||||||
title
|
|
||||||
</h2>
|
|
||||||
<div
|
|
||||||
class="chakra-stack css-1oen434"
|
|
||||||
>
|
|
||||||
<hr
|
|
||||||
aria-orientation="horizontal"
|
|
||||||
class="chakra-divider css-1upb9tn"
|
|
||||||
/>
|
|
||||||
<a
|
|
||||||
class="chakra-button css-uxt1e8"
|
|
||||||
href="/auth/login"
|
|
||||||
>
|
|
||||||
orders
|
|
||||||
</a>
|
|
||||||
<hr
|
|
||||||
aria-orientation="horizontal"
|
|
||||||
class="chakra-divider css-1upb9tn"
|
|
||||||
/>
|
|
||||||
<a
|
|
||||||
class="chakra-button css-uxt1e8"
|
|
||||||
href="/auth/login"
|
|
||||||
>
|
|
||||||
master
|
|
||||||
</a>
|
|
||||||
<hr
|
|
||||||
aria-orientation="horizontal"
|
|
||||||
class="chakra-divider css-1upb9tn"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="css-sy55x5"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="css-hpgf8j"
|
|
||||||
>
|
|
||||||
<h2
|
|
||||||
class="chakra-heading css-r7q7qr"
|
|
||||||
>
|
|
||||||
title
|
|
||||||
</h2>
|
|
||||||
<div
|
|
||||||
class="css-1me9tx"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
class="chakra-button css-4xx2wk"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
class="chakra-icon css-onkibi"
|
|
||||||
focusable="false"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"
|
|
||||||
fill="currentColor"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
<p
|
|
||||||
class="chakra-text css-1bntq7d"
|
|
||||||
>
|
|
||||||
2/2/2025
|
|
||||||
</p>
|
|
||||||
<button
|
|
||||||
class="chakra-button css-4xx2wk"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
class="chakra-icon css-onkibi"
|
|
||||||
focusable="false"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
|
|
||||||
fill="currentColor"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<table
|
|
||||||
class="chakra-table css-0"
|
|
||||||
>
|
|
||||||
<thead
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
<tr
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
<th
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
table.header.carNumber
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
table.header.orderDate
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
table.header.status
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
table.header.masters
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
table.header.telephone
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
table.header.location
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
<tr
|
|
||||||
class="css-0"
|
|
||||||
>
|
|
||||||
<td
|
|
||||||
class="css-12rlgei"
|
|
||||||
colspan="6"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="chakra-spinner css-1y7joxr"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="css-8b45rq"
|
|
||||||
>
|
|
||||||
Loading...
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
643
src/pages/__tests__/__snapshots__/masters.test.tsx.snap
Normal file
643
src/pages/__tests__/__snapshots__/masters.test.tsx.snap
Normal file
@@ -0,0 +1,643 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`Master Page render 1`] = `
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
class="css-1yeiifd"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="css-13owfwq"
|
||||||
|
>
|
||||||
|
<h2
|
||||||
|
class="chakra-heading css-173d1bl"
|
||||||
|
>
|
||||||
|
Сухой мастер
|
||||||
|
</h2>
|
||||||
|
<div
|
||||||
|
class="chakra-stack css-1cggwyz"
|
||||||
|
>
|
||||||
|
<hr
|
||||||
|
aria-orientation="horizontal"
|
||||||
|
class="chakra-divider css-svjswr"
|
||||||
|
/>
|
||||||
|
<a
|
||||||
|
class="chakra-button css-18yoix2"
|
||||||
|
href="/order"
|
||||||
|
>
|
||||||
|
Заказы
|
||||||
|
</a>
|
||||||
|
<hr
|
||||||
|
aria-orientation="horizontal"
|
||||||
|
class="chakra-divider css-svjswr"
|
||||||
|
/>
|
||||||
|
<a
|
||||||
|
class="chakra-button css-1kg18wp"
|
||||||
|
data-testid="master-button"
|
||||||
|
href="/master"
|
||||||
|
>
|
||||||
|
Мастера
|
||||||
|
</a>
|
||||||
|
<hr
|
||||||
|
aria-orientation="horizontal"
|
||||||
|
class="chakra-divider css-svjswr"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="css-jiwy8d"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="css-1glkkdp"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="css-sd3fvu"
|
||||||
|
>
|
||||||
|
<h2
|
||||||
|
class="chakra-heading css-1jb3vzl"
|
||||||
|
>
|
||||||
|
|
||||||
|
Мастера
|
||||||
|
</h2>
|
||||||
|
<button
|
||||||
|
class="chakra-button css-h211ee"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
+
|
||||||
|
Добавить
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<table
|
||||||
|
class="chakra-table css-5605sr"
|
||||||
|
>
|
||||||
|
<thead
|
||||||
|
class="css-0"
|
||||||
|
>
|
||||||
|
<tr
|
||||||
|
class="css-0"
|
||||||
|
>
|
||||||
|
<th
|
||||||
|
class="css-1szkfps"
|
||||||
|
>
|
||||||
|
Имя
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="css-1szkfps"
|
||||||
|
>
|
||||||
|
Актуальная занятость
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="css-1szkfps"
|
||||||
|
>
|
||||||
|
Телефон
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="css-1szkfps"
|
||||||
|
>
|
||||||
|
Действия
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody
|
||||||
|
class="css-0"
|
||||||
|
>
|
||||||
|
<tr
|
||||||
|
class="css-0"
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-editable css-vtl58r"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-stack css-c2wmld"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="chakra-editable__preview css-1gasyng"
|
||||||
|
>
|
||||||
|
Иван Иванов
|
||||||
|
</span>
|
||||||
|
<input
|
||||||
|
class="chakra-editable__input chakra-input css-2lpiar"
|
||||||
|
hidden=""
|
||||||
|
value="Иван Иванов"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="css-1l4w6pd"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-label="Edit"
|
||||||
|
class="chakra-button css-1pqvhxt"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-icon css-onkibi"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<g
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-width="2"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<p
|
||||||
|
class="chakra-text css-q9k0mw"
|
||||||
|
>
|
||||||
|
Свободен
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-editable css-vtl58r"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-stack css-c2wmld"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="chakra-editable__preview css-1gasyng"
|
||||||
|
>
|
||||||
|
+7 900 123 45 67
|
||||||
|
</span>
|
||||||
|
<input
|
||||||
|
class="chakra-editable__input chakra-input css-2lpiar"
|
||||||
|
hidden=""
|
||||||
|
value="+7 900 123 45 67"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="css-1l4w6pd"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-label="Edit"
|
||||||
|
class="chakra-button css-1pqvhxt"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-icon css-onkibi"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<g
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-width="2"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-controls="menu-list-:r2:"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-haspopup="menu"
|
||||||
|
class="chakra-button chakra-menu__menu-button css-13sr8jm"
|
||||||
|
id="menu-button-:r2:"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-icon css-onkibi"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<g
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-width="2"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<div
|
||||||
|
class="css-ktd6ms"
|
||||||
|
style="visibility: hidden; position: absolute; min-width: max-content; inset: 0 auto auto 0;"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
aria-orientation="vertical"
|
||||||
|
class="chakra-menu__menu-list css-s5t7bz"
|
||||||
|
id="menu-list-:r2:"
|
||||||
|
role="menu"
|
||||||
|
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.8) translateZ(0);"
|
||||||
|
tabindex="-1"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-disabled="false"
|
||||||
|
class="chakra-menu__menuitem css-y7jzs3"
|
||||||
|
data-index="0"
|
||||||
|
id="menu-list-:r2:-menuitem-:r3:"
|
||||||
|
role="menuitem"
|
||||||
|
tabindex="-1"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
Удалить мастера
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr
|
||||||
|
class="css-0"
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-editable css-vtl58r"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-stack css-c2wmld"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="chakra-editable__preview css-1gasyng"
|
||||||
|
>
|
||||||
|
Олег Макаров
|
||||||
|
</span>
|
||||||
|
<input
|
||||||
|
class="chakra-editable__input chakra-input css-2lpiar"
|
||||||
|
hidden=""
|
||||||
|
value="Олег Макаров"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="css-1l4w6pd"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-label="Edit"
|
||||||
|
class="chakra-button css-1pqvhxt"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-icon css-onkibi"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<g
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-width="2"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<p
|
||||||
|
class="chakra-text css-q9k0mw"
|
||||||
|
>
|
||||||
|
Свободен
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-editable css-vtl58r"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-stack css-c2wmld"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="chakra-editable__preview css-1gasyng"
|
||||||
|
>
|
||||||
|
79001234567
|
||||||
|
</span>
|
||||||
|
<input
|
||||||
|
class="chakra-editable__input chakra-input css-2lpiar"
|
||||||
|
hidden=""
|
||||||
|
value="79001234567"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="css-1l4w6pd"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-label="Edit"
|
||||||
|
class="chakra-button css-1pqvhxt"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-icon css-onkibi"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<g
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-width="2"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-controls="menu-list-:r5:"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-haspopup="menu"
|
||||||
|
class="chakra-button chakra-menu__menu-button css-13sr8jm"
|
||||||
|
id="menu-button-:r5:"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-icon css-onkibi"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<g
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-width="2"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<div
|
||||||
|
class="css-ktd6ms"
|
||||||
|
style="visibility: hidden; position: absolute; min-width: max-content; inset: 0 auto auto 0;"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
aria-orientation="vertical"
|
||||||
|
class="chakra-menu__menu-list css-s5t7bz"
|
||||||
|
id="menu-list-:r5:"
|
||||||
|
role="menu"
|
||||||
|
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.8) translateZ(0);"
|
||||||
|
tabindex="-1"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-disabled="false"
|
||||||
|
class="chakra-menu__menuitem css-y7jzs3"
|
||||||
|
data-index="0"
|
||||||
|
id="menu-list-:r5:-menuitem-:r6:"
|
||||||
|
role="menuitem"
|
||||||
|
tabindex="-1"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
Удалить мастера
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr
|
||||||
|
class="css-0"
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-editable css-vtl58r"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-stack css-c2wmld"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="chakra-editable__preview css-1gasyng"
|
||||||
|
>
|
||||||
|
Иван Галкин
|
||||||
|
</span>
|
||||||
|
<input
|
||||||
|
class="chakra-editable__input chakra-input css-2lpiar"
|
||||||
|
hidden=""
|
||||||
|
value="Иван Галкин"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="css-1l4w6pd"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-label="Edit"
|
||||||
|
class="chakra-button css-1pqvhxt"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-icon css-onkibi"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<g
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-width="2"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-stack css-1f0wxn3"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="chakra-badge css-1g1qw76"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
class="chakra-badge css-1g1qw76"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-editable css-vtl58r"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-stack css-c2wmld"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="chakra-editable__preview css-1gasyng"
|
||||||
|
>
|
||||||
|
+7 900 123 45 67
|
||||||
|
</span>
|
||||||
|
<input
|
||||||
|
class="chakra-editable__input chakra-input css-2lpiar"
|
||||||
|
hidden=""
|
||||||
|
value="+7 900 123 45 67"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="css-1l4w6pd"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-label="Edit"
|
||||||
|
class="chakra-button css-1pqvhxt"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-icon css-onkibi"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<g
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-width="2"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-controls="menu-list-:r8:"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-haspopup="menu"
|
||||||
|
class="chakra-button chakra-menu__menu-button css-13sr8jm"
|
||||||
|
id="menu-button-:r8:"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-icon css-onkibi"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<g
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-width="2"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<div
|
||||||
|
class="css-ktd6ms"
|
||||||
|
style="visibility: hidden; position: absolute; min-width: max-content; inset: 0 auto auto 0;"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
aria-orientation="vertical"
|
||||||
|
class="chakra-menu__menu-list css-s5t7bz"
|
||||||
|
id="menu-list-:r8:"
|
||||||
|
role="menu"
|
||||||
|
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.8) translateZ(0);"
|
||||||
|
tabindex="-1"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-disabled="false"
|
||||||
|
class="chakra-menu__menuitem css-y7jzs3"
|
||||||
|
data-index="0"
|
||||||
|
id="menu-list-:r8:-menuitem-:r9:"
|
||||||
|
role="menuitem"
|
||||||
|
tabindex="-1"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
Удалить мастера
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
hidden=""
|
||||||
|
id="__chakra_env"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
428
src/pages/__tests__/__snapshots__/ordersList.test.tsx.snap
Normal file
428
src/pages/__tests__/__snapshots__/ordersList.test.tsx.snap
Normal file
@@ -0,0 +1,428 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`order page получение списка заказов 1`] = `
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
class="css-1yeiifd"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="css-13owfwq"
|
||||||
|
>
|
||||||
|
<h2
|
||||||
|
class="chakra-heading css-173d1bl"
|
||||||
|
>
|
||||||
|
Сухой мастер
|
||||||
|
</h2>
|
||||||
|
<div
|
||||||
|
class="chakra-stack css-1cggwyz"
|
||||||
|
>
|
||||||
|
<hr
|
||||||
|
aria-orientation="horizontal"
|
||||||
|
class="chakra-divider css-svjswr"
|
||||||
|
/>
|
||||||
|
<a
|
||||||
|
class="chakra-button css-1kg18wp"
|
||||||
|
href="/auth/login"
|
||||||
|
>
|
||||||
|
Заказы
|
||||||
|
</a>
|
||||||
|
<hr
|
||||||
|
aria-orientation="horizontal"
|
||||||
|
class="chakra-divider css-svjswr"
|
||||||
|
/>
|
||||||
|
<a
|
||||||
|
class="chakra-button css-1kg18wp"
|
||||||
|
data-testid="master-button"
|
||||||
|
href="/auth/login"
|
||||||
|
>
|
||||||
|
Мастера
|
||||||
|
</a>
|
||||||
|
<hr
|
||||||
|
aria-orientation="horizontal"
|
||||||
|
class="chakra-divider css-svjswr"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="css-jiwy8d"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="css-1glkkdp"
|
||||||
|
>
|
||||||
|
<h2
|
||||||
|
class="chakra-heading css-1xer3cv"
|
||||||
|
>
|
||||||
|
Заказы
|
||||||
|
</h2>
|
||||||
|
<div
|
||||||
|
class="css-1u3smh"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
class="chakra-button css-ez23ye"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
class="chakra-icon css-onkibi"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<p
|
||||||
|
class="chakra-text css-52ukzg"
|
||||||
|
>
|
||||||
|
2/16/2025
|
||||||
|
</p>
|
||||||
|
<button
|
||||||
|
class="chakra-button css-ez23ye"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
class="chakra-icon css-onkibi"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<table
|
||||||
|
class="chakra-table css-5605sr"
|
||||||
|
>
|
||||||
|
<thead
|
||||||
|
class="css-0"
|
||||||
|
>
|
||||||
|
<tr
|
||||||
|
class="css-0"
|
||||||
|
>
|
||||||
|
<th
|
||||||
|
class="css-1szkfps"
|
||||||
|
>
|
||||||
|
Номер машины
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="css-1szkfps"
|
||||||
|
>
|
||||||
|
Дата заказа
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="css-1szkfps"
|
||||||
|
>
|
||||||
|
Статус
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="css-1szkfps"
|
||||||
|
>
|
||||||
|
Мастер
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="css-1szkfps"
|
||||||
|
>
|
||||||
|
Телефон
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="css-1szkfps"
|
||||||
|
>
|
||||||
|
Расположение
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody
|
||||||
|
class="css-0"
|
||||||
|
>
|
||||||
|
<tr
|
||||||
|
class="css-0"
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
A123BC
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
24.11.2024
|
||||||
|
|
||||||
|
<br />
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-select__wrapper css-42b2qy"
|
||||||
|
>
|
||||||
|
<select
|
||||||
|
class="chakra-select css-11j19cx"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
value=""
|
||||||
|
>
|
||||||
|
Выберите статус
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="pending"
|
||||||
|
>
|
||||||
|
В ожидании
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="progress"
|
||||||
|
>
|
||||||
|
Выполняется
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="working"
|
||||||
|
>
|
||||||
|
В работе
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="canceled"
|
||||||
|
>
|
||||||
|
Отменено
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="complete"
|
||||||
|
>
|
||||||
|
Завершено
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<div
|
||||||
|
class="chakra-select__icon-wrapper css-iohxn1"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-select__icon"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
style="width: 1em; height: 1em; color: currentColor;"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-select__wrapper css-42b2qy"
|
||||||
|
>
|
||||||
|
<select
|
||||||
|
class="chakra-select css-161pkch"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
value=""
|
||||||
|
>
|
||||||
|
Выберите мастера
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="Иван Иванов"
|
||||||
|
>
|
||||||
|
Иван Иванов
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="Олег Макаров"
|
||||||
|
>
|
||||||
|
Олег Макаров
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="Иван Галкин"
|
||||||
|
>
|
||||||
|
Иван Галкин
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<div
|
||||||
|
class="chakra-select__icon-wrapper css-iohxn1"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-select__icon"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
style="width: 1em; height: 1em; color: currentColor;"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
class="chakra-link css-spn4bz"
|
||||||
|
href="tel:"
|
||||||
|
>
|
||||||
|
79001234563
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
Казань, ул. Баумана, 1
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr
|
||||||
|
class="css-0"
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
A245BC
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
24.11.2024
|
||||||
|
|
||||||
|
<br />
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-select__wrapper css-42b2qy"
|
||||||
|
>
|
||||||
|
<select
|
||||||
|
class="chakra-select css-lvra4l"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
value=""
|
||||||
|
>
|
||||||
|
Выберите статус
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="pending"
|
||||||
|
>
|
||||||
|
В ожидании
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="progress"
|
||||||
|
>
|
||||||
|
Выполняется
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="working"
|
||||||
|
>
|
||||||
|
В работе
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="canceled"
|
||||||
|
>
|
||||||
|
Отменено
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="complete"
|
||||||
|
>
|
||||||
|
Завершено
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<div
|
||||||
|
class="chakra-select__icon-wrapper css-iohxn1"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-select__icon"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
style="width: 1em; height: 1em; color: currentColor;"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-select__wrapper css-42b2qy"
|
||||||
|
>
|
||||||
|
<select
|
||||||
|
class="chakra-select css-161pkch"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
value=""
|
||||||
|
>
|
||||||
|
Выберите мастера
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="Иван Иванов"
|
||||||
|
>
|
||||||
|
Иван Иванов
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="Олег Макаров"
|
||||||
|
>
|
||||||
|
Олег Макаров
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="Иван Галкин"
|
||||||
|
>
|
||||||
|
Иван Галкин
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<div
|
||||||
|
class="chakra-select__icon-wrapper css-iohxn1"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-select__icon"
|
||||||
|
focusable="false"
|
||||||
|
role="presentation"
|
||||||
|
style="width: 1em; height: 1em; color: currentColor;"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
class="chakra-link css-spn4bz"
|
||||||
|
href="tel:"
|
||||||
|
>
|
||||||
|
79001234567
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="css-zgoslk"
|
||||||
|
>
|
||||||
|
Казань, ул. Баумана, 43
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
hidden=""
|
||||||
|
id="__chakra_env"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
98
src/pages/__tests__/masters.test.tsx
Normal file
98
src/pages/__tests__/masters.test.tsx
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import {
|
||||||
|
describe,
|
||||||
|
it,
|
||||||
|
expect,
|
||||||
|
jest,
|
||||||
|
beforeAll,
|
||||||
|
afterEach,
|
||||||
|
afterAll,
|
||||||
|
} from '@jest/globals';
|
||||||
|
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||||
|
import { http, HttpResponse } from 'msw';
|
||||||
|
import { setupServer } from 'msw/node';
|
||||||
|
import { ChakraProvider, theme as chakraTheme } from '@chakra-ui/react';
|
||||||
|
import { Provider } from 'react-redux';
|
||||||
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
|
|
||||||
|
import ErrorBoundary from '../../components/ErrorBoundary';
|
||||||
|
import { store } from '../../__data__/store';
|
||||||
|
import Page from '../arm';
|
||||||
|
|
||||||
|
const server = setupServer(
|
||||||
|
http.get('/api/arm/masters', () => {
|
||||||
|
return HttpResponse.json({
|
||||||
|
success: true,
|
||||||
|
body: [
|
||||||
|
{
|
||||||
|
id: '4545423234',
|
||||||
|
name: 'Иван Иванов',
|
||||||
|
phone: '+7 900 123 45 67',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Олег Макаров',
|
||||||
|
phone: '79001234567',
|
||||||
|
id: '23423442',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '345354234',
|
||||||
|
name: 'Иван Галкин',
|
||||||
|
schedule: [
|
||||||
|
{
|
||||||
|
id: 'order1',
|
||||||
|
startWashTime: '2024-11-24T10:30:00.000Z',
|
||||||
|
endWashTime: '2024-11-24T16:30:00.000Z',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'order2',
|
||||||
|
startWashTime: '2024-11-24T11:30:00.000Z',
|
||||||
|
endWashTime: '2024-11-24T17:30:00.000Z',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
phone: '+7 900 123 45 67',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
jest.mock('@brojs/cli', () => {
|
||||||
|
return {
|
||||||
|
getNavigationValue: (key: string) =>
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
|
require('../../../bro.config').navigations[key],
|
||||||
|
getConfigValue: () => '/api',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Master Page', () => {
|
||||||
|
beforeAll(() => server.listen());
|
||||||
|
afterEach(() => server.resetHandlers());
|
||||||
|
afterAll(() => server.close());
|
||||||
|
|
||||||
|
it('render ', async () => {
|
||||||
|
server.events.on('request:start', ({ request }) => {
|
||||||
|
console.log('Outgoing:', request.method, request.url);
|
||||||
|
});
|
||||||
|
|
||||||
|
const { container } = render(
|
||||||
|
<Provider store={store}>
|
||||||
|
<ChakraProvider theme={chakraTheme}>
|
||||||
|
<ErrorBoundary>
|
||||||
|
<BrowserRouter>
|
||||||
|
<Page mockUser={{ name: 'ilnaz' }} />
|
||||||
|
</BrowserRouter>
|
||||||
|
</ErrorBoundary>
|
||||||
|
</ChakraProvider>
|
||||||
|
</Provider>,
|
||||||
|
);
|
||||||
|
|
||||||
|
const button = await waitFor(() => screen.getByTestId('master-button'));
|
||||||
|
|
||||||
|
fireEvent.click(button);
|
||||||
|
|
||||||
|
await waitFor(() => screen.getByText('Иван Иванов'));
|
||||||
|
|
||||||
|
expect(container).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
67
src/pages/__tests__/ordersEmpty.test.tsx
Normal file
67
src/pages/__tests__/ordersEmpty.test.tsx
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import {
|
||||||
|
describe,
|
||||||
|
it,
|
||||||
|
jest,
|
||||||
|
beforeAll,
|
||||||
|
afterEach,
|
||||||
|
afterAll,
|
||||||
|
} from '@jest/globals';
|
||||||
|
import { render, screen, waitFor } from '@testing-library/react';
|
||||||
|
import { http, HttpResponse } from 'msw';
|
||||||
|
import { setupServer } from 'msw/node';
|
||||||
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
|
import { ChakraProvider, theme as chakraTheme } from '@chakra-ui/react';
|
||||||
|
import { Provider } from 'react-redux';
|
||||||
|
|
||||||
|
import ErrorBoundary from '../../components/ErrorBoundary';
|
||||||
|
import { store } from '../../__data__/store';
|
||||||
|
import Page from '../arm';
|
||||||
|
|
||||||
|
const server = setupServer(
|
||||||
|
http.post('/api/arm/orders', () => {
|
||||||
|
return HttpResponse.json({
|
||||||
|
success: true,
|
||||||
|
body: [],
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
http.get('/api/arm/masters', () => {
|
||||||
|
return HttpResponse.json({
|
||||||
|
success: true,
|
||||||
|
body: [],
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
jest.mock('@brojs/cli', () => {
|
||||||
|
return {
|
||||||
|
getNavigationValue: () => '/auth/login',
|
||||||
|
getConfigValue: () => '/api',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('order page', () => {
|
||||||
|
beforeAll(() => server.listen());
|
||||||
|
afterEach(() => server.resetHandlers());
|
||||||
|
afterAll(() => server.close());
|
||||||
|
|
||||||
|
it('получение пустого списка', async () => {
|
||||||
|
server.events.on('request:start', ({ request }) => {
|
||||||
|
console.log('Outgoing:', request.method, request.url);
|
||||||
|
});
|
||||||
|
|
||||||
|
render(
|
||||||
|
<Provider store={store}>
|
||||||
|
<ChakraProvider theme={chakraTheme}>
|
||||||
|
<ErrorBoundary>
|
||||||
|
<BrowserRouter>
|
||||||
|
<Page mockUser={{ name: 'ilnaz' }} />
|
||||||
|
</BrowserRouter>
|
||||||
|
</ErrorBoundary>
|
||||||
|
</ChakraProvider>
|
||||||
|
</Provider>,
|
||||||
|
);
|
||||||
|
|
||||||
|
await waitFor(() => screen.getByText('Список пуст'));
|
||||||
|
});
|
||||||
|
});
|
||||||
64
src/pages/__tests__/ordersError.test.tsx
Normal file
64
src/pages/__tests__/ordersError.test.tsx
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import {
|
||||||
|
describe,
|
||||||
|
it,
|
||||||
|
jest,
|
||||||
|
beforeAll,
|
||||||
|
afterEach,
|
||||||
|
afterAll,
|
||||||
|
expect,
|
||||||
|
} from '@jest/globals';
|
||||||
|
import { render, screen, waitFor } from '@testing-library/react';
|
||||||
|
import { http, HttpResponse } from 'msw';
|
||||||
|
import { setupServer } from 'msw/node';
|
||||||
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
|
import { ChakraProvider, theme as chakraTheme } from '@chakra-ui/react';
|
||||||
|
import { Provider } from 'react-redux';
|
||||||
|
|
||||||
|
import ErrorBoundary from '../../components/ErrorBoundary';
|
||||||
|
import { store } from '../../__data__/store';
|
||||||
|
import Page from '../arm';
|
||||||
|
import { PageSpinner } from '../../components';
|
||||||
|
|
||||||
|
const server = setupServer(
|
||||||
|
http.get('/api/arm/orders', () => {
|
||||||
|
return HttpResponse.json({}, { status: 500 });
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
jest.mock('@brojs/cli', () => {
|
||||||
|
return {
|
||||||
|
getNavigationValue: () => '/auth/login',
|
||||||
|
getConfigValue: () => '/api',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('order page', () => {
|
||||||
|
beforeAll(() => server.listen());
|
||||||
|
afterEach(() => server.resetHandlers());
|
||||||
|
afterAll(() => server.close());
|
||||||
|
|
||||||
|
it('обработка ошибки при загрузке данных', async () => {
|
||||||
|
render(
|
||||||
|
<Provider store={store}>
|
||||||
|
<ChakraProvider theme={chakraTheme}>
|
||||||
|
<ErrorBoundary>
|
||||||
|
<BrowserRouter>
|
||||||
|
<Page mockUser={{ name: 'ilnaz' }} />
|
||||||
|
</BrowserRouter>
|
||||||
|
</ErrorBoundary>
|
||||||
|
</ChakraProvider>
|
||||||
|
</Provider>,
|
||||||
|
);
|
||||||
|
|
||||||
|
await waitFor(() => screen.getByText('Ошибка при загрузке данных'));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Routers', () => {
|
||||||
|
it('отображает PageSpinner ', async () => {
|
||||||
|
render(<PageSpinner />);
|
||||||
|
|
||||||
|
expect(await screen.findByTestId('spinner')).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import * as React from 'react';
|
||||||
import {
|
import {
|
||||||
describe,
|
describe,
|
||||||
it,
|
it,
|
||||||
@@ -12,7 +12,11 @@ import { render, screen, waitFor } from '@testing-library/react';
|
|||||||
import { http, HttpResponse } from 'msw';
|
import { http, HttpResponse } from 'msw';
|
||||||
import { setupServer } from 'msw/node';
|
import { setupServer } from 'msw/node';
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
|
import { ChakraProvider, theme as chakraTheme } from '@chakra-ui/react';
|
||||||
|
import { Provider } from 'react-redux';
|
||||||
|
|
||||||
|
import ErrorBoundary from '../../components/ErrorBoundary';
|
||||||
|
import { store } from '../../__data__/store';
|
||||||
import Page from '../arm';
|
import Page from '../arm';
|
||||||
|
|
||||||
const server = setupServer(
|
const server = setupServer(
|
||||||
@@ -87,17 +91,6 @@ const server = setupServer(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
jest.mock('react-i18next', () => {
|
|
||||||
return {
|
|
||||||
useTranslation: () => {
|
|
||||||
return {
|
|
||||||
t: (key: never) => `${key}`,
|
|
||||||
i18n: {},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
jest.mock('@brojs/cli', () => {
|
jest.mock('@brojs/cli', () => {
|
||||||
return {
|
return {
|
||||||
getNavigationValue: () => '/auth/login',
|
getNavigationValue: () => '/auth/login',
|
||||||
@@ -105,24 +98,28 @@ jest.mock('@brojs/cli', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Arm Page', () => {
|
describe('order page', () => {
|
||||||
beforeAll(() => server.listen());
|
beforeAll(() => server.listen());
|
||||||
afterEach(() => server.resetHandlers());
|
afterEach(() => server.resetHandlers());
|
||||||
afterAll(() => server.close());
|
afterAll(() => server.close());
|
||||||
|
|
||||||
it('render ', async () => {
|
it('получение списка заказов ', async () => {
|
||||||
server.events.on('request:start', ({ request }) => {
|
server.events.on('request:start', ({ request }) => {
|
||||||
console.log('Outgoing:', request.method, request.url);
|
console.log('Outgoing:', request.method, request.url);
|
||||||
});
|
});
|
||||||
|
|
||||||
const { container } = render(
|
const { container } = render(
|
||||||
|
<Provider store={store}>
|
||||||
|
<ChakraProvider theme={chakraTheme}>
|
||||||
|
<ErrorBoundary>
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Page mockUser={{ name: 'ilnaz' }} />
|
<Page mockUser={{ name: 'ilnaz' }} />
|
||||||
</BrowserRouter>,
|
</BrowserRouter>
|
||||||
|
</ErrorBoundary>
|
||||||
|
</ChakraProvider>
|
||||||
|
</Provider>,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(container).toMatchSnapshot();
|
|
||||||
|
|
||||||
await waitFor(() => screen.getByText('A123BC'));
|
await waitFor(() => screen.getByText('A123BC'));
|
||||||
|
|
||||||
expect(container).toMatchSnapshot();
|
expect(container).toMatchSnapshot();
|
||||||
@@ -1,7 +1,13 @@
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import { useToast } from "@chakra-ui/react";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import { Order } from "../../models/landing";
|
import { Order } from "../../models/landing";
|
||||||
import { OrderFormValues } from "../../components/order-form";
|
import { OrderFormValues } from "../../components/order-form";
|
||||||
|
import { isErrorMessage } from "../../models/api";
|
||||||
|
import { URLs } from '../../__data__/urls';
|
||||||
|
|
||||||
const removeAllSpaces = (str: string) => str.replace(/\s+/g, '');
|
const removeAllSpaces = (str: string) => str.replace(/\s+/g, '');
|
||||||
|
|
||||||
@@ -27,3 +33,39 @@ export const formatFormValues = ({ phone, carNumber, carBody, carColor, carLocat
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const useHandleCreateOrderMutationResponse = (query: {
|
||||||
|
isSuccess: boolean;
|
||||||
|
data?: {
|
||||||
|
id: Parameters<typeof URLs.orderView.getUrl>[0];
|
||||||
|
};
|
||||||
|
isError: boolean;
|
||||||
|
error?: unknown;
|
||||||
|
}) => {
|
||||||
|
const toast = useToast();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const { t } = useTranslation('~', {
|
||||||
|
keyPrefix: 'dry-wash.order-create.create-order-query',
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (query.isError) {
|
||||||
|
toast({
|
||||||
|
status: 'error',
|
||||||
|
title: t('error.title'),
|
||||||
|
description: isErrorMessage(query.error) ? query.error : undefined,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [query.isError]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (query.isSuccess) {
|
||||||
|
const orderId = query.data.id;
|
||||||
|
navigate({ pathname: URLs.orderView.getUrl(orderId) });
|
||||||
|
toast({
|
||||||
|
status: 'success',
|
||||||
|
title: t('success.title'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [query.isSuccess]);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,41 +1,29 @@
|
|||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Container, Heading, useToast, VStack } from '@chakra-ui/react';
|
import { Container, Heading, VStack } from '@chakra-ui/react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { Player as LottiePlayer } from '@lottiefiles/react-lottie-player';
|
||||||
|
|
||||||
import { withLandingThemeProvider } from '../../containers';
|
import { withLandingThemeProvider } from '../../containers';
|
||||||
import { OrderForm, OrderFormProps } from '../../components/order-form';
|
import { OrderForm, OrderFormProps } from '../../components/order-form';
|
||||||
import { useCreateOrderMutation } from '../../api';
|
import { landingApi } from '../../__data__/service/landing.api';
|
||||||
import { URLs } from '../../__data__/urls';
|
import { OrderCreationAnimation } from '../../assets/animation';
|
||||||
|
|
||||||
import { formatFormValues } from './helper';
|
import {
|
||||||
|
formatFormValues,
|
||||||
|
useHandleCreateOrderMutationResponse,
|
||||||
|
} from './helper';
|
||||||
|
|
||||||
const Page: FC = () => {
|
const Page: FC = () => {
|
||||||
const { t } = useTranslation('~', {
|
const { t } = useTranslation('~', {
|
||||||
keyPrefix: 'dry-wash.order-create',
|
keyPrefix: 'dry-wash.order-create',
|
||||||
});
|
});
|
||||||
|
|
||||||
const [createOrder, createOrderMutation] = useCreateOrderMutation();
|
const [createOrder, createOrderMutation] =
|
||||||
|
landingApi.useCreateOrderMutation();
|
||||||
const toast = useToast();
|
useHandleCreateOrderMutationResponse(createOrderMutation);
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const onOrderFormSubmit: OrderFormProps['onSubmit'] = (values) => {
|
const onOrderFormSubmit: OrderFormProps['onSubmit'] = (values) => {
|
||||||
createOrder({ body: formatFormValues(values) })
|
createOrder({ body: formatFormValues(values) });
|
||||||
.then(({ body: { id: orderId } }) => {
|
|
||||||
navigate({ pathname: URLs.orderView.getUrl(orderId) });
|
|
||||||
toast({
|
|
||||||
status: 'success',
|
|
||||||
title: t('create-order-query.success.title'),
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(({ error: errorMessage }) => {
|
|
||||||
toast({
|
|
||||||
status: 'error',
|
|
||||||
title: t('create-order-query.error.title'),
|
|
||||||
description: errorMessage,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -48,6 +36,8 @@ const Page: FC = () => {
|
|||||||
centerContent
|
centerContent
|
||||||
>
|
>
|
||||||
<VStack w='full' h='full' alignItems='stretch' flexGrow={1}>
|
<VStack w='full' h='full' alignItems='stretch' flexGrow={1}>
|
||||||
|
{createOrderMutation.isUninitialized ? (
|
||||||
|
<>
|
||||||
<Heading textAlign='center' mt={4}>
|
<Heading textAlign='center' mt={4}>
|
||||||
{t('title')}
|
{t('title')}
|
||||||
</Heading>
|
</Heading>
|
||||||
@@ -55,6 +45,15 @@ const Page: FC = () => {
|
|||||||
onSubmit={onOrderFormSubmit}
|
onSubmit={onOrderFormSubmit}
|
||||||
loading={createOrderMutation.isLoading}
|
loading={createOrderMutation.isLoading}
|
||||||
/>
|
/>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<LottiePlayer autoplay loop src={OrderCreationAnimation} />
|
||||||
|
<Heading textAlign='center' mt={4}>
|
||||||
|
{t('order-creation-title')}
|
||||||
|
</Heading>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</VStack>
|
</VStack>
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
import { OrderDetails } from '../../components/order-view';
|
import { OrderDetails } from '../../components/order-view';
|
||||||
import { Order } from '../../models/landing';
|
import { Order } from '../../models/landing';
|
||||||
import { landingApi } from '../../__data__/service/landing.api';
|
import { landingApi } from '../../__data__/service/landing.api';
|
||||||
import { ErrorMessage } from '../../models/api';
|
import { isErrorMessage } from '../../models/api';
|
||||||
import { FEATURE } from '../../__data__/features';
|
import { FEATURE } from '../../__data__/features';
|
||||||
|
|
||||||
const Page: FC = () => {
|
const Page: FC = () => {
|
||||||
@@ -45,7 +45,7 @@ const Page: FC = () => {
|
|||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
);
|
);
|
||||||
const errorMessage = error as ErrorMessage;
|
const errorMessage = isErrorMessage(error) ? error : undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LandingThemeProvider>
|
<LandingThemeProvider>
|
||||||
@@ -91,7 +91,9 @@ const Page: FC = () => {
|
|||||||
<AlertTitle>
|
<AlertTitle>
|
||||||
{t('get-order-query.error.title')}
|
{t('get-order-query.error.title')}
|
||||||
</AlertTitle>
|
</AlertTitle>
|
||||||
|
{errorMessage && (
|
||||||
<AlertDescription>{errorMessage}</AlertDescription>
|
<AlertDescription>{errorMessage}</AlertDescription>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const router = require('express').Router();
|
const router = require('express').Router();
|
||||||
|
|
||||||
const STUBS = { masters: 'success', orders: 'success', orderView: 'success-pending' };
|
const STUBS = { masters: 'success', orders: 'success', orderCreate: 'success', orderView: 'success-pending' };
|
||||||
|
|
||||||
router.get('/set/:name/:value', (req, res) => {
|
router.get('/set/:name/:value', (req, res) => {
|
||||||
const { name, value } = req.params;
|
const { name, value } = req.params;
|
||||||
@@ -27,6 +27,11 @@ router.get('/', (req, res) => {
|
|||||||
${generateRadioInput('orders', 'empty')}
|
${generateRadioInput('orders', 'empty')}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
<legend>Лендинг - Сделать заказ</legend>
|
||||||
|
${generateRadioInput('orderCreate', 'success')}
|
||||||
|
${generateRadioInput('orderCreate', 'error')}
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
<legend>Лендинг - Детали заказа</legend>
|
<legend>Лендинг - Детали заказа</legend>
|
||||||
${generateRadioInput('orderView', 'success-pending')}
|
${generateRadioInput('orderView', 'success-pending')}
|
||||||
${generateRadioInput('orderView', 'success-working')}
|
${generateRadioInput('orderView', 'success-working')}
|
||||||
|
|||||||
@@ -87,7 +87,15 @@ router.get('/order/:orderId', ({ params }, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.post('/order/create', (req, res) => {
|
router.post('/order/create', (req, res) => {
|
||||||
res.status(200).send({ success: true, body: { ok: true } });
|
const stubName = STUBS.orderCreate;
|
||||||
|
|
||||||
|
res
|
||||||
|
.status(/error/.test(stubName) ? 500 : 200)
|
||||||
|
.send(
|
||||||
|
/^error$/.test(stubName)
|
||||||
|
? commonError
|
||||||
|
: require(`../json/landing-order-create/${stubName}.json`),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.use('/admin', require('./admin'));
|
router.use('/admin', require('./admin'));
|
||||||
|
|||||||
4
stubs/json/landing-order-create/error.json
Normal file
4
stubs/json/landing-order-create/error.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"message": "Не удалось создать заказ"
|
||||||
|
}
|
||||||
6
stubs/json/landing-order-create/success.json
Normal file
6
stubs/json/landing-order-create/success.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"body": {
|
||||||
|
"id": "id1"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user