From 20993f63a456b64521bf7c3f422c4b86fbbcb92d Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 29 Sep 2021 11:45:36 +0300 Subject: [PATCH] Fixed upload test --- .../case_52_dump_upload_annotation.js | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/tests/cypress/integration/actions_tasks/case_52_dump_upload_annotation.js b/tests/cypress/integration/actions_tasks/case_52_dump_upload_annotation.js index 365d76b6b613..c9e3e34e6dc3 100644 --- a/tests/cypress/integration/actions_tasks/case_52_dump_upload_annotation.js +++ b/tests/cypress/integration/actions_tasks/case_52_dump_upload_annotation.js @@ -47,17 +47,22 @@ context('Dump/Upload annotation.', { browser: '!firefox' }, () => { cy.contains('.cvat-menu-load-submenu-item', exportFormat.split(' ')[0]) .should('be.visible') .within(() => { - cy.get('.cvat-menu-load-submenu-item-button') - .click() - .get('input[type=file]') - .attachFile(annotationArchiveNameCustomeName); + cy.get('.cvat-menu-load-submenu-item-button').click(); }); + // when a user clicks, menu is closing and it triggers rerender + // we use mouseout here to emulate user behaviour + cy.get('.cvat-actions-menu').trigger('mouseout').should('be.hidden'); + cy.contains('.cvat-menu-load-submenu-item', exportFormat.split(' ')[0]).within(() => { + cy.get('input[type=file]').attachFile(annotationArchiveNameCustomeName); + }); } function confirmUpdate(modalWindowClassName) { - cy.get(modalWindowClassName).should('be.visible').within(() => { - cy.contains('button', 'Update').click(); - }); + cy.get(modalWindowClassName) + .should('be.visible') + .within(() => { + cy.contains('button', 'Update').click(); + }); } before(() => { @@ -72,7 +77,7 @@ context('Dump/Upload annotation.', { browser: '!firefox' }, () => { as: 'exportAnnotationsRenameArchive', type: 'annotations', format: exportFormat, - archiveCustomeName: 'task_export_annotation_custome_name' + archiveCustomeName: 'task_export_annotation_custome_name', }; cy.exportTask(exportAnnotationRenameArchive); const regex = new RegExp(`^${exportAnnotationRenameArchive.archiveCustomeName}.zip$`); @@ -95,7 +100,9 @@ context('Dump/Upload annotation.', { browser: '!firefox' }, () => { cy.saveJob('PUT'); cy.get('#cvat_canvas_shape_1').should('not.exist'); cy.get('#cvat-objects-sidebar-state-item-1').should('not.exist'); - const regex = new RegExp(`^task_${taskName.toLowerCase()}-.*-${exportAnnotation.format.toLowerCase()}.*.zip$`); + const regex = new RegExp( + `^task_${taskName.toLowerCase()}-.*-${exportAnnotation.format.toLowerCase()}.*.zip$`, + ); cy.task('listFiles', 'cypress/fixtures').each((fileName) => { if (fileName.match(regex)) { cy.readFile(`cypress/fixtures/${fileName}`).should('exist'); @@ -109,11 +116,14 @@ context('Dump/Upload annotation.', { browser: '!firefox' }, () => { cy.contains('.cvat-menu-load-submenu-item', exportFormat.split(' ')[0]) .should('be.visible') .within(() => { - cy.get('.cvat-menu-load-submenu-item-button') - .click() - .get('input[type=file]') - .attachFile(annotationArchiveName); + cy.get('.cvat-menu-load-submenu-item-button').click(); }); + // when a user clicks, menu is closing and it triggers rerender + // we use mouseout here to emulate user behaviour + cy.get('.cvat-annotation-menu').trigger('mouseout').should('be.hidden'); + cy.contains('.cvat-menu-load-submenu-item', exportFormat.split(' ')[0]).within(() => { + cy.get('input[type=file]').attachFile(annotationArchiveName); + }); confirmUpdate('.cvat-modal-content-load-job-annotation'); cy.intercept('GET', '/api/v1/jobs/**/annotations**').as('uploadAnnotationsGet'); cy.wait('@uploadAnnotationsGet').its('response.statusCode').should('equal', 200);