Skip to content

Commit

Permalink
Cypress test. Settings player step. (#2539)
Browse files Browse the repository at this point in the history
* add test

* add steps to jump via shortcuts

* improvements test

* added open/close settings  check

Co-authored-by: Dmitriy Oparin <[email protected]>
  • Loading branch information
DmitriyOparin and Dmitriy Oparin authored Dec 11, 2020
1 parent 6e5f683 commit 240f07c
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright (C) 2020 Intel Corporation
//
// SPDX-License-Identifier: MIT

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

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

context('Settings "Player step"', () => {
const caseId = '29';
const countJumpStep = 3;
let startFrame;

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

describe(`Testing case "${caseId}"`, () => {
it('Change player step ', () => {
cy.openSettings();
cy.get('.cvat-settings-modal').within(() => {
cy.contains('Player').click();
cy.get('.cvat-player-settings-step').within(() => {
cy.get('[role="spinbutton"]').clear().type(countJumpStep);
});
});
cy.closeSettings();

// get and save start frame
cy.get('.cvat-player-frame-selector').within(() => {
cy.get('[role="spinbutton"]')
.should('have.attr', 'aria-valuenow')
.then((valueFrameNow) => {
startFrame = Number(valueFrameNow);
});
});
});

it('Jump to forward frame via GUI', () => {
cy.get('.cvat-player-forward-button').click();
cy.checkFrameNum(startFrame + countJumpStep);
});

it('Jump to backward frame via GUI', () => {
cy.get('.cvat-player-backward-button').click();
cy.checkFrameNum(startFrame);
});

it('Jump to forward frame via shortcuts', () => {
cy.get('body').type('{v}');
cy.checkFrameNum(startFrame + countJumpStep);
});

it('Jump to backward frame via shortcuts', () => {
cy.get('body').type('{c}');
cy.checkFrameNum(startFrame);
});
});
});
5 changes: 3 additions & 2 deletions tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,15 @@ Cypress.Commands.add('createPolygon', (createPolygonParams) => {
Cypress.Commands.add('openSettings', () => {
cy.get('.cvat-right-header').find('.cvat-header-menu-dropdown').trigger('mouseover', { which: 1 });
cy.get('.anticon-setting').click();
cy.get('.cvat-settings-modal').should('be.visible');
});

Cypress.Commands.add('closeSettings', () => {
cy.get('.ant-modal-content')
.should('contain', 'Settings')
cy.get('.cvat-settings-modal')
.within(() => {
cy.contains('button', 'Close').click();
});
cy.get('.cvat-settings-modal').should('not.be.visible');
});

Cypress.Commands.add('changeWorkspace', (mode, labelName) => {
Expand Down

0 comments on commit 240f07c

Please sign in to comment.