-
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.
Cypress test. Canvas 3d-m4. Check resize views. (#2995)
* Cypress test. Resize views. * Little fix
- Loading branch information
1 parent
538bc93
commit e41c301
Showing
2 changed files
with
84 additions
and
5 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
84 changes: 84 additions & 0 deletions
84
...cypress/integration/canvas3d_functionality/case_62_canvas3d_functionality_views_resize.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,84 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
/// <reference types="cypress" /> | ||
|
||
import { taskName } from '../../support/const_canvas3d'; | ||
|
||
context('Canvas 3D functionality. Resize views.', () => { | ||
const caseId = '62'; | ||
let widthHightArrBeforeResize = []; | ||
let widthHightArrAfterResize = []; | ||
|
||
function getViewWidthHeight(element, arrToPush) { | ||
cy.get(element) | ||
.find('canvas') | ||
.invoke('attr', 'width') | ||
.then(($topviewWidth) => { | ||
cy.get(element) | ||
.find('canvas') | ||
.invoke('attr', 'height') | ||
.then(($topviewHeight) => { | ||
arrToPush.push([$topviewWidth, $topviewHeight]); | ||
}); | ||
}); | ||
} | ||
|
||
before(() => { | ||
cy.openTaskJob(taskName); | ||
getViewWidthHeight('.cvat-canvas3d-perspective', widthHightArrBeforeResize); | ||
getViewWidthHeight('.cvat-canvas3d-topview', widthHightArrBeforeResize); | ||
getViewWidthHeight('.cvat-canvas3d-sideview', widthHightArrBeforeResize); | ||
getViewWidthHeight('.cvat-canvas3d-frontview', widthHightArrBeforeResize); | ||
}); | ||
|
||
describe(`Testing case "${caseId}"`, () => { | ||
it('Resizing perspective.', () => { | ||
cy.get('.cvat-resizable-handle-horizontal').trigger('mousedown', { button: 0, scrollBehavior: false }); | ||
cy.get('.cvat-canvas3d-perspective') | ||
.trigger('mousemove', 600, 300, { scrollBehavior: false }) | ||
.trigger('mouseup'); | ||
getViewWidthHeight('.cvat-canvas3d-perspective', widthHightArrAfterResize); | ||
}); | ||
|
||
it('Resizing topview.', () => { | ||
cy.get('.cvat-resizable-handle-vertical-top').trigger('mousedown', { button: 0, scrollBehavior: false }); | ||
cy.get('.cvat-canvas3d-topview') | ||
.trigger('mousemove', 200, 200, { scrollBehavior: false }) | ||
.trigger('mouseup'); | ||
getViewWidthHeight('.cvat-canvas3d-topview', widthHightArrAfterResize); | ||
}); | ||
|
||
it('Resizing sideview.', () => { | ||
cy.get('.cvat-resizable-handle-vertical-side').trigger('mousedown', { button: 0, scrollBehavior: false }); | ||
cy.get('.cvat-canvas3d-frontview') | ||
.trigger('mousemove', 200, 200, { scrollBehavior: false }) | ||
.trigger('mouseup'); | ||
getViewWidthHeight('.cvat-canvas3d-sideview', widthHightArrAfterResize); | ||
getViewWidthHeight('.cvat-canvas3d-frontview', widthHightArrAfterResize); | ||
}); | ||
|
||
it('Checking for elements resizing.', () => { | ||
expect(widthHightArrBeforeResize[0][0]).to.be.equal(widthHightArrAfterResize[0][0]); // Width of cvat-canvas3d-perspective before and after didn't change | ||
expect(widthHightArrBeforeResize[0][1]).not.be.equal(widthHightArrAfterResize[0][1]); // Height of cvat-canvas3d-perspective changed | ||
expect(widthHightArrAfterResize[1][1]) | ||
.to.be.equal(widthHightArrAfterResize[2][1]) | ||
.to.be.equal(widthHightArrAfterResize[3][1]); // Top/side/front has equal height after changes | ||
[ | ||
[widthHightArrBeforeResize[1][0], widthHightArrAfterResize[1][0]], | ||
[widthHightArrBeforeResize[2][0], widthHightArrAfterResize[2][0]], | ||
[widthHightArrBeforeResize[3][0], widthHightArrAfterResize[3][0]], | ||
].forEach(([widthBefore, widthAfter]) => { | ||
expect(widthBefore).not.be.equal(widthAfter); // Width of top/side/front changed | ||
}); | ||
[ | ||
[widthHightArrBeforeResize[1][1], widthHightArrAfterResize[1][1]], | ||
[widthHightArrBeforeResize[2][1], widthHightArrAfterResize[2][1]], | ||
[widthHightArrBeforeResize[3][1], widthHightArrAfterResize[3][1]], | ||
].forEach(([heightBefore, heightAfter]) => { | ||
expect(heightBefore).not.be.equal(heightAfter); // Height of top/side/front changed | ||
}); | ||
}); | ||
}); | ||
}); |