-
Notifications
You must be signed in to change notification settings - Fork 5
Client part of TestY. #2
base: master
Are you sure you want to change the base?
Conversation
…nted pages related to suites and test cases.
Add realisation
… a separate function.
Test plans
Authorization, projects, attachments
Attachments
…parent suite is deleted. I tested the basic functionality using e2e on the pages of suites and test cases.
…variable that stored the element that needed to be deleted.
…mmands to run cypress tests in the terminal and visual window. Updated the documentation.
(cherry picked from commit 2353105)
…the functionality on the suite and cases page.
…the functionality on the suite and cases page.
…nted pages related to suites and test cases. (cherry picked from commit afb8feb)
const [currentSuiteNumber, setCurrentSuiteNumber] = useState<number>(0) | ||
const [totalSuitesNumber, setTotalSuitesNumber] = useState<number>(0) | ||
const [suitesHtmlElmArrayLocal, setSuitesHtmlElmArrayLocal] = useState<any[]>([]) | ||
const [hover, setHover] = useState<any>(null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я не увидел где используется это состояние, кроме как его редактирование
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Речь о состоянии hover? Hover хранит html элемент, который выделен цветом (как в браузерном поиске), при переключении на следующий, через hover обращаемся к этому элементу и снимаем выделение.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
да, про hover, понял, ну это прям совсем не гуд, от такого нужно постараться уйти
или через useRef изменять состояние выделения или по православному через обычный css, если это возможно
if (suitesHtmlElmArray.length > 0) { | ||
setCurrentSuiteNumber(1) | ||
setTotalSuitesNumber(suitesHtmlElmArray.length) | ||
suitesHtmlElmArray[0].scrollIntoView({block: "center", inline: "nearest"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
прямое изменение св-в html нод в реакте, это плохо, плохо влияет на производительность и это хак в обход самого реакта
для этого лучше использовать useRef, вешать ref на элемент и обращаться к нему через ref.current
const checkIfAllSelected = () => { | ||
if (row.test_cases.length > 0) { | ||
for (let i = 0; i < row.test_cases.length; i++) { | ||
if (selectedCases.indexOf(row.test_cases[i].id) === -1) { | ||
return false | ||
} | ||
} | ||
return true | ||
} | ||
return false | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
обернуть в useMemo, это улучшит производительность
|
||
); | ||
} | ||
export default TableSuites |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
507 строк :)
3 компонента в одном файле, желательно разбить на несколько
const createTestPlan = (e: React.FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
const projectId = JSON.parse(localStorage.getItem("currentProject") ?? '{"id" : null}').id | ||
if (projectId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Есть вариант сохранить видимую вложенность подобных условий
Заменяем эту строку на if (!projectId) return
И весь ниже описанный код сдвинется влево, это сугубо индивидуально, но легко позволяет не разводить лапшу
</div> | ||
<table> | ||
<tbody> | ||
{test.test_results.slice(0).map((testResult, index) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем тут slice(0) ?
итерация итак начнется с 0 индекса
title: string; | ||
} | ||
|
||
const bfs = (startTrees: treeTestPlan[], testPlanId: number) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не нужно экономить с названием функций, что такое bfs сходу не понять
const [currentTestPlan, setCurrentTestPlan] = useState<testPlan | undefined>() | ||
const [detailedTestInfo, setDetailedTestInfo] = useState<{ show: boolean, test: test } | null>(null) | ||
const [showEnterResult, setShowEnterResult] = useState(false) | ||
const testPlanId = window.location.pathname === "/testplans" ? null : Number(window.location.pathname.slice("/testplans/".length)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useParams хук в react-router-dom
const handleLogin = (e: React.FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
AuthService.login(username, password) | ||
.then(() => window.location.assign("/")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
хук useNavigate - react-router-dom
( | ||
// Returning table row with data | ||
<TableRow id={`row-${planIndex}`} key={planIndex} style={{cursor: "pointer"}} hover={true} | ||
onClick={() => window.location.assign("/testplans/" + testplanData[0])}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
хук useNavigate - react-router-dom
Можете взять за основу этот eslint конфиг
|
Merge in TOOL/tms from login_and_dashboard to dev Squashed commit of the following: commit 975f967022a84c5da8e079b85f191b6ccbe1a0a7 Author: e.efremova <[email protected]> Date: Tue Oct 11 14:51:18 2022 +0300 Fixes after review commit 4775a958527a32ba2ed3e897789b66ff4bea281a Author: e.efremova <[email protected]> Date: Tue Oct 11 14:42:33 2022 +0300 Fix static path commit 150ba5ed406fa1a58da00be0559c6b63eca1505c Author: e.efremova <[email protected]> Date: Tue Oct 11 14:05:07 2022 +0300 Add base page for content commit 8d6bf4e289b76051c6776ba2a54321bd42e55a87 Author: e.efremova <[email protected]> Date: Tue Oct 11 13:36:49 2022 +0300 Updates commit a392d12cffe1802e3b3d6acc3f7bec9bf0556c30 Merge: 8d70621 14f087c Author: e.efremova <[email protected]> Date: Tue Oct 11 13:15:55 2022 +0300 Merge remote-tracking branch 'origin/dev' into login # Conflicts: # tms/tms/urls.py commit 8d706211a8934ab966929cb6263d45981f96a9dc Author: Dmitry Tkach <[email protected]> Date: Mon Oct 10 16:21:55 2022 +0300 Changed Index function view to class-based view commit bf7e0afc0d5191b5a559650cd387f6b22d27f503 Author: Dmitry Tkach <[email protected]> Date: Fri Oct 7 13:09:35 2022 +0300 Update base and dashboard templates commit a338162e5a2169390437b472c9d31e7fab09caf9 Author: e.efremova <[email protected]> Date: Thu Oct 6 19:00:07 2022 +0300 Add selector for project list commit f9f26a7a9a9d36d5f7a9f485170db353a4c426f9 Author: e.efremova <[email protected]> Date: Thu Oct 6 11:51:03 2022 +0300 Move static/templates dirs, change urls commit 3a5fc63cf34b1d7045c3abc7d548763cd7a9c22f Merge: 45c3bba 93cd88b Author: e.efremova <[email protected]> Date: Thu Oct 6 11:11:40 2022 +0300 Merge remote-tracking branch 'origin/dev' into login_and_dashboard commit 45c3bba4b4695b8b9fdb4e7050b8a90ec1781358 Author: e.efremova <[email protected]> Date: Mon Oct 3 19:55:53 2022 +0300 Add login page and dashboard-draft page
Fix PR comments
Hotfix: fix "React hooks are called conditionally"
# Conflicts: # frontend/cypress/e2e/components/authorization/test.login.logout.cy.ts # frontend/cypress/e2e/components/profile/test.pages.profile.settings.cy.ts # frontend/cypress/e2e/components/projects/test.page.project.cy.ts # frontend/cypress/e2e/components/testcases/test.pages.suites.cases.cy.ts # frontend/package.json # frontend/src/components/models.interfaces.tsx # frontend/src/components/projects/charts/line.chart.component.tsx # frontend/src/components/projects/charts/pie.chart.component.tsx # frontend/src/components/projects/project.tsx # frontend/src/components/projects/selection.project.tsx # frontend/src/components/testcases/creation.case.component.tsx # frontend/src/components/testcases/creation.suite.component.tsx # frontend/src/components/testcases/deletion.dialog.element.component.tsx # frontend/src/components/testcases/deletion.dialog.elements.component.tsx # frontend/src/components/testcases/detailed.case.info.component.tsx # frontend/src/components/testcases/pagination.suites.component.tsx # frontend/src/components/testcases/styles.testcases.tsx # frontend/src/components/testcases/suites.component.tsx # frontend/src/components/testcases/table.suites.component.tsx # frontend/src/index.tsx # frontend/src/services/suite.case.service.tsx # frontend/tsconfig.json
LocalStorage were moved to own class
A lot of fixes in testplans
The client part of the test management system has been implemented. Authorization and basic functionality of working with projects, suites, test cases, test plans and setting up user data in the profile are implemented.