Cypress. Fix case 28. (#3812)

* Fix case 28

* Added additional asserts.

* Added checks

* Added check .cvat-canvas-context-menu not exist

* Revert command

* Add assert
main
Dmitry Kruchinin 4 years ago committed by GitHub
parent 483e4f6a58
commit a18f3eaaa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -246,6 +246,7 @@ context('Review pipeline feature', () => {
it('Use quick issues "Incorrect position". Issue will be created immediately.', () => {
cy.createIssueFromObject('#cvat_canvas_shape_1', 'Quick issue: incorrect position');
cy.checkIssueLabel('Wrong position');
cy.get('.cvat_canvas_issue_region').should('have.length', 1);
});
it('Item submenu: "Quick issue ..." does not appear.', () => {
@ -259,6 +260,7 @@ context('Review pipeline feature', () => {
it('Create different issues with a custom text.', () => {
cy.createIssueFromObject('#cvat_canvas_shape_2', 'Open an issue ...', customeIssueDescription);
cy.checkIssueLabel(customeIssueDescription);
cy.get('.cvat_canvas_issue_region').should('have.length', 2);
});
it('Now item submenu: "Quick issue ..." appears and it contains several latest options.', () => {
@ -278,6 +280,7 @@ context('Review pipeline feature', () => {
it('Use one of items to create quick issue on another object on another frame. Issue has been created.', () => {
cy.goCheckFrameNumber(2);
cy.createIssueFromObject('#cvat_canvas_shape_4', 'Quick issue: incorrect attribute');
cy.get('.cvat_canvas_issue_region').should('have.length', 1);
cy.checkIssueLabel('Wrong attribute');
cy.goCheckFrameNumber(0); // Back to first frame
});
@ -285,6 +288,7 @@ context('Review pipeline feature', () => {
it('Reload page. All the issue still exists.', () => {
cy.reload();
cy.get('.cvat-canvas-container').should('exist');
cy.get('.cvat_canvas_issue_region').should('have.length', 2);
cy.checkIssueLabel(customeIssueDescription);
cy.checkIssueLabel('Wrong position');
});
@ -344,11 +348,9 @@ context('Review pipeline feature', () => {
cy.contains('[role="tab"]', 'Issues').click().should('have.attr', 'aria-selected', 'true');
});
cy.get('.cvat-objects-sidebar-issues-list-header').should('be.visible');
cy.get('.cvat-objects-sidebar-issue-item').then((sidebarIssueItems) => {
cy.get('.cvat-hidden-issue-label').then((issueLabels) => {
expect(sidebarIssueItems.length).to.be.equal(issueLabels.length);
});
});
cy.get('.cvat-objects-sidebar-issue-item').should('have.length', 4);
cy.get('.cvat-hidden-issue-label').should('have.length', 4);
cy.get('.cvat_canvas_issue_region').should('have.length', 4);
});
it('Select an issue on sidebar. Issue indication has changed the color for highlighted issue', () => {

@ -95,31 +95,41 @@ Cypress.Commands.add('checkIssueRegion', () => {
const sccSelectorIssueRegionId = '#cvat_canvas_issue_region_';
cy.collectIssueRegionId().then((issueRegionIdList) => {
const maxId = Math.max(...issueRegionIdList);
cy.get(`${sccSelectorIssueRegionId}${maxId}`).trigger('mousemove').should('exist').and('be.visible');
cy.get(`${sccSelectorIssueRegionId}${maxId}`)
.trigger('mousemove')
.should('be.visible');
});
});
Cypress.Commands.add('createIssueFromObject', (object, issueType, customeIssueDescription) => {
cy.get(object).trigger('mousemove').rightclick();
cy.get('.cvat-canvas-context-menu').within(() => {
cy.contains('.cvat-context-menu-item', new RegExp(`^${issueType}$`, 'g')).click();
cy.get(object).then(($object) => {
const objectFillOpacity = $object.attr('fill-opacity');
cy.get($object)
.trigger('mousemove')
.trigger('mouseover')
.should('have.attr', 'fill-opacity', Number(objectFillOpacity) * 10)
.rightclick();
});
cy.get('.cvat-canvas-context-menu').should('be.visible').within(() => {
cy.contains('.cvat-context-menu-item', new RegExp(`^${issueType}$`)).click();
});
if (issueType === 'Open an issue ...') {
cy.get('.cvat-create-issue-dialog').within(() => {
cy.get('.cvat-create-issue-dialog').should('be.visible').within(() => {
cy.get('#issue_description').type(customeIssueDescription);
cy.get('[type="submit"]').click();
});
} else if (issueType === 'Quick issue ...') {
cy.get('.cvat-quick-issue-from-latest-item')
.should('be.visible')
.contains('.cvat-context-menu-item', new RegExp(`^${customeIssueDescription}$`, 'g'))
.contains('.cvat-context-menu-item', new RegExp(`^${customeIssueDescription}$`))
.click();
}
cy.get('.cvat-canvas-context-menu').should('not.exist');
cy.checkIssueRegion();
});
Cypress.Commands.add('createIssueFromControlButton', (createIssueParams) => {
cy.get('.cvat-issue-control').click();
cy.get('.cvat-issue-control').click().should('have.class', 'cvat-active-canvas-control');
if (createIssueParams.type === 'rectangle') {
cy.get('.cvat-canvas-container')
.trigger('mousedown', createIssueParams.firstX, createIssueParams.firstY, { button: 0 })

Loading…
Cancel
Save