-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
264 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
tests/cypress/integration/actions_tasks/case_102_create_link_shape_frame.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
/// <reference types="cypress" /> | ||
|
||
import { taskName, labelName } from '../../support/const'; | ||
|
||
context('Create a link for shape, frame.', () => { | ||
const caseId = '102'; | ||
const createRectangleShape2Points = { | ||
points: 'By 2 Points', | ||
type: 'Shape', | ||
labelName: labelName, | ||
firstX: 250, | ||
firstY: 350, | ||
secondX: 350, | ||
secondY: 450, | ||
}; | ||
|
||
before(() => { | ||
cy.openTaskJob(taskName); | ||
cy.createRectangle(createRectangleShape2Points); | ||
cy.saveJob('PATCH', 200, `case${caseId}`); | ||
}); | ||
|
||
describe(`Testing case "${caseId}"`, () => { | ||
it('Create a link for a shape, for a frame.', () => { | ||
cy.window().then(win => { | ||
cy.stub(win, 'prompt').returns(win.prompt).as('copyToClipboardPromptShape'); | ||
}); | ||
cy.get('#cvat-objects-sidebar-state-item-1').find('[aria-label="more"]').trigger('mouseover'); | ||
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated') | ||
cy.get('.cvat-object-item-menu').last().should('be.visible').contains('button', 'Create object URL').click(); | ||
cy.get('@copyToClipboardPromptShape').should('be.called'); | ||
cy.get('@copyToClipboardPromptShape').then(prompt => { | ||
const url = prompt.args[0][1]; | ||
expect(url).include('frame='); | ||
expect(url).include('type='); | ||
expect(url).include('serverID='); | ||
cy.visit(url); | ||
cy.closeModalUnsupportedPlatform(); | ||
cy.get('.cvat-canvas-container').should('be.visible'); | ||
cy.get('#cvat_canvas_shape_1').should('be.visible'); | ||
}); | ||
|
||
cy.window().then(win => { | ||
cy.stub(win, 'prompt').returns(win.prompt).as('copyToClipboardPromptFrame'); | ||
}); | ||
cy.get('.cvat-player-frame-url-icon').click(); | ||
cy.get('@copyToClipboardPromptFrame').should('be.called'); | ||
cy.get('@copyToClipboardPromptFrame').then(prompt => { | ||
const url = prompt.args[0][1]; | ||
expect(url).include('frame='); | ||
expect(url).not.include('type='); | ||
expect(url).not.include('serverID='); | ||
cy.visit(url); | ||
cy.get('.cvat-canvas-container').should('be.visible'); | ||
cy.get('#cvat_canvas_shape_1').should('be.visible'); | ||
}); | ||
}); | ||
}); | ||
}); |
117 changes: 117 additions & 0 deletions
117
tests/cypress/integration/actions_tasks2/case_101_opencv_basic_actions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
/// <reference types="cypress" /> | ||
|
||
import { taskName, labelName } from '../../support/const'; | ||
import { generateString } from '../../support/utils'; | ||
|
||
context('OpenCV. Intelligent cissors. Histogram Equalization.', () => { | ||
const caseId = '101'; | ||
const newLabel = `Case ${caseId}` | ||
const createOpencvShape = { | ||
labelName: labelName, | ||
pointsMap: [ | ||
{ x: 200, y: 200 }, | ||
{ x: 250, y: 200 }, | ||
{ x: 300, y: 250 }, | ||
{ x: 350, y: 300 }, | ||
{ x: 300, y: 350 }, | ||
], | ||
}; | ||
const createOpencvShapeSecondLabel = { | ||
labelName: newLabel, | ||
pointsMap: [ | ||
{ x: 300, y: 200 }, | ||
{ x: 350, y: 200 }, | ||
{ x: 400, y: 250 }, | ||
{ x: 450, y: 300 }, | ||
{ x: 400, y: 350 }, | ||
], | ||
finishWithButton: true, | ||
}; | ||
const keyCodeN = 78; | ||
const pointsMap = [ | ||
{ x: 300, y: 400 }, | ||
{ x: 350, y: 500 }, | ||
{ x: 400, y: 450 }, | ||
{ x: 450, y: 500 }, | ||
{ x: 400, y: 550 }, | ||
]; | ||
|
||
function openOpencvControlPopover() { | ||
cy.get('body').focus(); | ||
cy.get('.cvat-tools-control').trigger('mouseleave').trigger('mouseout').trigger('mouseover'); | ||
} | ||
|
||
before(() => { | ||
cy.openTask(taskName); | ||
cy.addNewLabel(newLabel); | ||
cy.openJob(); | ||
}); | ||
|
||
describe(`Testing case "${caseId}"`, () => { | ||
it('Load OpenCV.', () => { | ||
openOpencvControlPopover(); | ||
cy.get('.cvat-opencv-control-popover-visible').find('.cvat-opencv-initialization-button').click(); | ||
// Intelligent cissors button be visible | ||
cy.get('.cvat-opencv-drawing-tool').should('exist').and('be.visible'); | ||
}); | ||
|
||
it('Create a shape with "Intelligent cissors". Create the second shape with the label change and "Done" button.', () => { | ||
cy.opencvCreateShape(createOpencvShape); | ||
cy.opencvCreateShape(createOpencvShapeSecondLabel); | ||
}); | ||
|
||
it('Change the number of points when the shape is drawn. Cancel drawing.', () => { | ||
openOpencvControlPopover(); | ||
cy.get('.cvat-opencv-drawing-tool').click(); | ||
pointsMap.forEach((element) => { | ||
cy.get('.cvat-canvas-container').click(element.x, element.y); | ||
}); | ||
cy.get('.cvat_canvas_interact_intermediate_shape').then((intermediateShape) => { | ||
// Get count of points | ||
const intermediateShapeNumberPointsBeforeChange = intermediateShape.attr('points').split(' ').length; | ||
// Change number of points | ||
cy.get('.cvat-approx-poly-threshold-wrapper') | ||
.find('[role="slider"]') | ||
.type(generateString(4, 'rightarrow')); | ||
cy.get('.cvat_canvas_interact_intermediate_shape').then((intermediateShape) => { | ||
// Get count of points againe | ||
const intermediateShapeNumberPointsAfterChange = intermediateShape.attr('points').split(' ').length; | ||
// expected 7 to be below 10 | ||
expect(intermediateShapeNumberPointsBeforeChange).to.be.lt(intermediateShapeNumberPointsAfterChange); | ||
}); | ||
}); | ||
cy.get('body').type('{Esc}'); // Cancel drawing | ||
cy.get('.cvat_canvas_interact_intermediate_shape').should('not.exist'); | ||
cy.get('.cvat_canvas_shape').should('have.length', 2); | ||
}); | ||
|
||
it('Check "Histogram Equalization" feature.', () => { | ||
openOpencvControlPopover(); | ||
cy.get('.cvat-opencv-control-popover-visible').contains('[role="tab"]', 'Image').click(); | ||
cy.get('.cvat-opencv-image-tool').click().should('have.class', 'cvat-opencv-image-tool-active').trigger('mouseout'); | ||
cy.get('.cvat-notification-notice-opencv-processing-error').should('not.exist'); | ||
cy.get('.cvat-opencv-image-tool').click().should('not.have.class', 'cvat-opencv-image-tool-active').trigger('mouseout'); | ||
}); | ||
|
||
// Waiting for fix https://github.com/openvinotoolkit/cvat/issues/3474 | ||
it.skip('Redraw the shape created with "Intelligent cissors".', () => { | ||
cy.get('.cvat-canvas-container').click(); | ||
cy.get('.cvat-opencv-control-popover').should('be.hidden'); | ||
cy.get('#cvat_canvas_shape_1') | ||
.trigger('mousemove') | ||
.trigger('mouseover') | ||
.should('have.class', 'cvat_canvas_shape_activated'); | ||
cy.get('body').trigger('keydown', { keyCode: keyCodeN, shiftKey: true }).trigger('keyup'); | ||
cy.get('.cvat-tools-control').should('have.attr', 'tabindex'); | ||
createOpencvShape.pointsMap.forEach((el) => { | ||
cy.get('.cvat-canvas-container') | ||
.click(el.x + 150, el.y + 50) | ||
}); | ||
cy.get('body').trigger('keydown', { keyCode: keyCodeN }).trigger('keyup'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.