Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress test. Settings. Player speed. #2758

Merged
merged 7 commits into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -109,27 +109,28 @@ export default function PlayerSettingsComponent(props: Props): JSX.Element {
<Col>
<Text className='cvat-text-color'> Player speed </Text>
<Select
className='cvat-player-settings-speed-select'
value={frameSpeed}
onChange={(speed: FrameSpeed): void => {
onChangeFrameSpeed(speed);
}}
>
<Select.Option key='fastest' value={FrameSpeed.Fastest}>
<Select.Option key='fastest' value={FrameSpeed.Fastest} className='cvat-player-settings-speed-fastest'>
Fastest
</Select.Option>
<Select.Option key='fast' value={FrameSpeed.Fast}>
<Select.Option key='fast' value={FrameSpeed.Fast} className='cvat-player-settings-speed-fast'>
Fast
</Select.Option>
<Select.Option key='usual' value={FrameSpeed.Usual}>
<Select.Option key='usual' value={FrameSpeed.Usual} className='cvat-player-settings-speed-usual'>
Usual
</Select.Option>
<Select.Option key='slow' value={FrameSpeed.Slow}>
<Select.Option key='slow' value={FrameSpeed.Slow} className='cvat-player-settings-speed-slow'>
Slow
</Select.Option>
<Select.Option key='slower' value={FrameSpeed.Slower}>
<Select.Option key='slower' value={FrameSpeed.Slower} className='cvat-player-settings-speed-slower'>
Slower
</Select.Option>
<Select.Option key='slowest' value={FrameSpeed.Slowest}>
<Select.Option key='slowest' value={FrameSpeed.Slowest} className='cvat-player-settings-speed-slowest'>
Slowest
</Select.Option>
</Select>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

/// <reference types="cypress" />

import { taskName, imageFileName } from '../../support/const';

context('Settings. "Player speed" option.', () => {
const caseId = '50';

let timeBeforePlay = 0;
let timeAferPlay = 0;
let durationSlower = 0;
let durationFastest = 0;
let durationFast = 0;

function changePlayerSpeed(speed) {
cy.openSettings();
cy.get('.cvat-player-settings-speed').within(() => {
cy.get('.cvat-player-settings-speed-select').click();
});
cy.get(`.cvat-player-settings-speed-${speed}`).click();
cy.get('.cvat-player-settings-speed-select').should(
'contain.text',
speed.charAt(0).toUpperCase() + speed.slice(1),
);
cy.closeSettings();
}

before(() => {
cy.openTaskJob(taskName);
});

describe(`Testing case "${caseId}"`, () => {
it('Change "Player speed" to "Slower" and measure the speed of changing frames. Go to first frame.', () => {
changePlayerSpeed('slower');
cy.get('.cvat-player-play-button').click();
timeBeforePlay = Date.now();
cy.log(timeBeforePlay);
cy.get('.cvat-player-filename-wrapper')
.should('have.text', `${imageFileName}_28.png`)
.then(() => {
timeAferPlay = Date.now();
durationSlower = timeAferPlay - timeBeforePlay;
});
cy.goCheckFrameNumber(0);
});

it('Change "Player speed" to "Fastest" and measure the speed of changing frames. The "Slower" is expected to be slower than the "Fastest"', () => {
changePlayerSpeed('fastest');
cy.get('.cvat-player-play-button').click();
timeBeforePlay = Date.now();
cy.log(timeBeforePlay);
cy.get('.cvat-player-filename-wrapper')
.should('have.text', `${imageFileName}_28.png`)
.then(() => {
timeAferPlay = Date.now();
durationFastest = timeAferPlay - timeBeforePlay;
expect(durationSlower).to.be.greaterThan(durationFastest);
});
cy.goCheckFrameNumber(0);
});

it('Change "Player speed" to "Fast" and measure the speed of changing frames. The "Slower" is expected to be slower than the "Fastest"', () => {
changePlayerSpeed('fast');
cy.get('.cvat-player-play-button').click();
timeBeforePlay = Date.now();
cy.log(timeBeforePlay);
cy.get('.cvat-player-filename-wrapper')
.should('have.text', `${imageFileName}_28.png`)
.then(() => {
timeAferPlay = Date.now();
durationFast = timeAferPlay - timeBeforePlay;
expect(durationSlower).to.be.greaterThan(durationFast);
});
});
});
});