-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cypress test. Collapse sidebar/apperance. (#2549)
* add test * add className for hide/unhide appearance * change version cvat-ui * change version cvat-ui * step get value moved to before method * small fix * small improvements Co-authored-by: Dmitriy Oparin <dmitriyx.oparin@intel.com>
- Loading branch information
1 parent
634e409
commit ca62b6b
Showing
4 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
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
66 changes: 66 additions & 0 deletions
66
tests/cypress/integration/actions_tasks_objects/case_30_collapse_sidebar_apperance.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,66 @@ | ||
// Copyright (C) 2020 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
/// <reference types="cypress" /> | ||
|
||
import { taskName } from '../../support/const'; | ||
|
||
context('Collapse sidebar/apperance', () => { | ||
const caseId = '30'; | ||
let defaultValueLeftBackground; | ||
|
||
function checkEqualBackground() { | ||
cy.get('#cvat_canvas_background') | ||
.should('have.css', 'left') | ||
.and((currentValueLeftBackground) => { | ||
currentValueLeftBackground = Number(currentValueLeftBackground.match(/\d+/)); | ||
expect(currentValueLeftBackground).to.be.eq(defaultValueLeftBackground); | ||
}); | ||
} | ||
|
||
before(() => { | ||
cy.openTaskJob(taskName); | ||
|
||
// get default left value from background | ||
cy.get('#cvat_canvas_background') | ||
.should('have.css', 'left') | ||
.then((currentValueLeftBackground) => { | ||
defaultValueLeftBackground = Number(currentValueLeftBackground.match(/\d+/)); | ||
}); | ||
}); | ||
|
||
describe(`Testing case "${caseId}"`, () => { | ||
it('Collapse sidebar', () => { | ||
// hide | ||
cy.get('.cvat-objects-sidebar-sider').click(); | ||
cy.get('.cvat-objects-sidebar').should('not.be.visible'); | ||
cy.get('#cvat_canvas_background') | ||
.should('have.css', 'left') | ||
.and((currentValueLeftBackground) => { | ||
currentValueLeftBackground = Number(currentValueLeftBackground.match(/\d+/)); | ||
expect(currentValueLeftBackground).to.be.greaterThan(defaultValueLeftBackground); | ||
}); | ||
|
||
// wait when background fitted | ||
cy.wait(500); | ||
|
||
// unhide | ||
cy.get('.cvat-objects-sidebar-sider').click(); | ||
cy.get('.cvat-objects-sidebar').should('be.visible'); | ||
checkEqualBackground(); | ||
}); | ||
|
||
it('Collapse apperance', () => { | ||
// hide | ||
cy.get('.cvat-objects-appearance-collapse-header').click(); | ||
cy.get('.cvat-objects-appearance-content').should('not.be.visible'); | ||
checkEqualBackground(); | ||
|
||
// unhide | ||
cy.get('.cvat-objects-appearance-collapse-header').click(); | ||
cy.get('.cvat-objects-appearance-content').should('be.visible'); | ||
checkEqualBackground(); | ||
}); | ||
}); | ||
}); |