From 17908003df9565bab02120c38834023f31eef494 Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin <33020454+dvkruchinin@users.noreply.github.com> Date: Fri, 23 Apr 2021 18:06:01 +0300 Subject: [PATCH] Update cypress test. Review pipeline feature. (#3118) * Upate cypress command. Added the ability to re-open the issue. * Update cypress test. Added re-open an issue. * Apply comments Co-authored-by: Dmitry Kalinin Co-authored-by: Dmitry Kalinin --- .../case_28_review_pipeline_feature.js | 15 +++++++++++---- tests/cypress/support/commands_review_pipeline.js | 11 +++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/tests/cypress/integration/actions_users/registration_involved/case_28_review_pipeline_feature.js b/tests/cypress/integration/actions_users/registration_involved/case_28_review_pipeline_feature.js index 1c2242bd..1b2d6d6b 100644 --- a/tests/cypress/integration/actions_users/registration_involved/case_28_review_pipeline_feature.js +++ b/tests/cypress/integration/actions_users/registration_involved/case_28_review_pipeline_feature.js @@ -381,10 +381,12 @@ context('Review pipeline feature', () => { }); it('Display all the issues again. Comment a couple of issues and resolve all them.', () => { - function resolveIssue() { + function resolveReopenIssue(reopen) { cy.collectIssueLabel().then((issueLabelList) => { for (let label = 0; label < issueLabelList.length; label++) { - cy.resolveIssue(issueLabelList[label], 'Done'); + reopen + ? cy.resolveReopenIssue(issueLabelList[label], 'Please fix', true) + : cy.resolveReopenIssue(issueLabelList[label], 'Done'); } }); } @@ -395,12 +397,17 @@ context('Review pipeline feature', () => { cy.get('.cvat-hidden-issue-label').should('exist').and('have.length', 1); cy.get('.cvat-issues-sidebar-previous-frame').click(); - resolveIssue(); + resolveReopenIssue(); cy.checkIssueLabel('Done', 'resolved'); cy.goCheckFrameNumber(2); - resolveIssue(); + resolveReopenIssue(); cy.checkIssueLabel('Done', 'resolved'); cy.goCheckFrameNumber(0); + + // Reopen issues + resolveReopenIssue(true); + // Resolve again + resolveReopenIssue(); }); it('Request a review again. Assign the third user again. The second user logout.', () => { diff --git a/tests/cypress/support/commands_review_pipeline.js b/tests/cypress/support/commands_review_pipeline.js index 8b1ccbef..18d0ed52 100644 --- a/tests/cypress/support/commands_review_pipeline.js +++ b/tests/cypress/support/commands_review_pipeline.js @@ -137,13 +137,20 @@ Cypress.Commands.add('createIssueFromControlButton', (createIssueParams) => { cy.checkIssueRegion(); }); -Cypress.Commands.add('resolveIssue', (issueLabel, resolveText) => { +Cypress.Commands.add('resolveReopenIssue', (issueLabel, resolveText, reopen) => { cy.get(issueLabel).click(); + cy.intercept('POST', '/api/v1/comments').as('postComment'); + cy.intercept('PATCH', '/api/v1/issues/**').as('resolveReopenIssue'); cy.get('.cvat-issue-dialog-input').type(resolveText); cy.get('.cvat-issue-dialog-footer').within(() => { cy.contains('button', 'Comment').click(); - cy.contains('button', 'Resolve').click(); + reopen + ? cy.contains('button', 'Reopen').click() + : cy.contains('button', 'Resolve').click(); }); + if (reopen) cy.get('.cvat-issue-dialog-header').find('[aria-label="close"]').click(); + cy.wait('@postComment').its('response.statusCode').should('equal', 201); + cy.wait('@resolveReopenIssue').its('response.statusCode').should('equal', 200); }); Cypress.Commands.add('submitReview', (decision, user) => {