From 44c8709420dad96cc42d893897d43894aaf4f763 Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin <33020454+dvkruchinin@users.noreply.github.com> Date: Wed, 28 Jul 2021 21:57:41 +0300 Subject: [PATCH] Cypress test. Settings. Default number of points in polygon approximation. (#3465) * First stage for points minimizer * Fixed issue with correct opencv initialization status * Displaying points during interaction * Added releasing memory * Initial version for on-the-fly optimization * Redesigned accuracy * Updated version & changelog * Fixed opencv scissors * Clean up some intermediate state * Fixed scss * Redesigned slider a bit * Added errored shape * Keep slider hidden while didn't recieve first points * Adjusted settings slider * Updated label * Cypress test. Settings. Default polygon approximation accuracy level. * The test updated * Rename the test * A couple of fixes for trackers & detectors * Updated default value * Update tests/cypress/integration/actions_tasks/case_100_settings_default_number_of_points_in_polygon_approximation.js Co-authored-by: Boris Sekachev --- ...mber_of_points_in_polygon_approximation.js | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/cypress/integration/actions_tasks/case_100_settings_default_number_of_points_in_polygon_approximation.js diff --git a/tests/cypress/integration/actions_tasks/case_100_settings_default_number_of_points_in_polygon_approximation.js b/tests/cypress/integration/actions_tasks/case_100_settings_default_number_of_points_in_polygon_approximation.js new file mode 100644 index 00000000..819cb4a9 --- /dev/null +++ b/tests/cypress/integration/actions_tasks/case_100_settings_default_number_of_points_in_polygon_approximation.js @@ -0,0 +1,64 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName } from '../../support/const'; + +context('Settings. Default number of points in polygon approximation.', () => { + const caseId = '100'; + + function testOpenSettingsWorkspace() { + cy.document().then((doc) => { + const settingsModal = Array.from(doc.querySelectorAll('.cvat-settings-modal')); + if (settingsModal.length === 0) { + cy.openSettings(); + cy.contains('[role="tab"]', 'Workspace').click(); + } + }); + } + + function testCheckSliderAttrValuenow(expectedValue) { + testOpenSettingsWorkspace(); + cy.get('.cvat-workspace-settings-approx-poly-threshold').find('[role="slider"]').then((slider) => { + expect(slider.attr('aria-valuenow')).to.be.equal(expectedValue); + }); + } + + function generateString(countPointsToMove) { + let action = ''; + for (let i = 0; i < countPointsToMove; i++) { + action += '{rightarrow}'; + } + return action; + } + + before(() => { + cy.openTaskJob(taskName); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Change the setting value for "Default number of points in polygon approximation".', () => { + testOpenSettingsWorkspace(); + cy.get('.cvat-workspace-settings-approx-poly-threshold') + .find('[role="slider"]') + .type(generateString(4)) + .then((slider) => { + const sliderAttrValueNow = slider.attr('aria-valuenow'); + const sliderAttrValuemin = slider.attr('aria-valuemin'); + const sliderAttrValuemax = slider.attr('aria-valuemax'); + cy.saveSettings(); + cy.closeNotification('.cvat-notification-notice-save-settings-success'); + cy.closeSettings(); + cy.reload(); + cy.closeModalUnsupportedPlatform(); // If the Firefox browser closes the modal window after reload + testCheckSliderAttrValuenow(sliderAttrValueNow); + cy.contains('strong', 'less').click(); + testCheckSliderAttrValuenow(sliderAttrValuemin); + cy.contains('strong', 'more').click(); + testCheckSliderAttrValuenow(sliderAttrValuemax); + }); + }); + }); +});