@ -4,12 +4,22 @@
/// <reference types="cypress" />
/// <reference types="cypress" />
import { taskName } from '../../support/const' ;
import { taskName , labelName } from '../../support/const' ;
context ( 'Collapse sidebar/appearance ', ( ) => {
context ( 'Collapse sidebar/appearance . Check issue 3250 (empty sidebar after resizing window). ', ( ) => {
const caseId = '30' ;
const caseId = '30' ;
let defaultValueLeftBackground ;
let defaultValueLeftBackground ;
const createRectangleShape2Points = {
points : 'By 2 Points' ,
type : 'Shape' ,
labelName : labelName ,
firstX : 250 ,
firstY : 350 ,
secondX : 350 ,
secondY : 450 ,
} ;
function checkEqualBackground ( ) {
function checkEqualBackground ( ) {
cy . get ( '#cvat_canvas_background' )
cy . get ( '#cvat_canvas_background' )
. should ( 'have.css' , 'left' )
. should ( 'have.css' , 'left' )
@ -21,6 +31,7 @@ context('Collapse sidebar/appearance', () => {
before ( ( ) => {
before ( ( ) => {
cy . openTaskJob ( taskName ) ;
cy . openTaskJob ( taskName ) ;
cy . createRectangle ( createRectangleShape2Points ) ;
// get default left value from background
// get default left value from background
cy . get ( '#cvat_canvas_background' )
cy . get ( '#cvat_canvas_background' )
@ -31,8 +42,8 @@ context('Collapse sidebar/appearance', () => {
} ) ;
} ) ;
describe ( ` Testing case " ${ caseId } " ` , ( ) => {
describe ( ` Testing case " ${ caseId } " ` , ( ) => {
it ( 'Collapse sidebar ', ( ) => {
it ( 'Collapse sidebar . Cheeck issue 3250. ', ( ) => {
// hide
// hide sidebar
cy . get ( '.cvat-objects-sidebar-sider' ) . click ( ) ;
cy . get ( '.cvat-objects-sidebar-sider' ) . click ( ) ;
cy . get ( '.cvat-objects-sidebar' ) . should ( 'not.be.visible' ) ;
cy . get ( '.cvat-objects-sidebar' ) . should ( 'not.be.visible' ) ;
cy . get ( '#cvat_canvas_background' )
cy . get ( '#cvat_canvas_background' )
@ -42,13 +53,22 @@ context('Collapse sidebar/appearance', () => {
expect ( currentValueLeftBackground ) . to . be . greaterThan ( defaultValueLeftBackground ) ;
expect ( currentValueLeftBackground ) . to . be . greaterThan ( defaultValueLeftBackground ) ;
} ) ;
} ) ;
// wait when background fitted
// Check issue 3250
cy . wait ( 500 ) ;
cy . get ( '#cvat_canvas_content' ) . invoke ( 'attr' , 'style' ) . then ( ( canvasContainerStyle ) => {
cy . viewport ( 2999 , 2999 ) ; // Resize window
cy . get ( '#cvat_canvas_content' ) . should ( 'have.attr' , 'style' ) . and ( 'not.equal' , canvasContainerStyle ) ;
cy . viewport ( Cypress . config ( 'viewportWidth' ) , Cypress . config ( 'viewportHeight' ) ) ; // Return to the original size
cy . get ( '#cvat_canvas_content' ) . should ( 'have.attr' , 'style' ) . and ( 'equal' , canvasContainerStyle ) ;
} ) ;
// unhide
// unhide sidebar
cy . get ( '.cvat-objects-sidebar-sider' ) . click ( ) ;
cy . get ( '.cvat-objects-sidebar-sider' ) . click ( ) ;
cy . get ( '.cvat-objects-sidebar' ) . should ( 'be.visible' ) ;
cy . get ( '.cvat-objects-sidebar' ) . should ( 'be.visible' ) ;
checkEqualBackground ( ) ;
checkEqualBackground ( ) ;
// Before the issue fix the sidebar item did not appear accordingly it was not possible to activate the shape through the sidebar item
cy . get ( ` #cvat-objects-sidebar-state-item-1 ` ) . trigger ( 'mouseover' ) ;
cy . get ( '#cvat_canvas_shape_1' ) . should ( 'have.class' , 'cvat_canvas_shape_activated' ) ;
} ) ;
} ) ;
it ( 'Collapse appearance' , ( ) => {
it ( 'Collapse appearance' , ( ) => {