Skip to content

Commit

Permalink
Update cypress test. Review pipeline feature. (#3118)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

Co-authored-by: Dmitry Kalinin <[email protected]>
  • Loading branch information
dvkruchinin and ActiveChooN authored Apr 23, 2021
1 parent 2a9a1e9 commit 1790800
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
});
}
Expand All @@ -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.', () => {
Expand Down
11 changes: 9 additions & 2 deletions tests/cypress/support/commands_review_pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 1790800

Please sign in to comment.