-
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.
Merge branch 'develop' of https://github.com/openvinotoolkit/cvat int…
…o dkru/update-test-case-5-add-scale
- Loading branch information
Showing
6 changed files
with
190 additions
and
8 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
181 changes: 181 additions & 0 deletions
181
tests/cypress/integration/actions_tasks_objects/case_48_issue_2663_annotations_statistics.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,181 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
/// <reference types="cypress" /> | ||
|
||
import { taskName, labelName } from '../../support/const'; | ||
|
||
context('Annotations statistics.', () => { | ||
const caseId = '48'; | ||
const issueId = '2663'; | ||
const createRectangleShape2Points = { | ||
points: 'By 2 Points', | ||
type: 'Shape', | ||
labelName: labelName, | ||
firstX: 250, | ||
firstY: 350, | ||
secondX: 350, | ||
secondY: 450, | ||
}; | ||
const createRectangleTrack2Points = { | ||
points: 'By 2 Points', | ||
type: 'Track', | ||
labelName: labelName, | ||
firstX: createRectangleShape2Points.firstX, | ||
firstY: createRectangleShape2Points.firstY - 150, | ||
secondX: createRectangleShape2Points.secondX, | ||
secondY: createRectangleShape2Points.secondY - 150, | ||
}; | ||
const createCuboidShape2Points = { | ||
points: 'From rectangle', | ||
type: 'Shape', | ||
labelName: labelName, | ||
firstX: 250, | ||
firstY: 350, | ||
secondX: 350, | ||
secondY: 450, | ||
}; | ||
const createCuboidTrack2Points = { | ||
points: 'From rectangle', | ||
type: 'Track', | ||
labelName: labelName, | ||
firstX: createCuboidShape2Points.firstX, | ||
firstY: createCuboidShape2Points.firstY + 150, | ||
secondX: createCuboidShape2Points.secondX, | ||
secondY: createCuboidShape2Points.secondY + 150, | ||
}; | ||
const createPolygonShape = { | ||
reDraw: false, | ||
type: 'Shape', | ||
labelName: labelName, | ||
pointsMap: [ | ||
{ x: 100, y: 100 }, | ||
{ x: 150, y: 100 }, | ||
{ x: 150, y: 150 }, | ||
], | ||
complete: true, | ||
numberOfPoints: null, | ||
}; | ||
const createPolygonTrack = { | ||
reDraw: false, | ||
type: 'Track', | ||
labelName: labelName, | ||
pointsMap: [ | ||
{ x: 200, y: 100 }, | ||
{ x: 250, y: 100 }, | ||
{ x: 250, y: 150 }, | ||
], | ||
complete: true, | ||
numberOfPoints: null, | ||
}; | ||
const createPolylinesShape = { | ||
type: 'Shape', | ||
labelName: labelName, | ||
pointsMap: [ | ||
{ x: 300, y: 100 }, | ||
{ x: 350, y: 100 }, | ||
{ x: 350, y: 150 }, | ||
], | ||
complete: true, | ||
numberOfPoints: null, | ||
}; | ||
const createPolylinesTrack = { | ||
type: 'Track', | ||
labelName: labelName, | ||
pointsMap: [ | ||
{ x: 400, y: 100 }, | ||
{ x: 450, y: 100 }, | ||
{ x: 450, y: 150 }, | ||
], | ||
complete: true, | ||
numberOfPoints: null, | ||
}; | ||
const createPointsShape = { | ||
type: 'Shape', | ||
labelName: labelName, | ||
pointsMap: [{ x: 200, y: 400 }], | ||
complete: true, | ||
numberOfPoints: null, | ||
}; | ||
const createPointsTrack = { | ||
type: 'Track', | ||
labelName: labelName, | ||
pointsMap: [{ x: 300, y: 400 }], | ||
complete: true, | ||
numberOfPoints: null, | ||
}; | ||
|
||
before(() => { | ||
cy.openTaskJob(taskName); | ||
cy.createRectangle(createRectangleShape2Points); | ||
cy.createRectangle(createRectangleTrack2Points); | ||
cy.createTag(labelName); | ||
cy.goToNextFrame(1); | ||
cy.createCuboid(createCuboidShape2Points); | ||
cy.createCuboid(createCuboidTrack2Points); | ||
cy.goToNextFrame(2); | ||
cy.createPolygon(createPolygonShape); | ||
cy.createPolygon(createPolygonTrack); | ||
cy.goToNextFrame(3); | ||
cy.createPolyline(createPolylinesShape); | ||
cy.createPolyline(createPolylinesTrack); | ||
cy.goToNextFrame(4); | ||
cy.createPoint(createPointsShape); | ||
cy.createPoint(createPointsTrack); | ||
}); | ||
|
||
describe(`Testing case "${caseId}"`, () => { | ||
it('Open annotation statistics.', () => { | ||
cy.contains('.cvat-annotation-header-button', 'Info').click(); | ||
cy.get('.cvat-job-info-modal-window').should('be.visible'); | ||
}); | ||
|
||
it(`Check issue ${issueId}`, () => { | ||
// Issue 2663: "Cuboids are missed in annotations statistics" | ||
const objectTypes = ['Rectangle', 'Polygon', 'Polyline', 'Points', 'Cuboids', 'Tags']; | ||
cy.get('.cvat-job-info-statistics') | ||
.find('table') | ||
.first() | ||
.find('tr') | ||
.then((jobInfoTableHeader) => { | ||
cy.get(jobInfoTableHeader) | ||
.find('th') | ||
.then((jobInfoTableHeaderColumns) => { | ||
jobInfoTableHeaderColumns = Array.from(jobInfoTableHeaderColumns); | ||
const elTextContent = jobInfoTableHeaderColumns.map((el) => | ||
el.textContent.replace(/\s/g, ''), | ||
); // Removing spaces. For example: " Tags ". In Firefox, this causes an error. | ||
for (let i = 0; i < objectTypes.length; i++) { | ||
expect(elTextContent).to.include(objectTypes[i]); // expected [ Array(11) ] to include Cuboids, etc. | ||
} | ||
}); | ||
}); | ||
}); | ||
|
||
it('Annotation statistics shows valid results.', () => { | ||
cy.get('.cvat-job-info-statistics') | ||
.find('table') | ||
.last() | ||
.within(() => { | ||
cy.contains(labelName) | ||
.parents('tr') | ||
.find('td') | ||
.then((tableBodyFirstRowThs) => { | ||
tableBodyFirstRowThs = Array.from(tableBodyFirstRowThs); | ||
const elTextContent = tableBodyFirstRowThs.map((el) => el.textContent); | ||
expect(elTextContent[0]).to.be.equal(labelName); | ||
for (let i = 1; i < 6; i++) { | ||
expect(elTextContent[i]).to.be.equal('1 / 1'); // Rectangle, Polygon, Polyline, Points, Cuboids | ||
} | ||
expect(elTextContent[6]).to.be.equal('1'); // Tags | ||
expect(elTextContent[7]).to.be.equal('11'); // Manually | ||
expect(elTextContent[8]).to.be.equal('35'); // Interpolated | ||
expect(elTextContent[9]).to.be.equal('46'); // Total | ||
}); | ||
}); | ||
cy.contains('[type="button"]', 'OK').click(); | ||
cy.get('.cvat-job-info-modal-window').should('not.be.visible'); | ||
}); | ||
}); | ||
}); |