From 5a4f4ac5c50d61b85a68f1a42d584675aef6234a Mon Sep 17 00:00:00 2001 From: Kirill Lakhov Date: Fri, 17 Jan 2025 11:52:20 +0300 Subject: [PATCH 1/5] added two test cases --- .../components/quality-control/styles.scss | 4 ++-- .../task-quality/quality-table-header.tsx | 6 ++--- .../cypress/e2e/features/ground_truth_jobs.js | 23 ++++++++++++++++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/cvat-ui/src/components/quality-control/styles.scss b/cvat-ui/src/components/quality-control/styles.scss index 40209ed1a1f3..de03967e9acc 100644 --- a/cvat-ui/src/components/quality-control/styles.scss +++ b/cvat-ui/src/components/quality-control/styles.scss @@ -77,7 +77,7 @@ $excluded-background: #d9d9d973; } } -.cvat-frame-allocation-actions { +.cvat-quality-table-header { span[role='img'] { padding: 0 $grid-unit-size; } @@ -87,7 +87,7 @@ $excluded-background: #d9d9d973; } } -.cvat-frame-allocation-header { +.cvat-quality-table-header-title { margin-bottom: 0; font-size: 20px; font-weight: bold; diff --git a/cvat-ui/src/components/quality-control/task-quality/quality-table-header.tsx b/cvat-ui/src/components/quality-control/task-quality/quality-table-header.tsx index dd9f80ab0f45..b7bbf7703e6d 100644 --- a/cvat-ui/src/components/quality-control/task-quality/quality-table-header.tsx +++ b/cvat-ui/src/components/quality-control/task-quality/quality-table-header.tsx @@ -45,12 +45,12 @@ function QualityTableHeader(props: TableHeaderProps): JSX.Element { }; return ( - + - {title} + {title} - + {actions} {!!onSearch && ( diff --git a/tests/cypress/e2e/features/ground_truth_jobs.js b/tests/cypress/e2e/features/ground_truth_jobs.js index ccb2d4964f83..993e5f937add 100644 --- a/tests/cypress/e2e/features/ground_truth_jobs.js +++ b/tests/cypress/e2e/features/ground_truth_jobs.js @@ -1,4 +1,4 @@ -// Copyright (C) 2023-2024 CVAT.ai Corporation +// Copyright (C) 2023-2025 CVAT.ai Corporation // // SPDX-License-Identifier: MIT @@ -356,6 +356,27 @@ context('Ground truth jobs', () => { cy.contains('.cvat-allocation-summary-excluded', '0').should('exist'); cy.contains('.cvat-allocation-summary-active', '3').should('exist'); }); + + it('Check search feature', () => { + cy.get('.cvat-quality-table-search-bar input').clear(); + serverFiles.forEach((file, index) => { + cy.get('.cvat-quality-table-search-bar input').type(`image_${index + 1}`); + cy.get('.cvat-quality-table-search-bar .ant-input-search-button').click(); + cy.get('.cvat-allocation-frame-row').should('have.length', 1); + cy.get('.cvat-allocation-frame-row').within(() => { + cy.contains(file).should('exist'); + }); + cy.get('.cvat-quality-table-search-bar input').clear(); + }); + + cy.get('.cvat-quality-table-search-bar .ant-input-search-button').click(); + cy.get('.cvat-allocation-frame-row').should('have.length', 3); + }); + + it('Check management table .csv representation is available for download', () => { + cy.get('.cvat-quality-table-dowload-button').click(); + cy.verifyDownload(`allocation-table-task_${taskID}.csv`); + }); }); describe('Regression tests', () => { From 39d69c35c3716be524e20d86c7c396a7d209bc4f Mon Sep 17 00:00:00 2001 From: Kirill Lakhov Date: Wed, 22 Jan 2025 10:08:53 +0300 Subject: [PATCH 2/5] update date --- tests/cypress/e2e/features/ground_truth_jobs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/e2e/features/ground_truth_jobs.js b/tests/cypress/e2e/features/ground_truth_jobs.js index 993e5f937add..de59f26c7726 100644 --- a/tests/cypress/e2e/features/ground_truth_jobs.js +++ b/tests/cypress/e2e/features/ground_truth_jobs.js @@ -1,4 +1,4 @@ -// Copyright (C) 2023-2025 CVAT.ai Corporation +// Copyright (C) CVAT.ai Corporation // // SPDX-License-Identifier: MIT From d904a60cdaddfc53511c794d8c4b9920e5678747 Mon Sep 17 00:00:00 2001 From: Kirill Lakhov Date: Wed, 22 Jan 2025 10:48:34 +0300 Subject: [PATCH 3/5] added check for `.csv` file contents --- tests/cypress/e2e/features/ground_truth_jobs.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/cypress/e2e/features/ground_truth_jobs.js b/tests/cypress/e2e/features/ground_truth_jobs.js index 31d1209d7fd2..bd04952d5805 100644 --- a/tests/cypress/e2e/features/ground_truth_jobs.js +++ b/tests/cypress/e2e/features/ground_truth_jobs.js @@ -375,7 +375,20 @@ context('Ground truth jobs', () => { it('Check management table .csv representation is available for download', () => { cy.get('.cvat-quality-table-dowload-button').click(); - cy.verifyDownload(`allocation-table-task_${taskID}.csv`); + + const expectedFileName = `allocation-table-task_${taskID}.csv`; + cy.verifyDownload(expectedFileName); + + const downloadsFolder = Cypress.config('downloadsFolder'); + const filePath = `${downloadsFolder}/${expectedFileName}`; + cy.readFile(filePath).then((csv) => { + const rows = csv.split('\n'); + expect(rows.length).to.equal(4); // 3 frames + header + expect(rows[0]).to.include('frame,name,active'); // Check header + rows.slice(1).forEach((row, index) => { + expect(row).to.include(`images/image_${index + 1}.jpg`); + }); + }); }); }); From 3db6bc4e004f19c725d2c5f6bbb8fdc3feab78ab Mon Sep 17 00:00:00 2001 From: Kirill Lakhov Date: Wed, 22 Jan 2025 11:49:57 +0300 Subject: [PATCH 4/5] use command to check file content --- tests/cypress/e2e/features/ground_truth_jobs.js | 15 ++++----------- tests/cypress/support/commands.js | 13 +++++++++++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/tests/cypress/e2e/features/ground_truth_jobs.js b/tests/cypress/e2e/features/ground_truth_jobs.js index bd04952d5805..61cec62c7481 100644 --- a/tests/cypress/e2e/features/ground_truth_jobs.js +++ b/tests/cypress/e2e/features/ground_truth_jobs.js @@ -374,20 +374,13 @@ context('Ground truth jobs', () => { }); it('Check management table .csv representation is available for download', () => { - cy.get('.cvat-quality-table-dowload-button').click(); + cy.get('.cvat-quality-control-management-tab .cvat-quality-table-dowload-button').click(); const expectedFileName = `allocation-table-task_${taskID}.csv`; cy.verifyDownload(expectedFileName); - - const downloadsFolder = Cypress.config('downloadsFolder'); - const filePath = `${downloadsFolder}/${expectedFileName}`; - cy.readFile(filePath).then((csv) => { - const rows = csv.split('\n'); - expect(rows.length).to.equal(4); // 3 frames + header - expect(rows[0]).to.include('frame,name,active'); // Check header - rows.slice(1).forEach((row, index) => { - expect(row).to.include(`images/image_${index + 1}.jpg`); - }); + cy.checkCsvFileContent(expectedFileName, 'frame,name,active', 4, (row, index) => { + expect(row).to.include(`images/image_${index + 1}.jpg`); + expect(row).to.include('true'); }); }); }); diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 807ec2fb4713..c995c9bc8fca 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -1697,6 +1697,19 @@ Cypress.Commands.add('checkDeletedFrameVisibility', () => { cy.closeSettings(); }); +Cypress.Commands.add('checkCsvFileContent', (expectedFileName, header, rowsCount, checkRow = null) => { + const downloadsFolder = Cypress.config('downloadsFolder'); + const filePath = `${downloadsFolder}/${expectedFileName}`; + cy.readFile(filePath).then((csv) => { + const rows = csv.split('\n'); + expect(rows.length).to.equal(rowsCount); + expect(rows[0]).to.include(header); + if (checkRow) { + rows.slice(1).forEach(checkRow); + } + }); +}); + Cypress.Commands.overwrite('visit', (orig, url, options) => { orig(url, options); cy.closeModalUnsupportedPlatform(); From 759582d7ed958a17da8dc81d86adf59cf499f292 Mon Sep 17 00:00:00 2001 From: Kirill Lakhov Date: Wed, 22 Jan 2025 12:44:24 +0300 Subject: [PATCH 5/5] removed excessive style --- cvat-ui/src/components/quality-control/styles.scss | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cvat-ui/src/components/quality-control/styles.scss b/cvat-ui/src/components/quality-control/styles.scss index 54a42dbbab10..890018337982 100644 --- a/cvat-ui/src/components/quality-control/styles.scss +++ b/cvat-ui/src/components/quality-control/styles.scss @@ -120,10 +120,6 @@ $excluded-background: #d9d9d973; transform: translate(-50%, -50%); } -.cvat-quality-control-overview-tab { - min-height: 50vh; -} - .cvat-annotations-quality-allocation-table-summary { margin-bottom: $grid-unit-size * 2;