未验证 提交 c7125a8f 编写于 作者: B Boris Sekachev 提交者: GitHub

Tried to fix one test (#5212)

* Tried to fix one test

* Fixed linter issues & cypress commands
上级 f62aa276
......@@ -261,6 +261,7 @@ function FiltersModalComponent(): JSX.Element {
visible={visible}
closable={false}
width={800}
destroyOnClose
centered
onCancel={() => dispatch(showFilters(false))}
footer={[
......
......@@ -11,7 +11,7 @@ context('Always show object details feature', () => {
const rectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
labelName: labelName,
labelName,
firstX: 400,
firstY: 100,
secondX: 500,
......@@ -20,7 +20,7 @@ context('Always show object details feature', () => {
const polygonTrack = {
reDraw: false,
type: 'Track',
labelName: labelName,
labelName,
pointsMap: [
{ x: 400, y: 300 },
{ x: 500, y: 300 },
......
......@@ -9,6 +9,10 @@ import { taskName } from '../../support/const';
context('Rotate all images feature.', () => {
const caseId = '19';
function checkDegRotate(deg) {
cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', `rotate(${deg}deg);`);
}
function imageRotate(direction = 'anticlockwise', deg) {
cy.get('.cvat-rotate-canvas-control').trigger('mouseover');
if (direction === 'clockwise') {
......@@ -19,10 +23,6 @@ context('Rotate all images feature.', () => {
checkDegRotate(deg);
}
function checkDegRotate(deg) {
cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', `rotate(${deg}deg);`);
}
function checkFrameNum(frameNum) {
cy.get('.cvat-player-frame-selector').within(() => {
cy.get('input[role="spinbutton"]').should('have.value', frameNum);
......@@ -40,7 +40,7 @@ context('Rotate all images feature.', () => {
imageRotate('anticlockwise', 270);
});
it("Go to the next frame. It wasn't rotated.", () => {
it('Go to the next frame. It wasn\'t rotated.', () => {
cy.get('.cvat-player-next-button').click();
checkFrameNum(1);
checkDegRotate(0);
......
......@@ -11,7 +11,7 @@ context('Information about a blocked object disappears if hover the cursor over
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
labelName: labelName,
labelName,
firstX: 250,
firstY: 350,
secondX: 350,
......@@ -20,7 +20,7 @@ context('Information about a blocked object disappears if hover the cursor over
const createRectangleShape2PointsSecond = {
points: 'By 2 Points',
type: 'Shape',
labelName: labelName,
labelName,
firstX: createRectangleShape2Points.firstX,
firstY: createRectangleShape2Points.firstY - 150,
secondX: createRectangleShape2Points.secondX,
......
......@@ -14,7 +14,7 @@ Cypress.Commands.add('сheckFiltersModalOpened', () => {
});
Cypress.Commands.add('collectGroupID', () => {
let groupDataID = [];
const groupDataID = [];
cy.get('.group').then(($group) => {
for (let i = 0; i < $group.length; i++) {
groupDataID.push($group[i].dataset.id);
......@@ -24,7 +24,7 @@ Cypress.Commands.add('collectGroupID', () => {
});
Cypress.Commands.add('collectRuleID', () => {
let ruleDataID = [];
const ruleDataID = [];
cy.get('.rule').then(($rule) => {
for (let i = 0; i < $rule.length; i++) {
ruleDataID.push($rule[i].dataset.id);
......@@ -37,7 +37,7 @@ Cypress.Commands.add('clearFilters', () => {
cy.сheckFiltersModalOpened();
cy.contains('button', 'Clear filters').click();
cy.get('.cvat-filters-modal-visible').should('not.exist');
cy.get('.cvat-filters-modal').should('be.hidden');
cy.get('.cvat-filters-modal').should('not.exist');
});
Cypress.Commands.add('addFiltersGroup', (groupIndex) => {
......@@ -66,7 +66,9 @@ Cypress.Commands.add('setGroupCondition', (groupIndex, condition) => {
Cypress.Commands.add(
'setFilter',
({ groupIndex, ruleIndex, field, operator, valueSource, value, label, labelAttr, submit }) => {
({
groupIndex, ruleIndex, field, operator, valueSource, value, label, labelAttr, submit,
}) => {
cy.сheckFiltersModalOpened();
cy.collectGroupID().then((groupIdIndex) => {
cy.collectRuleID().then((ruleIdIndex) => {
......@@ -104,16 +106,14 @@ Cypress.Commands.add(
.within(() => {
if (field === 'Attributes') {
cy.get('[placeholder="Enter string"]').last().type(`${value}{Enter}`);
} else {
if (!valueSource) {
if (field === 'ObjectID' || field === 'Width' || field === 'Height') {
cy.get('[placeholder="Enter number"]').type(`${value}{Enter}`);
} else {
cy.get('[type="search"]').last().type(`${value}{Enter}`);
}
} else if (!valueSource) {
if (field === 'ObjectID' || field === 'Width' || field === 'Height') {
cy.get('[placeholder="Enter number"]').type(`${value}{Enter}`);
} else {
cy.contains('[type="button"]', 'Select field ').click();
cy.get('[type="search"]').last().type(`${value}{Enter}`);
}
} else {
cy.contains('[type="button"]', 'Select field ').click();
}
});
if (valueSource) {
......@@ -124,7 +124,7 @@ Cypress.Commands.add(
cy.contains('button', 'Submit').click();
});
cy.get('.cvat-filters-modal-visible').should('not.exist');
cy.get('.cvat-filters-modal').should('be.hidden');
cy.get('.cvat-filters-modal').should('not.exist');
}
});
});
......@@ -143,5 +143,5 @@ Cypress.Commands.add('selectFilterValue', (filterValue) => {
cy.contains('button', 'Submit').click();
});
cy.get('.cvat-filters-modal-visible').should('not.exist');
cy.get('.cvat-filters-modal').should('be.hidden');
cy.get('.cvat-filters-modal').should('not.exist');
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册