From c89161b9f31fe9b80d5ede2213533ac4ca54a54c Mon Sep 17 00:00:00 2001 From: Dmitriy Oparin Date: Mon, 30 Nov 2020 16:46:21 +0300 Subject: [PATCH] medhod frameNum call by changed frame --- .../case_22_tag_annotation_mode.js | 25 +++++++++---------- tests/cypress/support/commands.js | 6 +++-- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_22_tag_annotation_mode.js b/tests/cypress/integration/actions_tasks_objects/case_22_tag_annotation_mode.js index aaa69acb..03208d6f 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_22_tag_annotation_mode.js +++ b/tests/cypress/integration/actions_tasks_objects/case_22_tag_annotation_mode.js @@ -10,12 +10,16 @@ context('Tag annotation mode.', () => { const caseId = '22'; function checkCountFrameTags(countTags) { - cy.get('span.cvat-tag-anntation-sidebar-frame-tag-label').should('have.length', countTags); + if (countTags == 0) { + cy.get('span.cvat-tag-anntation-sidebar-frame-tag-label').should('not.exist'); + } else { + cy.get('span.cvat-tag-anntation-sidebar-frame-tag-label').should('have.length', countTags); + }; }; - function checkVisibleFrameTags(labelName) { + function checkPresenceFrameTags(labelName) { cy.get('.cvat-tag-anntation-sidebar-frame-tags').within(() => { - cy.get('span.cvat-tag-anntation-sidebar-frame-tag-label').contains(labelName).should('be.visible'); + cy.get('span.cvat-tag-anntation-sidebar-frame-tag-label').contains(labelName).should('exist'); }); }; @@ -44,7 +48,6 @@ context('Tag annotation mode.', () => { describe(`Testing case "${caseId}"`, () => { it('Go to tag annotation', () => { cy.changeWorkspace('Tag annotation', labelName); - cy.checkFrameNum(0); checkCountFrameTags(0); }); @@ -52,30 +55,26 @@ context('Tag annotation mode.', () => { skipFrame(); cy.checkFrameNum(1); checkCountFrameTags(0); - cy.goToPreviousFrame(); - cy.checkFrameNum(0); + cy.goToPreviousDefaultFrame(0); checkCountFrameTags(0); }); it('Add tag', () => { addTag(); - cy.checkFrameNum(0); checkCountFrameTags(1); - checkVisibleFrameTags(labelName); + checkPresenceFrameTags(labelName); }); it('Set "Automatically go to the next frame" to true and add tag', () => { - cy.goToNextFrame(); - cy.checkFrameNum(1); + cy.goToNextDefaultFrame(1); checkCountFrameTags(0); changeCheckboxAutomaticallyGoToNextFrame("check"); addTag(); cy.checkFrameNum(2); checkCountFrameTags(0); - cy.goToPreviousFrame(); - cy.checkFrameNum(1); + cy.goToPreviousDefaultFrame(1); checkCountFrameTags(1); - checkVisibleFrameTags(labelName); + checkPresenceFrameTags(labelName); }); }); }); diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 0831a7a7..d16e2b15 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -497,10 +497,12 @@ Cypress.Commands.add('checkFrameNum', (frameNum) => { }); }); -Cypress.Commands.add('goToNextFrame', () => { +Cypress.Commands.add('goToNextDefaultFrame', (frameNum) => { cy.get('.cvat-player-next-button').click(); + cy.checkFrameNum(frameNum); }); -Cypress.Commands.add('goToPreviousFrame', () => { +Cypress.Commands.add('goToPreviousDefaultFrame', (frameNum) => { cy.get('.cvat-player-previous-button').click(); + cy.checkFrameNum(frameNum); });