Fixed built, improved testing system (#43)

Fixed nightly built, reworked closing platform notification, updated cypress, fixed vulnerabilities in tests/
main
Boris Sekachev 4 years ago committed by GitHub
parent f960da9117
commit ebd04aa4de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,9 +1,11 @@
// Copyright (C) 2020-2021 Intel Corporation // Copyright (C) 2020-2022 Intel Corporation
// //
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
/// <reference types="cypress" /> /// <reference types="cypress" />
/* eslint-disable no-loop-func */
import { taskName, labelName } from '../../support/const'; import { taskName, labelName } from '../../support/const';
context('Group features', () => { context('Group features', () => {
@ -11,7 +13,7 @@ context('Group features', () => {
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,
@ -20,7 +22,7 @@ context('Group features', () => {
const createRectangleShape2PointsSecond = { const createRectangleShape2PointsSecond = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: createRectangleShape2Points.firstX + 300, firstX: createRectangleShape2Points.firstX + 300,
firstY: createRectangleShape2Points.firstY, firstY: createRectangleShape2Points.firstY,
secondX: createRectangleShape2Points.secondX + 300, secondX: createRectangleShape2Points.secondX + 300,
@ -29,7 +31,7 @@ context('Group features', () => {
const createRectangleTrack2Points = { const createRectangleTrack2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Track', type: 'Track',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 600, firstY: 600,
secondX: 350, secondX: 350,
@ -38,7 +40,7 @@ context('Group features', () => {
const createRectangleTrack2PointsSecond = { const createRectangleTrack2PointsSecond = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Track', type: 'Track',
labelName: labelName, labelName,
firstX: createRectangleTrack2Points.firstX + 300, firstX: createRectangleTrack2Points.firstX + 300,
firstY: createRectangleTrack2Points.firstY, firstY: createRectangleTrack2Points.firstY,
secondX: createRectangleTrack2Points.secondX + 300, secondX: createRectangleTrack2Points.secondX + 300,
@ -75,7 +77,11 @@ context('Group features', () => {
for (const shapeToGroup of objectsArray) { for (const shapeToGroup of objectsArray) {
cy.get(shapeToGroup).click().should('have.class', 'cvat_canvas_shape_grouping'); cy.get(shapeToGroup).click().should('have.class', 'cvat_canvas_shape_grouping');
} }
cancelGrouping ? cy.get('body').type('{Esc}') : cy.get('.cvat-group-control').click(); if (cancelGrouping) {
cy.get('body').type('{Esc}');
} else {
cy.get('.cvat-group-control').click();
}
} }
function testUnGroupObjects() { function testUnGroupObjects() {
@ -119,9 +125,11 @@ context('Group features', () => {
cy.get(objectSideBarShape) cy.get(objectSideBarShape)
.should('have.css', 'background-color') .should('have.css', 'background-color')
.then(($bColorobjectSideBarShape) => { .then(($bColorobjectSideBarShape) => {
// expected rgba(250, 50, 83, 0.533) to not include [ 224, 224, 224, index: 4, input: 'rgb(224, 224, 224)', groups: undefined ] // expected rgba(250, 50, 83, 0.533) to not include
// [ 224, 224, 224, index: 4, input: 'rgb(224, 224, 224)', groups: undefined ]
expect($bColorobjectSideBarShape).to.not.contain(defaultGroupColorRgb.match(/\d+, \d+, \d+/)); expect($bColorobjectSideBarShape).to.not.contain(defaultGroupColorRgb.match(/\d+, \d+, \d+/));
// expected rgba(250, 50, 83, 0.533) to include [ 250, 50, 83, index: 4, input: 'rgb(250, 50, 83)', groups: undefined ] // expected rgba(250, 50, 83, 0.533) to include
// [ 250, 50, 83, index: 4, input: 'rgb(250, 50, 83)', groups: undefined ]
expect($bColorobjectSideBarShape).to.be.contain(shapesGroupColor.match(/\d+, \d+, \d+/)); expect($bColorobjectSideBarShape).to.be.contain(shapesGroupColor.match(/\d+, \d+, \d+/));
}); });
} }
@ -151,7 +159,8 @@ context('Group features', () => {
cy.get($listObjectsSidebarStateItem[i]) cy.get($listObjectsSidebarStateItem[i])
.should('have.css', 'background-color') .should('have.css', 'background-color')
.then(($bColorObjectsSidebarStateItem) => { .then(($bColorObjectsSidebarStateItem) => {
// expected rgba(224, 224, 224, 0.533) to include [ 224, 224, 224, index: 4, input: 'rgb(224, 224, 224)', groups: undefined ] // expected rgba(224, 224, 224, 0.533) to include
// [ 224, 224, 224, index: 4, input: 'rgb(224, 224, 224)', groups: undefined ]
expect($bColorObjectsSidebarStateItem).contain(defaultGroupColorRgb.match(/\d+, \d+, \d+/)); expect($bColorObjectsSidebarStateItem).contain(defaultGroupColorRgb.match(/\d+, \d+, \d+/));
}); });
} }
@ -191,9 +200,11 @@ context('Group features', () => {
cy.get(objectSideBarTrack) cy.get(objectSideBarTrack)
.should('have.css', 'background-color') .should('have.css', 'background-color')
.then(($bColorobjectSideBarTrack) => { .then(($bColorobjectSideBarTrack) => {
// expected rgba(52, 209, 183, 0.533) to not include [ 224, 224, 224, index: 4, input: 'rgb(224, 224, 224)', groups: undefined ] // expected rgba(52, 209, 183, 0.533) to not include
// [ 224, 224, 224, index: 4, input: 'rgb(224, 224, 224)', groups: undefined ]
expect($bColorobjectSideBarTrack).to.not.contain(defaultGroupColorRgb.match(/\d+, \d+, \d+/)); expect($bColorobjectSideBarTrack).to.not.contain(defaultGroupColorRgb.match(/\d+, \d+, \d+/));
// expected rgba(52, 209, 183, 0.533) to include [ 52, 209, 183, index: 4, input: 'rgb(52, 209, 183)', groups: undefined ] // expected rgba(52, 209, 183, 0.533) to include
// [ 52, 209, 183, index: 4, input: 'rgb(52, 209, 183)', groups: undefined ]
expect($bColorobjectSideBarTrack).to.be.contain(tracksGroupColor.match(/\d+, \d+, \d+/)); expect($bColorobjectSideBarTrack).to.be.contain(tracksGroupColor.match(/\d+, \d+, \d+/));
}); });
} }
@ -205,7 +216,6 @@ context('Group features', () => {
cy.removeAnnotations(); cy.removeAnnotations();
cy.saveJob('PUT'); cy.saveJob('PUT');
cy.reload(); cy.reload();
cy.closeModalUnsupportedPlatform();
cy.get('.cvat-canvas-container').should('exist'); cy.get('.cvat-canvas-container').should('exist');
}); });

@ -1,4 +1,4 @@
// Copyright (C) 2021 Intel Corporation // Copyright (C) 2021-2022 Intel Corporation
// //
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
@ -45,7 +45,6 @@ context('Settings. Default number of points in polygon approximation.', () => {
cy.closeNotification('.cvat-notification-notice-save-settings-success'); cy.closeNotification('.cvat-notification-notice-save-settings-success');
cy.closeSettings(); cy.closeSettings();
cy.reload(); cy.reload();
cy.closeModalUnsupportedPlatform(); // If the Firefox browser closes the modal window after reload
testCheckSliderAttrValuenow(sliderAttrValueNow); testCheckSliderAttrValuenow(sliderAttrValueNow);
cy.contains('strong', 'less').click(); cy.contains('strong', 'less').click();
testCheckSliderAttrValuenow(sliderAttrValuemin); testCheckSliderAttrValuenow(sliderAttrValuemin);

@ -1,4 +1,4 @@
// Copyright (C) 2021 Intel Corporation // Copyright (C) 2021-2022 Intel Corporation
// //
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
@ -11,7 +11,7 @@ context('Create a link for shape, frame.', () => {
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,
@ -26,30 +26,29 @@ context('Create a link for shape, frame.', () => {
describe(`Testing case "${caseId}"`, () => { describe(`Testing case "${caseId}"`, () => {
it('Create a link for a shape, for a frame.', () => { it('Create a link for a shape, for a frame.', () => {
cy.window().then(win => { cy.window().then((win) => {
cy.stub(win, 'prompt').returns(win.prompt).as('copyToClipboardPromptShape'); cy.stub(win, 'prompt').returns(win.prompt).as('copyToClipboardPromptShape');
}); });
cy.get('#cvat-objects-sidebar-state-item-1').find('[aria-label="more"]').trigger('mouseover'); cy.get('#cvat-objects-sidebar-state-item-1').find('[aria-label="more"]').trigger('mouseover');
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated') cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated');
cy.get('.cvat-object-item-menu').last().should('be.visible').contains('button', 'Create object URL').click(); cy.get('.cvat-object-item-menu').last().should('be.visible').contains('button', 'Create object URL').click();
cy.get('@copyToClipboardPromptShape').should('be.called'); cy.get('@copyToClipboardPromptShape').should('be.called');
cy.get('@copyToClipboardPromptShape').then(prompt => { cy.get('@copyToClipboardPromptShape').then((prompt) => {
const url = prompt.args[0][1]; const url = prompt.args[0][1];
expect(url).include('frame='); expect(url).include('frame=');
expect(url).include('type='); expect(url).include('type=');
expect(url).include('serverID='); expect(url).include('serverID=');
cy.visit(url); cy.visit(url);
cy.closeModalUnsupportedPlatform();
cy.get('.cvat-canvas-container').should('be.visible'); cy.get('.cvat-canvas-container').should('be.visible');
cy.get('#cvat_canvas_shape_1').should('be.visible'); cy.get('#cvat_canvas_shape_1').should('be.visible');
}); });
cy.window().then(win => { cy.window().then((win) => {
cy.stub(win, 'prompt').returns(win.prompt).as('copyToClipboardPromptFrame'); cy.stub(win, 'prompt').returns(win.prompt).as('copyToClipboardPromptFrame');
}); });
cy.get('.cvat-player-frame-url-icon').click(); cy.get('.cvat-player-frame-url-icon').click();
cy.get('@copyToClipboardPromptFrame').should('be.called'); cy.get('@copyToClipboardPromptFrame').should('be.called');
cy.get('@copyToClipboardPromptFrame').then(prompt => { cy.get('@copyToClipboardPromptFrame').then((prompt) => {
const url = prompt.args[0][1]; const url = prompt.args[0][1];
expect(url).include('frame='); expect(url).include('frame=');
expect(url).not.include('type='); expect(url).not.include('type=');

@ -1,4 +1,4 @@
// Copyright (C) 2021 Intel Corporation // Copyright (C) 2021-2022 Intel Corporation
// //
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
@ -17,9 +17,11 @@ context('Saving setting to local storage.', () => {
'.cvat-workspace-settings-show-text-always', '.cvat-workspace-settings-show-text-always',
'.cvat-workspace-settings-autoborders', '.cvat-workspace-settings-autoborders',
]) { ]) {
checked if (checked) {
? cy.get(ws).find('[type="checkbox"]').should('be.checked') cy.get(ws).find('[type="checkbox"]').should('be.checked');
: cy.get(ws).find('[type="checkbox"]').should('not.be.checked').check().should('be.checked'); } else {
cy.get(ws).find('[type="checkbox"]').should('not.be.checked').check().should('be.checked');
}
} }
} }
@ -37,7 +39,6 @@ context('Saving setting to local storage.', () => {
.click(); .click();
cy.closeSettings(); cy.closeSettings();
cy.reload(); cy.reload();
cy.closeModalUnsupportedPlatform(); // If the Firefox browser closes the modal window after reload
testCheckedSettings(true); testCheckedSettings(true);
}); });
}); });

@ -60,7 +60,6 @@ context('Delete a label from a task.', () => {
cy.wait('@searchUsers'); cy.wait('@searchUsers');
}); });
cy.reload(); cy.reload();
cy.closeModalUnsupportedPlatform(); // If the Firefox browser closes the modal window after reload
cy.get('td.cvat-job-item-state').invoke('text').should('equal', 'in progress'); cy.get('td.cvat-job-item-state').invoke('text').should('equal', 'in progress');
}); });
}); });

@ -22,7 +22,6 @@ context('When clicking on the Logout button, get the user session closed.', () =
describe(`Testing issue "${issueId}"`, () => { describe(`Testing issue "${issueId}"`, () => {
it('Login', () => { it('Login', () => {
cy.closeModalUnsupportedPlatform();
cy.login(); cy.login();
}); });

@ -52,7 +52,6 @@ context('Register user, change password, login with new password', () => {
cy.logout(userName); cy.logout(userName);
}); });
it('Login with the new password', () => { it('Login with the new password', () => {
cy.closeModalUnsupportedPlatform();
cy.login(userName, newPassword); cy.login(userName, newPassword);
}); });
it('Change password with incorrect current password', () => { it('Change password with incorrect current password', () => {

@ -36,7 +36,6 @@ Cypress.Commands.add('logout', (username = Cypress.env('user')) => {
cy.get('span[aria-label="logout"]').click(); cy.get('span[aria-label="logout"]').click();
cy.url().should('include', '/auth/login'); cy.url().should('include', '/auth/login');
cy.visit('/auth/login'); // clear query parameter "next" cy.visit('/auth/login'); // clear query parameter "next"
cy.closeModalUnsupportedPlatform();
}); });
Cypress.Commands.add('userRegistration', (firstName, lastName, userName, emailAddr, password) => { Cypress.Commands.add('userRegistration', (firstName, lastName, userName, emailAddr, password) => {
@ -830,7 +829,7 @@ Cypress.Commands.add('getObjectIdNumberByLabelName', (labelName) => {
}); });
Cypress.Commands.add('closeModalUnsupportedPlatform', () => { Cypress.Commands.add('closeModalUnsupportedPlatform', () => {
if (Cypress.browser.family !== 'chromium') { if (Cypress.browser.family !== 'chromium' && !window.localStorage.getItem('platformNotiticationShown')) {
cy.get('.cvat-modal-unsupported-platform-warning').within(() => { cy.get('.cvat-modal-unsupported-platform-warning').within(() => {
cy.contains('button', 'OK').click(); cy.contains('button', 'OK').click();
}); });
@ -900,3 +899,13 @@ Cypress.Commands.add('deleteFrame', (action = 'delete') => {
cy.saveJob('PATCH', 200); cy.saveJob('PATCH', 200);
cy.wait('@patchMeta').its('response.statusCode').should('equal', 200); cy.wait('@patchMeta').its('response.statusCode').should('equal', 200);
}); });
Cypress.Commands.overwrite('visit', (orig, url, options) => {
orig(url, options);
cy.closeModalUnsupportedPlatform();
});
Cypress.Commands.overwrite('reload', (orig, options) => {
orig(options);
cy.closeModalUnsupportedPlatform();
});

@ -13,13 +13,6 @@ require('./commands_organizations');
require('@cypress/code-coverage/support'); require('@cypress/code-coverage/support');
require('cypress-real-events/support'); require('cypress-real-events/support');
before(() => {
if (Cypress.browser.family !== 'chromium') {
cy.visit('/');
}
cy.closeModalUnsupportedPlatform();
});
// Chrome: ResizeObserver loop limit exceeded // Chrome: ResizeObserver loop limit exceeded
// Firefox: ResizeObserver loop completed with undelivered notifications // Firefox: ResizeObserver loop completed with undelivered notifications
const resizeObserverLoopErr = 'ResizeObserver loop'; const resizeObserverLoopErr = 'ResizeObserver loop';

10505
tests/package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -8,11 +8,12 @@
"@cypress/code-coverage": "^3.9.10", "@cypress/code-coverage": "^3.9.10",
"archiver": "^5.3.0", "archiver": "^5.3.0",
"cy-verify-downloads": "^0.0.5", "cy-verify-downloads": "^0.0.5",
"cypress": "^8.3.1", "cypress": "^9.7.0",
"cypress-file-upload": "^5.0.8", "cypress-file-upload": "^5.0.8",
"cypress-localstorage-commands": "^1.5.0", "cypress-localstorage-commands": "^1.7.0",
"cypress-real-events": "^1.6.0", "cypress-real-events": "^1.6.0",
"extract-zip": "^2.0.1", "extract-zip": "^2.0.1",
"fs-extra": "^10.1.0",
"jimp": "^0.16.1" "jimp": "^0.16.1"
} }
} }

Loading…
Cancel
Save