Skip to content

Commit

Permalink
eslint fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev committed Aug 29, 2023
1 parent 9449336 commit cb7d7fb
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ context('Creating a project by inserting labels from a task.', { browser: '!fire
it('Copying a labels from the task from the raw editor.', () => {
cy.openTask(task.name);
cy.contains('[role="tab"]', 'Raw').click();
cy.get('.cvat-raw-labels-viewer')
.focus()
.realPress(['ControlLeft', 'a'])
.realPress(['ControlLeft', 'c']);
cy.get('.cvat-raw-labels-viewer').focus();
cy.get('.cvat-raw-labels-viewer').realPress(['ControlLeft', 'a']);
cy.get('.cvat-raw-labels-viewer').realPress(['ControlLeft', 'c']);
});

it('Creating a project with copying labels from the task.', () => {
Expand All @@ -61,10 +60,9 @@ context('Creating a project by inserting labels from a task.', { browser: '!fire
cy.get('.cvat-create-project-button').click();
cy.get('#name').type(projectName);
cy.contains('[role="tab"]', 'Raw').click();
cy.get('.cvat-raw-labels-viewer')
.focus()
.clear()
.realPress(['ControlLeft', 'v']);
cy.get('.cvat-raw-labels-viewer').focus();
cy.get('.cvat-raw-labels-viewer').clear();
cy.get('.cvat-raw-labels-viewer').realPress(['ControlLeft', 'v']);
cy.get('.cvat-raw-labels-viewer').then((raw) => {
expect(raw.text()).not.contain('"id":');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ context('Create more than one task per time when create from project.', () => {
const directoryToArchive = imagesFolder;

function createTask(nameTaskToCreate) {
cy.get('[id="name"]').clear().type(nameTaskToCreate);
cy.get('[id="name"]').clear();
cy.get('[id="name"]').type(nameTaskToCreate);
cy.get('.cvat-project-search-field').first().within(() => {
cy.get('[type="search"]').should('have.value', projectName);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ context('Settings. Default number of points in polygon approximation.', () => {
testOpenSettingsWorkspace();
cy.get('.cvat-workspace-settings-approx-poly-threshold')
.find('[role="slider"]')
.type(generateString(4, 'rightarrow'))
.type(generateString(4, 'rightarrow'));
cy.get('.cvat-workspace-settings-approx-poly-threshold')
.find('[role="slider"]')
.then((slider) => {
const sliderAttrValueNow = slider.attr('aria-valuenow');
const sliderAttrValuemin = slider.attr('aria-valuemin');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ context('Settings. "Smooth image" option.', () => {
it('Check "Smooth image" option.', () => {
cy.get('#cvat_canvas_background').should('not.have.class', 'cvat_canvas_pixelized');
cy.openSettings();
cy.get('.cvat-player-settings-smooth-image-checkbox')
.find('[type="checkbox"]')
.should('be.checked')
.click()
.should('not.be.checked');
cy.get('.cvat-player-settings-smooth-image-checkbox').find('[type="checkbox"]').should('be.checked');
cy.get('.cvat-player-settings-smooth-image-checkbox').find('[type="checkbox"]').click();
cy.get('.cvat-player-settings-smooth-image-checkbox').find('[type="checkbox"]').should('not.be.checked');
cy.get('#cvat_canvas_background').should('have.class', 'cvat_canvas_pixelized');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,19 @@ context('Paste labels from one task to another.', { browser: '!firefox' }, () =>
it('Copying a label from a task via the raw editor.', () => {
cy.openTask(task.name);
cy.contains('[role="tab"]', 'Raw').click();
cy.get('.cvat-raw-labels-viewer')
.focus()
.realPress(['ControlLeft', 'a'])
.realPress(['ControlLeft', 'c']);
cy.get('.cvat-raw-labels-viewer').focus();
cy.get('.cvat-raw-labels-viewer').realPress(['ControlLeft', 'a']);
cy.get('.cvat-raw-labels-viewer').realPress(['ControlLeft', 'c']);
});

it('Paste the labels to another task instead of existing.', () => {
cy.goToTaskList();
cy.openTask(task.nameSecond);
cy.contains('.cvat-constructor-viewer-item', task.labelSecond).should('exist');
cy.contains('[role="tab"]', 'Raw').click();
cy.get('.cvat-raw-labels-viewer')
.focus()
.clear()
.realPress(['ControlLeft', 'v']);
cy.get('.cvat-raw-labels-viewer').focus();
cy.get('.cvat-raw-labels-viewer').clear();
cy.get('.cvat-raw-labels-viewer').realPress(['ControlLeft', 'v']);
cy.get('.cvat-raw-labels-viewer').then((raw) => {
expect(raw.text()).not.contain('"id":');
});
Expand Down
24 changes: 19 additions & 5 deletions tests/cypress/e2e/actions_tasks/case_51_settings_auto_save.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,29 @@ context('Settings. "Auto save" option.', () => {
cy.openSettings();
cy.contains('Workspace').click();
cy.get('.cvat-workspace-settings-auto-save').within(() => {
cy.get('[type="checkbox"]').check().should('be.checked');
cy.get('[type="checkbox"]').uncheck().should('not.be.checked');
cy.get('[type="checkbox"]').check();
cy.get('[type="checkbox"]').should('be.checked');
cy.get('[type="checkbox"]').uncheck();
cy.get('[type="checkbox"]').should('not.be.checked');
});
cy.get('.cvat-workspace-settings-auto-save-interval').within(() => {
// The absence of a value takes a minimum value
cy.get('[role="spinbutton"]').focus().clear().should('have.value', 1);
cy.get('[role="spinbutton"]').focus();
cy.get('[role="spinbutton"]').clear();
cy.get('[role="spinbutton"]').should('have.value', 1);

// Interval should`t be less then 1
cy.get('[role="spinbutton"]').focus().clear().type(0).blur().should('have.value', 1);
cy.get('[role="spinbutton"]').focus().clear().type(5).blur().should('have.value', 5);
cy.get('[role="spinbutton"]').focus();
cy.get('[role="spinbutton"]').clear();
cy.get('[role="spinbutton"]').type(0);
cy.get('[role="spinbutton"]').blur();
cy.get('[role="spinbutton"]').should('have.value', 1);

cy.get('[role="spinbutton"]').focus();
cy.get('[role="spinbutton"]').clear();
cy.get('[role="spinbutton"]').type(5);
cy.get('[role="spinbutton"]').blur();
cy.get('[role="spinbutton"]').should('have.value', 5);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ context('Create a task with set an issue tracker.', () => {
});

it('Set correct issue tracker URL. The task created.', () => {
cy.get('#bugTracker').clear().type(dummyBugTrackerUrl);
cy.get('#bugTracker').clear();
cy.get('#bugTracker').type(dummyBugTrackerUrl);
cy.contains('URL is not a valid URL').should('not.exist');
cy.contains('button', 'Submit & Continue').click();
cy.get('.cvat-notification-create-task-fail').should('not.exist');
Expand All @@ -64,7 +65,8 @@ context('Create a task with set an issue tracker.', () => {
cy.get('.cvat-issue-tracker-value').should('have.text', dummyBugTrackerUrl);
cy.contains('button', 'Open the issue').should('exist').and('be.visible');
cy.get('.cvat-issue-tracker').find('[aria-label="Edit"]').click();
cy.get('.cvat-issue-tracker-value').find('textarea').clear().type(`${incorrectBugTrackerUrl}{Enter}`);
cy.get('.cvat-issue-tracker-value').find('textarea').clear();
cy.get('.cvat-issue-tracker-value').find('textarea').type(`${incorrectBugTrackerUrl}{Enter}`);
cy.get('.cvat-modal-issue-tracker-update-task-fail')
.should('exist')
.and('be.visible')
Expand All @@ -75,7 +77,8 @@ context('Create a task with set an issue tracker.', () => {
it('Remove issue trasker URL.', () => {
cy.get('.cvat-issue-tracker-value').should('have.text', dummyBugTrackerUrl);
cy.get('.cvat-issue-tracker').find('[aria-label="Edit"]').click();
cy.get('.cvat-issue-tracker-value').find('textarea').clear().type('{Enter}');
cy.get('.cvat-issue-tracker-value').find('textarea').clear();
cy.get('.cvat-issue-tracker-value').find('textarea').type('{Enter}');
cy.get('.cvat-open-bug-tracker-button').should('not.exist'); // Not specified
cy.contains('button', 'Open the issue').should('not.exist');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ context('Rename a label via raw editor.', () => {
label.color = newlabelColor;
}
});
cy.get('.cvat-raw-labels-viewer').clear().type(JSON.stringify(labels), { parseSpecialCharSequences: false });
cy.get('.cvat-raw-labels-viewer').clear();
cy.get('.cvat-raw-labels-viewer').type(JSON.stringify(labels), { parseSpecialCharSequences: false });
}

before(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,17 @@ context('Settings "Intelligent polygon cropping".', () => {
}

function testSplitting() {
cy.get('.cvat-canvas-container').click(450, 350, { shiftKey: true }).click(550, 450);
cy.get('.cvat-canvas-container').click(450, 350, { shiftKey: true });
cy.get('.cvat-canvas-container').click(550, 450);
}

function testCheckedIntelligentPolygonCropping(uncheck) {
cy.openSettings();
cy.contains('[role="tab"]', 'Workspace').click();
if (uncheck) {
cy
.get('.cvat-workspace-settings-intelligent-polygon-cropping')
.find('[type="checkbox"]')
.uncheck()
.should('not.be.checked');
cy.get('.cvat-workspace-settings-intelligent-polygon-cropping').find('[type="checkbox"]');
cy.get('.cvat-workspace-settings-intelligent-polygon-cropping').uncheck();
cy.get('.cvat-workspace-settings-intelligent-polygon-cropping').should('not.be.checked');
} else {
cy
.get('.cvat-workspace-settings-intelligent-polygon-cropping')
Expand All @@ -64,16 +63,14 @@ context('Settings "Intelligent polygon cropping".', () => {
it('Check settings "Intelligent polygon cropping".', () => {
// Check settings "Intelligent polygon cropping". Should be checked by default
testCheckedIntelligentPolygonCropping();
cy.get('#cvat_canvas_shape_1')
.trigger('mousemove', { scrollBehavior: false })
.should('have.class', 'cvat_canvas_shape_activated');
cy.get('#cvat_canvas_shape_1').trigger('mousemove', { scrollBehavior: false });
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated');
testSplitting(); // Split the polygon into 2 parts. 1st part 3 points, 2nd part 4 points.
checkCountPoints(4);
cy.get('body').type('{Ctrl}z'); // Canceling the split
testCheckedIntelligentPolygonCropping(true); // Uncheck "Intelligent polygon cropping"
cy.get('#cvat_canvas_shape_1')
.trigger('mousemove', { scrollBehavior: false })
.should('have.class', 'cvat_canvas_shape_activated');
cy.get('#cvat_canvas_shape_1').trigger('mousemove', { scrollBehavior: false });
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated');
testSplitting(); // Split again
cy.get('.cvat-canvas-container').trigger('mouseenter', 500, 370);
cy.get('.cvat_canvas_shape_splitting').should('exist');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ context('Hotkeys to change labels feature.', () => {
cy.contains('Workspace').click();
cy.get('.cvat-workspace-settings-show-text-always').within(() => {
if (check) {
cy.get('[type="checkbox"]').check().should('be.checked');
cy.get('[type="checkbox"]').check();
cy.get('[type="checkbox"]').should('be.checked');
} else {
cy.get('[type="checkbox"]').uncheck().should('not.be.checked');
cy.get('[type="checkbox"]').uncheck();
cy.get('[type="checkbox"]').should('not.be.checked');
}
});
});
Expand Down Expand Up @@ -127,7 +129,8 @@ context('Hotkeys to change labels feature.', () => {
});
cy.get('body').type('{Ctrl}2');
cy.contains(`Default label has been changed to "${secondLabelCurrentVal}"`).should('exist');
cy.get('.cvat-canvas-container').click(500, 500).click(600, 600);
cy.get('.cvat-canvas-container').click(500, 500);
cy.get('.cvat-canvas-container').click(600, 600);
cy.get('#cvat-objects-sidebar-state-item-2')
.find('.cvat-objects-sidebar-state-item-label-selector')
.should('have.text', secondLabelCurrentVal);
Expand Down
21 changes: 9 additions & 12 deletions tests/cypress/e2e/actions_tasks/mutable_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ context('Mutable attribute.', () => {

function testChangingAttributeValue(expectedValue, value) {
cy.get('.cvat-player-next-button').click();
cy.get('.attribute-annotation-sidebar-attr-elem-wrapper')
.find('textarea')
.should('have.value', expectedValue)
.clear()
.type(value);
cy.get('.attribute-annotation-sidebar-attr-elem-wrapper').find('textarea');
cy.get('.attribute-annotation-sidebar-attr-elem-wrapper').should('have.value', expectedValue);
cy.get('.attribute-annotation-sidebar-attr-elem-wrapper').clear();
cy.get('.attribute-annotation-sidebar-attr-elem-wrapper').type(value);
}

function checkObjectDetailValue(frameNum, expectedValue) {
Expand All @@ -60,9 +59,8 @@ context('Mutable attribute.', () => {

it('Go to Standard mode. The object details have correct values on the corresponding frames.', () => {
cy.changeWorkspace('Standard');
cy.get('#cvat_canvas_shape_1')
.trigger('mousemove', { scrollBehavior: false })
.should('have.class', 'cvat_canvas_shape_activated');
cy.get('#cvat_canvas_shape_1').trigger('mousemove', { scrollBehavior: false });
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated');
[
[
0,
Expand Down Expand Up @@ -98,10 +96,9 @@ context('Mutable attribute.', () => {
});

cy.get('body').click(); // deactivate
cy.get('#cvat_canvas_shape_1')
.trigger('mousemove')
.trigger('mouseover')
.should('have.class', 'cvat_canvas_shape_activated');
cy.get('#cvat_canvas_shape_1').trigger('mousemove');
cy.get('#cvat_canvas_shape_1').trigger('mouseover');
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ context('Rename a task.', () => {
cy.get('.cvat-task-details-task-name').within(() => {
cy.get('[aria-label="edit"]').click();
});
cy.contains('.cvat-text-color', myTaskName).click().type(newValue);
cy.contains('.cvat-text-color', myTaskName).click();
cy.contains('.cvat-text-color', myTaskName).type(newValue);
cy.get('.cvat-spinner').should('not.exist');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ context('Filtering, sorting jobs.', () => {
testSetJobSorting({ column: 'Stage' });
cy.get('.cvat-job-item-stage').each((element) => {
sortStage.push(element.text());
}).then(() => {
});
cy.get('.cvat-job-item-stage').then(() => {
expect(sortStage).to.deep.equal(['annotation', 'annotation', 'validation']);
});
testSetJobSorting({ column: 'Stage', reset: true });
Expand All @@ -203,7 +204,8 @@ context('Filtering, sorting jobs.', () => {
testSetJobSorting({ column: 'State' });
cy.get('.cvat-job-item-state').each((element) => {
sortState.push(element.text());
}).then(() => {
});
cy.get('.cvat-job-item-state').then(() => {
expect(sortState).to.deep.equal(['Completed', 'New', 'New']);
});
testSetJobSorting({ column: 'State', reset: true });
Expand All @@ -214,7 +216,8 @@ context('Filtering, sorting jobs.', () => {
testSetJobSorting({ column: 'Assignee' });
cy.get('.cvat-job-assignee-selector').find('input').each((element) => {
sortAssignee.push(element.val());
}).then(() => {
});
cy.get('.cvat-job-assignee-selector').find('input').then(() => {
expect(sortAssignee).to.deep.equal([secondUserName, secondUserName, '']);
});
});
Expand Down
6 changes: 4 additions & 2 deletions tests/cypress/e2e/actions_tasks/task_rectangles_only.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ context('Creating a task with only bounding boxes', () => {
cy.get(`.cvat-label-type-option-${labelSpecification.type}`).click();
});
}
cy.contains('Continue').scrollIntoView().click();
cy.contains('Continue').scrollIntoView();
cy.contains('Continue').click();
cy.get('input[type="file"]').attachFile(archiveName, { subjectType: 'drag-n-drop' });

cy.intercept('/api/tasks?**').as('taskPost');
cy.contains('Submit & Open').scrollIntoView().click();
cy.contains('Submit & Open').scrollIntoView();
cy.contains('Submit & Open').click();

cy.wait('@taskPost').then((interception) => {
taskID = interception.response.body.id;
Expand Down

0 comments on commit cb7d7fb

Please sign in to comment.