diff --git a/.gitignore b/.gitignore index c375c7df4e7e..2c5deb225eae 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ /share/ /static/ /db.sqlite3 -/.*env* /keys /logs /profiles @@ -49,8 +48,8 @@ yarn-error.log* # Ignore all the installed packages node_modules -venv/ -.venv/ +/*env*/ +/.*env* # Ignore all js dists cvat-data/dist diff --git a/tests/cypress/e2e/actions_objects2/case_delete_frame.js b/tests/cypress/e2e/actions_objects2/case_delete_frame.js index 393fbc17b207..c0b3b34a0c99 100644 --- a/tests/cypress/e2e/actions_objects2/case_delete_frame.js +++ b/tests/cypress/e2e/actions_objects2/case_delete_frame.js @@ -40,12 +40,8 @@ context('Delete frame from job.', () => { cy.checkFrameNum(frame + 1); }); - it('Change deleted frame visability.', () => { - cy.openSettings(); - cy.get('.cvat-workspace-settings-show-deleted').within(() => { - cy.get('[type="checkbox"]').should('not.be.checked').check(); - }); - cy.closeSettings(); + it('Change deleted frame visibility.', () => { + cy.checkDeletedFrameVisibility(); }); it('Check previous frame available and deleted.', () => { diff --git a/tests/cypress/e2e/issues_prs2/issue_8785_update_job_metadata.js b/tests/cypress/e2e/issues_prs2/issue_8785_update_job_metadata.js new file mode 100644 index 000000000000..b3398ff97ba2 --- /dev/null +++ b/tests/cypress/e2e/issues_prs2/issue_8785_update_job_metadata.js @@ -0,0 +1,59 @@ +// Copyright (C) 2024 CVAT.ai Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName } from '../../support/const'; + +context('The UI remains stable even when the metadata request fails.', () => { + const issueId = '8785'; + + function clickDeleteFrame() { + cy.get('.cvat-player-delete-frame').click(); + cy.get('.cvat-modal-delete-frame').within(() => { + cy.contains('button', 'Delete').click(); + }); + } + function clickSave() { + cy.get('button').contains('Save').click({ force: true }); + cy.get('button').contains('Save').trigger('mouseout'); + } + + before(() => { + cy.checkDeletedFrameVisibility(); + cy.openTaskJob(taskName); + cy.goToNextFrame(1); + }); + + describe(`Testing issue ${issueId}`, () => { + it('Crash on Save job. Save again.', () => { + const badResponse = { statusCode: 502, body: 'A horrible network error' }; + + cy.on('uncaught:exception', (err) => { + expect(err.code).to.equal(badResponse.statusCode); + expect(err.message).to.include(`> ${badResponse.body}`); + return false; + }); + + const routeMatcher = { + url: '/api/jobs/**/data/meta**', + method: 'PATCH', + times: 1, // cancels the intercept without retries + }; + + cy.intercept(routeMatcher, badResponse).as('patchError'); + + clickDeleteFrame(); + cy.get('.cvat-player-restore-frame').should('be.visible'); + + clickSave(); + cy.wait('@patchError').then((intercept) => { + expect(intercept.response.body).to.equal(badResponse.body); + expect(intercept.response.statusCode).to.equal(badResponse.statusCode); + }); + + cy.saveJob('PATCH', 200); + }); + }); +}); diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 9941a9b0d5c3..42b7d2772375 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -1683,6 +1683,14 @@ Cypress.Commands.add('hideTooltips', () => { }); }); +Cypress.Commands.add('checkDeletedFrameVisibility', () => { + cy.openSettings(); + cy.get('.cvat-workspace-settings-show-deleted').within(() => { + cy.get('[type="checkbox"]').should('not.be.checked').check(); + }); + cy.closeSettings(); +}); + Cypress.Commands.overwrite('visit', (orig, url, options) => { orig(url, options); cy.closeModalUnsupportedPlatform();