-
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 brightness contrast saturation feature (#2530)
* add test * change type variables, let to const * change type another variables * changed cssSelector to find cvat_canvas_background element * change cssSelector from ant to cvat Co-authored-by: Dmitriy Oparin <[email protected]>
- Loading branch information
1 parent
565020c
commit 09cf807
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
...ntegration/actions_tasks_objects/case_26_canvas_brightness_contrast_saturation_feature.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,62 @@ | ||
// Copyright (C) 2020 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
/// <reference types="cypress" /> | ||
|
||
import { taskName } from '../../support/const'; | ||
|
||
context('Canvas brightness/contrast/saturation feature', () => { | ||
const caseId = '26'; | ||
const countActionMoveSlider = 10; | ||
const defaultValueInSidebar = 100; | ||
const expectedResultInSetting = defaultValueInSidebar + countActionMoveSlider; | ||
const classNameSliders = [ | ||
'.cvat-player-settings-brightness', | ||
'.cvat-player-settings-contrast', | ||
'.cvat-player-settings-saturation', | ||
]; | ||
|
||
function generateStringCountAction(countAction) { | ||
let stringAction = ''; | ||
for (let i = 0; i < countAction; i++) { | ||
stringAction += '{rightarrow}'; | ||
}; | ||
return stringAction; | ||
}; | ||
|
||
function checkStateValuesInBackground(expectedValue) { | ||
cy.get('#cvat_canvas_background') | ||
.should('have.attr', 'style') | ||
.and('contain', `filter: brightness(${expectedValue}) contrast(${expectedValue}) saturate(${expectedValue})`); | ||
}; | ||
|
||
before(() => { | ||
cy.openTaskJob(taskName); | ||
}); | ||
|
||
describe(`Testing case "${caseId}"`, () => { | ||
it('Check apply of settings', () => { | ||
let stringAction = generateStringCountAction(countActionMoveSlider); | ||
cy.openSettings(); | ||
cy.get('.cvat-settings-modal').within(() => { | ||
cy.contains('Player').click(); | ||
cy.wrap(classNameSliders).each(($el) => { | ||
cy.wrap($el).get($el).within(() => { | ||
cy.get('[role=slider]') | ||
.type(stringAction) | ||
.should('have.attr', 'aria-valuenow', expectedResultInSetting); | ||
}); | ||
}); | ||
}); | ||
const expectedResultInBackground = (defaultValueInSidebar + countActionMoveSlider) / 100; | ||
checkStateValuesInBackground(expectedResultInBackground); | ||
}); | ||
|
||
it('Check reset of settings', () => { | ||
cy.get('.cvat-player-reset-color-settings').click(); | ||
const expectedResultInBackground = defaultValueInSidebar / 100; | ||
checkStateValuesInBackground(expectedResultInBackground); | ||
}); | ||
}); | ||
}); |